@umijs/bundler-webpack 4.0.0-rc.1 → 4.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/autoprefixer/browserslist/index.d.ts +4 -0
- package/compiled/autoprefixer/index.js +3 -3
- package/compiled/autoprefixer/postcss/lib/at-rule.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/comment.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/declaration.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/rule.d.ts +1 -1
- package/compiled/autoprefixer/source-map-js/source-map.d.ts +99 -82
- package/compiled/copy-webpack-plugin/576.index.js +1171 -0
- package/compiled/copy-webpack-plugin/index.js +16 -10
- package/compiled/copy-webpack-plugin/package.json +1 -1
- package/compiled/css-minimizer-webpack-plugin/index.js +8 -2
- package/compiled/css-minimizer-webpack-plugin/minify.js +25 -11
- package/compiled/css-minimizer-webpack-plugin/package.json +1 -1
- package/compiled/css-minimizer-webpack-plugin/utils.js +225 -28
- package/compiled/cssnano/index.js +12 -11
- package/compiled/express/index.js +57 -74
- package/compiled/fork-ts-checker-webpack-plugin/index.js +14 -15
- package/compiled/http-proxy-middleware/dist/types.d.ts +5 -5
- package/compiled/http-proxy-middleware/http-proxy/index.d.ts +1 -1
- package/compiled/http-proxy-middleware/index.js +10 -10
- package/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +60 -8
- package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +13 -1
- package/compiled/mini-css-extract-plugin/index.js +4427 -3979
- package/compiled/mini-css-extract-plugin/loader.js +177 -54
- package/compiled/mini-css-extract-plugin/package.json +1 -1
- package/compiled/mini-css-extract-plugin/utils.js +77 -23
- package/compiled/sass-loader/index.js +1 -1
- package/compiled/terser-webpack-plugin/index.js +296 -297
- package/compiled/terser-webpack-plugin/minify.js +4 -2
- package/compiled/terser-webpack-plugin/package.json +1 -1
- package/compiled/terser-webpack-plugin/types/index.d.ts +180 -146
- package/compiled/terser-webpack-plugin/types/minify.d.ts +17 -0
- package/compiled/terser-webpack-plugin/types/utils.d.ts +1 -3
- package/compiled/terser-webpack-plugin/utils.js +9 -12
- package/compiled/webpack/index.js +8652 -3904
- package/compiled/webpack-dev-middleware/index.js +7 -7
- package/compiled/webpack-dev-middleware/package.json +1 -1
- package/compiled/webpack-manifest-plugin/index.js +1 -1
- package/compiled/webpack-sources/index.js +1 -1
- package/compiled/ws/index.d.ts +1 -2
- package/compiled/ws/index.js +1 -1
- package/dist/build.d.ts +2 -1
- package/dist/build.js +1 -1
- package/dist/config/config.js +4 -3
- package/dist/config/detectDeadCode.d.ts +12 -0
- package/dist/config/detectDeadCode.js +120 -0
- package/dist/config/detectDeadCodePlugin.d.ts +9 -0
- package/dist/config/detectDeadCodePlugin.js +71 -0
- package/dist/config/javaScriptRules.js +3 -6
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +4 -1
- package/dist/dev.d.ts +1 -0
- package/dist/dev.js +7 -5
- package/dist/loader/swc.js +14 -18
- package/dist/requireHook.js +1 -1
- package/dist/schema.js +2 -0
- package/dist/swcPlugins/autoCSSModules.d.ts +7 -2
- package/dist/swcPlugins/autoCSSModules.js +11 -16
- package/dist/types.d.ts +9 -12
- package/dist/utils/depMatch.js +1 -1
- package/package.json +31 -31
- package/dist/esbuildHandler/autoCssModules.d.ts +0 -2
- package/dist/esbuildHandler/autoCssModules.js +0 -23
- package/dist/loader/esbuild.d.ts +0 -5
- package/dist/loader/esbuild.js +0 -53
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"terser-webpack-plugin","author":"webpack Contrib Team","license":"MIT","types":"types/
|
|
1
|
+
{"name":"terser-webpack-plugin","author":"webpack Contrib Team","license":"MIT","types":"types/index.d.ts"}
|
|
@@ -1,106 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type Schema = import('../schema-utils/declarations/validate').Schema;
|
|
3
|
-
export type Compiler = import('../../webpack').Compiler;
|
|
4
|
-
export type Compilation = import('../../webpack').Compilation;
|
|
5
|
-
export type WebpackError = import('../../webpack').WebpackError;
|
|
6
|
-
export type Asset = import('../../webpack').Asset;
|
|
7
|
-
export type TerserECMA = import('./utils').TerserECMA;
|
|
8
|
-
export type TerserOptions = import('./utils').TerserOptions;
|
|
9
|
-
export type CustomOptions = import('./utils').CustomOptions;
|
|
10
|
-
export type JestWorker = import('../jest-worker').Worker;
|
|
11
|
-
export type RawSourceMap = import('../source-map').RawSourceMap;
|
|
12
|
-
export type Rule = RegExp | string;
|
|
13
|
-
export type Rules = Rule[] | Rule;
|
|
14
|
-
export type ExtractCommentsFunction = (
|
|
15
|
-
astNode: any,
|
|
16
|
-
comment: {
|
|
17
|
-
value: string;
|
|
18
|
-
type: "comment1" | "comment2" | "comment3" | "comment4";
|
|
19
|
-
pos: number;
|
|
20
|
-
line: number;
|
|
21
|
-
col: number;
|
|
22
|
-
}
|
|
23
|
-
) => boolean;
|
|
24
|
-
export type ExtractCommentsCondition =
|
|
25
|
-
| boolean
|
|
26
|
-
| "all"
|
|
27
|
-
| "some"
|
|
28
|
-
| RegExp
|
|
29
|
-
| ExtractCommentsFunction;
|
|
30
|
-
export type ExtractCommentsFilename = string | ((fileData: any) => string);
|
|
31
|
-
export type ExtractCommentsBanner =
|
|
32
|
-
| string
|
|
33
|
-
| boolean
|
|
34
|
-
| ((commentsFile: string) => string);
|
|
35
|
-
export type ExtractCommentsObject = {
|
|
36
|
-
condition?: ExtractCommentsCondition | undefined;
|
|
37
|
-
filename?: ExtractCommentsFilename | undefined;
|
|
38
|
-
banner?: ExtractCommentsBanner | undefined;
|
|
39
|
-
};
|
|
40
|
-
export type ExtractCommentsOptions =
|
|
41
|
-
| ExtractCommentsCondition
|
|
42
|
-
| ExtractCommentsObject;
|
|
43
|
-
export type Input = {
|
|
44
|
-
[file: string]: string;
|
|
45
|
-
};
|
|
46
|
-
export type MinimizedResult = {
|
|
47
|
-
code: string;
|
|
48
|
-
map?: import('../source-map').RawSourceMap | undefined;
|
|
49
|
-
errors?: (string | Error)[] | undefined;
|
|
50
|
-
warnings?: (string | Error)[] | undefined;
|
|
51
|
-
extractedComments?: string[] | undefined;
|
|
52
|
-
};
|
|
53
|
-
export type PredefinedOptions = {
|
|
54
|
-
module?: boolean | undefined;
|
|
55
|
-
ecma?: any;
|
|
56
|
-
};
|
|
57
|
-
export type MinimizerImplementationAndOptions<T> = {
|
|
58
|
-
implementation: MinimizerImplementation<T>;
|
|
59
|
-
options: PredefinedOptions & T;
|
|
60
|
-
};
|
|
61
|
-
export type InternalOptions<T> = {
|
|
62
|
-
name: string;
|
|
63
|
-
input: string;
|
|
64
|
-
inputSourceMap: RawSourceMap | undefined;
|
|
65
|
-
extractComments: ExtractCommentsOptions | undefined;
|
|
66
|
-
minimizer: MinimizerImplementationAndOptions<T>;
|
|
67
|
-
};
|
|
68
|
-
export type MinimizerWorker<T> = Worker & {
|
|
69
|
-
transform: (options: string) => MinimizedResult;
|
|
70
|
-
minify: (options: InternalOptions<T>) => MinimizedResult;
|
|
71
|
-
};
|
|
72
|
-
export type BasicMinimizerImplementation<T> = (
|
|
73
|
-
input: Input,
|
|
74
|
-
sourceMap: RawSourceMap | undefined,
|
|
75
|
-
minifyOptions: T,
|
|
76
|
-
extractComments: ExtractCommentsOptions | undefined
|
|
77
|
-
) => Promise<MinimizedResult>;
|
|
78
|
-
export type MinimizeFunctionHelpers = {
|
|
79
|
-
getMinimizerVersion?: (() => string | undefined) | undefined;
|
|
80
|
-
};
|
|
81
|
-
export type MinimizerImplementation<T> = BasicMinimizerImplementation<T> &
|
|
82
|
-
MinimizeFunctionHelpers;
|
|
83
|
-
export type Parallel = undefined | boolean | number;
|
|
84
|
-
export type BasePluginOptions = {
|
|
85
|
-
test?: Rules | undefined;
|
|
86
|
-
include?: Rules | undefined;
|
|
87
|
-
exclude?: Rules | undefined;
|
|
88
|
-
extractComments?: ExtractCommentsOptions | undefined;
|
|
89
|
-
parallel?: Parallel;
|
|
90
|
-
};
|
|
91
|
-
export type InferDefaultType<T> = T extends infer U
|
|
92
|
-
? U
|
|
93
|
-
: import('./utils').CustomOptions;
|
|
94
|
-
export type DefinedDefaultMinimizerAndOptions<T> =
|
|
95
|
-
InferDefaultType<T> extends TerserOptions
|
|
96
|
-
? {
|
|
97
|
-
minify?: MinimizerImplementation<InferDefaultType<T>> | undefined;
|
|
98
|
-
terserOptions?: InferDefaultType<T> | undefined;
|
|
99
|
-
}
|
|
100
|
-
: {
|
|
101
|
-
minify: MinimizerImplementation<InferDefaultType<T>>;
|
|
102
|
-
terserOptions?: InferDefaultType<T> | undefined;
|
|
103
|
-
};
|
|
1
|
+
export = TerserPlugin;
|
|
104
2
|
/** @typedef {import('../schema-utils/declarations/validate').Schema} Schema */
|
|
105
3
|
/** @typedef {import('../../webpack').Compiler} Compiler */
|
|
106
4
|
/** @typedef {import('../../webpack').Compilation} Compilation */
|
|
@@ -108,7 +6,6 @@ export type DefinedDefaultMinimizerAndOptions<T> =
|
|
|
108
6
|
/** @typedef {import('../../webpack').Asset} Asset */
|
|
109
7
|
/** @typedef {import('./utils').TerserECMA} TerserECMA */
|
|
110
8
|
/** @typedef {import('./utils').TerserOptions} TerserOptions */
|
|
111
|
-
/** @typedef {import('./utils').CustomOptions} CustomOptions */
|
|
112
9
|
/** @typedef {import('../jest-worker').Worker} JestWorker */
|
|
113
10
|
/** @typedef {import('../source-map').RawSourceMap} RawSourceMap */
|
|
114
11
|
/** @typedef {RegExp | string} Rule */
|
|
@@ -137,9 +34,6 @@ export type DefinedDefaultMinimizerAndOptions<T> =
|
|
|
137
34
|
/**
|
|
138
35
|
* @typedef {ExtractCommentsCondition | ExtractCommentsObject} ExtractCommentsOptions
|
|
139
36
|
*/
|
|
140
|
-
/**
|
|
141
|
-
* @typedef {{ [file: string]: string }} Input
|
|
142
|
-
*/
|
|
143
37
|
/**
|
|
144
38
|
* @typedef {Object} MinimizedResult
|
|
145
39
|
* @property {string} code
|
|
@@ -149,35 +43,30 @@ export type DefinedDefaultMinimizerAndOptions<T> =
|
|
|
149
43
|
* @property {Array<string>} [extractedComments]
|
|
150
44
|
*/
|
|
151
45
|
/**
|
|
152
|
-
* @typedef {
|
|
153
|
-
* @property {boolean} [module]
|
|
154
|
-
* @property {any} [ecma]
|
|
46
|
+
* @typedef {{ [file: string]: string }} Input
|
|
155
47
|
*/
|
|
156
48
|
/**
|
|
157
|
-
* @
|
|
158
|
-
* @typedef {Object} MinimizerImplementationAndOptions
|
|
159
|
-
* @property {MinimizerImplementation<T>} implementation
|
|
160
|
-
* @property {PredefinedOptions & T} options
|
|
49
|
+
* @typedef {{ [key: string]: any }} CustomOptions
|
|
161
50
|
*/
|
|
162
51
|
/**
|
|
163
52
|
* @template T
|
|
164
|
-
* @typedef {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
* @
|
|
168
|
-
* @property {
|
|
169
|
-
* @property {
|
|
53
|
+
* @typedef {T extends infer U ? U : CustomOptions} InferDefaultType
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* @typedef {Object} PredefinedOptions
|
|
57
|
+
* @property {boolean} [module]
|
|
58
|
+
* @property {TerserECMA} [ecma]
|
|
170
59
|
*/
|
|
171
60
|
/**
|
|
172
61
|
* @template T
|
|
173
|
-
* @typedef {
|
|
62
|
+
* @typedef {PredefinedOptions & InferDefaultType<T>} MinimizerOptions
|
|
174
63
|
*/
|
|
175
64
|
/**
|
|
176
65
|
* @template T
|
|
177
66
|
* @callback BasicMinimizerImplementation
|
|
178
67
|
* @param {Input} input
|
|
179
68
|
* @param {RawSourceMap | undefined} sourceMap
|
|
180
|
-
* @param {T} minifyOptions
|
|
69
|
+
* @param {MinimizerOptions<T>} minifyOptions
|
|
181
70
|
* @param {ExtractCommentsOptions | undefined} extractComments
|
|
182
71
|
* @returns {Promise<MinimizedResult>}
|
|
183
72
|
*/
|
|
@@ -187,7 +76,20 @@ export type DefinedDefaultMinimizerAndOptions<T> =
|
|
|
187
76
|
*/
|
|
188
77
|
/**
|
|
189
78
|
* @template T
|
|
190
|
-
* @typedef {BasicMinimizerImplementation<T> & MinimizeFunctionHelpers
|
|
79
|
+
* @typedef {BasicMinimizerImplementation<T> & MinimizeFunctionHelpers} MinimizerImplementation
|
|
80
|
+
*/
|
|
81
|
+
/**
|
|
82
|
+
* @template T
|
|
83
|
+
* @typedef {Object} InternalOptions
|
|
84
|
+
* @property {string} name
|
|
85
|
+
* @property {string} input
|
|
86
|
+
* @property {RawSourceMap | undefined} inputSourceMap
|
|
87
|
+
* @property {ExtractCommentsOptions | undefined} extractComments
|
|
88
|
+
* @property {{ implementation: MinimizerImplementation<T>, options: MinimizerOptions<T> }} minimizer
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* @template T
|
|
92
|
+
* @typedef {JestWorker & { transform: (options: string) => MinimizedResult, minify: (options: InternalOptions<T>) => MinimizedResult }} MinimizerWorker
|
|
191
93
|
*/
|
|
192
94
|
/**
|
|
193
95
|
* @typedef {undefined | boolean | number} Parallel
|
|
@@ -202,16 +104,16 @@ export type DefinedDefaultMinimizerAndOptions<T> =
|
|
|
202
104
|
*/
|
|
203
105
|
/**
|
|
204
106
|
* @template T
|
|
205
|
-
* @typedef {T extends
|
|
107
|
+
* @typedef {T extends TerserOptions ? { minify?: MinimizerImplementation<T> | undefined, terserOptions?: MinimizerOptions<T> | undefined } : { minify: MinimizerImplementation<T>, terserOptions?: MinimizerOptions<T> | undefined }} DefinedDefaultMinimizerAndOptions
|
|
206
108
|
*/
|
|
207
109
|
/**
|
|
208
110
|
* @template T
|
|
209
|
-
* @typedef {
|
|
111
|
+
* @typedef {BasePluginOptions & { minimizer: { implementation: MinimizerImplementation<T>, options: MinimizerOptions<T> } }} InternalPluginOptions
|
|
210
112
|
*/
|
|
211
113
|
/**
|
|
212
|
-
* @template T
|
|
114
|
+
* @template [T=TerserOptions]
|
|
213
115
|
*/
|
|
214
|
-
declare class TerserPlugin<T =
|
|
116
|
+
declare class TerserPlugin<T = import('../../terser').MinifyOptions> {
|
|
215
117
|
/**
|
|
216
118
|
* @private
|
|
217
119
|
* @param {any} input
|
|
@@ -220,7 +122,7 @@ declare class TerserPlugin<T = TerserOptions> {
|
|
|
220
122
|
private static isSourceMap;
|
|
221
123
|
/**
|
|
222
124
|
* @private
|
|
223
|
-
* @param {
|
|
125
|
+
* @param {unknown} warning
|
|
224
126
|
* @param {string} file
|
|
225
127
|
* @returns {Error}
|
|
226
128
|
*/
|
|
@@ -254,19 +156,11 @@ declare class TerserPlugin<T = TerserOptions> {
|
|
|
254
156
|
| (BasePluginOptions & DefinedDefaultMinimizerAndOptions<T>)
|
|
255
157
|
| undefined
|
|
256
158
|
);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
exclude: Rules | undefined;
|
|
263
|
-
minimizer: {
|
|
264
|
-
implementation: MinimizerImplementation<
|
|
265
|
-
import('../../terser').MinifyOptions & InferDefaultType<T>
|
|
266
|
-
>;
|
|
267
|
-
options: InferDefaultType<T>;
|
|
268
|
-
};
|
|
269
|
-
};
|
|
159
|
+
/**
|
|
160
|
+
* @private
|
|
161
|
+
* @type {InternalPluginOptions<T>}
|
|
162
|
+
*/
|
|
163
|
+
private options;
|
|
270
164
|
/**
|
|
271
165
|
* @private
|
|
272
166
|
* @param {Compiler} compiler
|
|
@@ -283,13 +177,153 @@ declare class TerserPlugin<T = TerserOptions> {
|
|
|
283
177
|
apply(compiler: Compiler): void;
|
|
284
178
|
}
|
|
285
179
|
declare namespace TerserPlugin {
|
|
286
|
-
export {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
180
|
+
export {
|
|
181
|
+
terserMinify,
|
|
182
|
+
uglifyJsMinify,
|
|
183
|
+
swcMinify,
|
|
184
|
+
esbuildMinify,
|
|
185
|
+
Schema,
|
|
186
|
+
Compiler,
|
|
187
|
+
Compilation,
|
|
188
|
+
WebpackError,
|
|
189
|
+
Asset,
|
|
190
|
+
TerserECMA,
|
|
191
|
+
TerserOptions,
|
|
192
|
+
JestWorker,
|
|
193
|
+
RawSourceMap,
|
|
194
|
+
Rule,
|
|
195
|
+
Rules,
|
|
196
|
+
ExtractCommentsFunction,
|
|
197
|
+
ExtractCommentsCondition,
|
|
198
|
+
ExtractCommentsFilename,
|
|
199
|
+
ExtractCommentsBanner,
|
|
200
|
+
ExtractCommentsObject,
|
|
201
|
+
ExtractCommentsOptions,
|
|
202
|
+
MinimizedResult,
|
|
203
|
+
Input,
|
|
204
|
+
CustomOptions,
|
|
205
|
+
InferDefaultType,
|
|
206
|
+
PredefinedOptions,
|
|
207
|
+
MinimizerOptions,
|
|
208
|
+
BasicMinimizerImplementation,
|
|
209
|
+
MinimizeFunctionHelpers,
|
|
210
|
+
MinimizerImplementation,
|
|
211
|
+
InternalOptions,
|
|
212
|
+
MinimizerWorker,
|
|
213
|
+
Parallel,
|
|
214
|
+
BasePluginOptions,
|
|
215
|
+
DefinedDefaultMinimizerAndOptions,
|
|
216
|
+
InternalPluginOptions,
|
|
217
|
+
};
|
|
290
218
|
}
|
|
291
|
-
|
|
219
|
+
type Compiler = import('../../webpack').Compiler;
|
|
220
|
+
type BasePluginOptions = {
|
|
221
|
+
test?: Rules | undefined;
|
|
222
|
+
include?: Rules | undefined;
|
|
223
|
+
exclude?: Rules | undefined;
|
|
224
|
+
extractComments?: ExtractCommentsOptions | undefined;
|
|
225
|
+
parallel?: Parallel;
|
|
226
|
+
};
|
|
227
|
+
type DefinedDefaultMinimizerAndOptions<T> = T extends TerserOptions
|
|
228
|
+
? {
|
|
229
|
+
minify?: MinimizerImplementation<T> | undefined;
|
|
230
|
+
terserOptions?: MinimizerOptions<T> | undefined;
|
|
231
|
+
}
|
|
232
|
+
: {
|
|
233
|
+
minify: MinimizerImplementation<T>;
|
|
234
|
+
terserOptions?: MinimizerOptions<T> | undefined;
|
|
235
|
+
};
|
|
292
236
|
import { terserMinify } from './utils';
|
|
293
237
|
import { uglifyJsMinify } from './utils';
|
|
294
238
|
import { swcMinify } from './utils';
|
|
295
239
|
import { esbuildMinify } from './utils';
|
|
240
|
+
type Schema = import('../schema-utils/declarations/validate').Schema;
|
|
241
|
+
type Compilation = import('../../webpack').Compilation;
|
|
242
|
+
type WebpackError = import('../../webpack').WebpackError;
|
|
243
|
+
type Asset = import('../../webpack').Asset;
|
|
244
|
+
type TerserECMA = import('./utils').TerserECMA;
|
|
245
|
+
type TerserOptions = import('./utils').TerserOptions;
|
|
246
|
+
type JestWorker = import('../jest-worker').Worker;
|
|
247
|
+
type RawSourceMap = import('../source-map').RawSourceMap;
|
|
248
|
+
type Rule = RegExp | string;
|
|
249
|
+
type Rules = Rule[] | Rule;
|
|
250
|
+
type ExtractCommentsFunction = (
|
|
251
|
+
astNode: any,
|
|
252
|
+
comment: {
|
|
253
|
+
value: string;
|
|
254
|
+
type: "comment1" | "comment2" | "comment3" | "comment4";
|
|
255
|
+
pos: number;
|
|
256
|
+
line: number;
|
|
257
|
+
col: number;
|
|
258
|
+
}
|
|
259
|
+
) => boolean;
|
|
260
|
+
type ExtractCommentsCondition =
|
|
261
|
+
| boolean
|
|
262
|
+
| "all"
|
|
263
|
+
| "some"
|
|
264
|
+
| RegExp
|
|
265
|
+
| ExtractCommentsFunction;
|
|
266
|
+
type ExtractCommentsFilename = string | ((fileData: any) => string);
|
|
267
|
+
type ExtractCommentsBanner =
|
|
268
|
+
| string
|
|
269
|
+
| boolean
|
|
270
|
+
| ((commentsFile: string) => string);
|
|
271
|
+
type ExtractCommentsObject = {
|
|
272
|
+
condition?: ExtractCommentsCondition | undefined;
|
|
273
|
+
filename?: ExtractCommentsFilename | undefined;
|
|
274
|
+
banner?: ExtractCommentsBanner | undefined;
|
|
275
|
+
};
|
|
276
|
+
type ExtractCommentsOptions = ExtractCommentsCondition | ExtractCommentsObject;
|
|
277
|
+
type MinimizedResult = {
|
|
278
|
+
code: string;
|
|
279
|
+
map?: import('../source-map').RawSourceMap | undefined;
|
|
280
|
+
errors?: (string | Error)[] | undefined;
|
|
281
|
+
warnings?: (string | Error)[] | undefined;
|
|
282
|
+
extractedComments?: string[] | undefined;
|
|
283
|
+
};
|
|
284
|
+
type Input = {
|
|
285
|
+
[file: string]: string;
|
|
286
|
+
};
|
|
287
|
+
type CustomOptions = {
|
|
288
|
+
[key: string]: any;
|
|
289
|
+
};
|
|
290
|
+
type InferDefaultType<T> = T extends infer U ? U : CustomOptions;
|
|
291
|
+
type PredefinedOptions = {
|
|
292
|
+
module?: boolean | undefined;
|
|
293
|
+
ecma?: import('../../terser').ECMA | undefined;
|
|
294
|
+
};
|
|
295
|
+
type MinimizerOptions<T> = PredefinedOptions & InferDefaultType<T>;
|
|
296
|
+
type BasicMinimizerImplementation<T> = (
|
|
297
|
+
input: Input,
|
|
298
|
+
sourceMap: RawSourceMap | undefined,
|
|
299
|
+
minifyOptions: MinimizerOptions<T>,
|
|
300
|
+
extractComments: ExtractCommentsOptions | undefined
|
|
301
|
+
) => Promise<MinimizedResult>;
|
|
302
|
+
type MinimizeFunctionHelpers = {
|
|
303
|
+
getMinimizerVersion?: (() => string | undefined) | undefined;
|
|
304
|
+
};
|
|
305
|
+
type MinimizerImplementation<T> = BasicMinimizerImplementation<T> &
|
|
306
|
+
MinimizeFunctionHelpers;
|
|
307
|
+
type InternalOptions<T> = {
|
|
308
|
+
name: string;
|
|
309
|
+
input: string;
|
|
310
|
+
inputSourceMap: RawSourceMap | undefined;
|
|
311
|
+
extractComments: ExtractCommentsOptions | undefined;
|
|
312
|
+
minimizer: {
|
|
313
|
+
implementation: MinimizerImplementation<T>;
|
|
314
|
+
options: MinimizerOptions<T>;
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
type MinimizerWorker<T> = Worker & {
|
|
318
|
+
transform: (options: string) => MinimizedResult;
|
|
319
|
+
minify: (options: InternalOptions<T>) => MinimizedResult;
|
|
320
|
+
};
|
|
321
|
+
type Parallel = undefined | boolean | number;
|
|
322
|
+
type InternalPluginOptions<T> = BasePluginOptions & {
|
|
323
|
+
minimizer: {
|
|
324
|
+
implementation: MinimizerImplementation<T>;
|
|
325
|
+
options: MinimizerOptions<T>;
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
import { minify } from './minify';
|
|
329
|
+
import { Worker } from '../jest-worker';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type MinimizedResult = import('./index').MinimizedResult;
|
|
2
|
+
export type CustomOptions = import('./index').CustomOptions;
|
|
3
|
+
/** @typedef {import('./index').MinimizedResult} MinimizedResult */
|
|
4
|
+
/** @typedef {import('./index').CustomOptions} CustomOptions */
|
|
5
|
+
/**
|
|
6
|
+
* @template T
|
|
7
|
+
* @param {import('./index').InternalOptions<T>} options
|
|
8
|
+
* @returns {Promise<MinimizedResult>}
|
|
9
|
+
*/
|
|
10
|
+
export function minify<T>(
|
|
11
|
+
options: import('./index').InternalOptions<T>
|
|
12
|
+
): Promise<MinimizedResult>;
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} options
|
|
15
|
+
* @returns {Promise<MinimizedResult>}
|
|
16
|
+
*/
|
|
17
|
+
export function transform(options: string): Promise<MinimizedResult>;
|
|
@@ -12,9 +12,7 @@ export type ExtractCommentsCondition =
|
|
|
12
12
|
export type Input = import('./index').Input;
|
|
13
13
|
export type MinimizedResult = import('./index').MinimizedResult;
|
|
14
14
|
export type PredefinedOptions = import('./index').PredefinedOptions;
|
|
15
|
-
export type CustomOptions =
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
};
|
|
15
|
+
export type CustomOptions = import('./index').CustomOptions;
|
|
18
16
|
export type ExtractedComments = Array<string>;
|
|
19
17
|
/**
|
|
20
18
|
* @template T
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.esbuildMinify = esbuildMinify;
|
|
7
|
-
exports.swcMinify = swcMinify;
|
|
8
|
-
exports.terserMinify = terserMinify;
|
|
9
|
-
exports.throttleAll = throttleAll;
|
|
10
|
-
exports.uglifyJsMinify = uglifyJsMinify;
|
|
11
|
-
|
|
12
3
|
/** @typedef {import("source-map").RawSourceMap} RawSourceMap */
|
|
13
4
|
|
|
14
5
|
/** @typedef {import("terser").FormatOptions} TerserFormatOptions */
|
|
@@ -29,9 +20,7 @@ exports.uglifyJsMinify = uglifyJsMinify;
|
|
|
29
20
|
|
|
30
21
|
/** @typedef {import("./index.js").PredefinedOptions} PredefinedOptions */
|
|
31
22
|
|
|
32
|
-
/**
|
|
33
|
-
* @typedef {{ [key: string]: any }} CustomOptions
|
|
34
|
-
*/
|
|
23
|
+
/** @typedef {import("./index.js").CustomOptions} CustomOptions */
|
|
35
24
|
|
|
36
25
|
/**
|
|
37
26
|
* @typedef {Array<string>} ExtractedComments
|
|
@@ -687,4 +676,12 @@ esbuildMinify.getMinimizerVersion = () => {
|
|
|
687
676
|
}
|
|
688
677
|
|
|
689
678
|
return packageJson && packageJson.version;
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
module.exports = {
|
|
682
|
+
throttleAll,
|
|
683
|
+
terserMinify,
|
|
684
|
+
uglifyJsMinify,
|
|
685
|
+
swcMinify,
|
|
686
|
+
esbuildMinify
|
|
690
687
|
};
|