@umijs/bundler-webpack 4.0.0-beta.9 → 4.0.0-rc.3
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 +11 -7
- 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/container.d.ts +2 -2
- package/compiled/autoprefixer/postcss/lib/css-syntax-error.d.ts +55 -8
- package/compiled/autoprefixer/postcss/lib/declaration.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/input.d.ts +26 -6
- package/compiled/autoprefixer/postcss/lib/lazy-result.d.ts +11 -10
- package/compiled/autoprefixer/postcss/lib/no-work-result.d.ts +37 -0
- package/compiled/autoprefixer/postcss/lib/node.d.ts +36 -2
- package/compiled/autoprefixer/postcss/lib/postcss.d.ts +31 -30
- package/compiled/autoprefixer/postcss/lib/processor.d.ts +5 -4
- package/compiled/autoprefixer/postcss/lib/result.d.ts +3 -2
- package/compiled/autoprefixer/postcss/lib/rule.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/warning.d.ts +37 -3
- package/compiled/autoprefixer/source-map-js/source-map.d.ts +99 -82
- package/compiled/babel-loader/index.js +2 -2
- 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/LICENSE +21 -0
- package/compiled/fork-ts-checker-webpack-plugin/fsevents.node +0 -0
- package/compiled/fork-ts-checker-webpack-plugin/index.js +48 -0
- package/compiled/fork-ts-checker-webpack-plugin/package.json +1 -0
- 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 +8103 -7617
- 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 +83 -24
- package/compiled/postcss-loader/index.js +1 -1
- package/compiled/react-refresh/index.js +3 -3
- package/compiled/sass-loader/index.js +1 -1
- package/compiled/schema-utils/ajv/dist/ajv.d.ts +16 -0
- package/compiled/schema-utils/ajv/dist/compile/codegen/code.d.ts +39 -0
- package/compiled/schema-utils/ajv/dist/compile/codegen/index.d.ts +79 -0
- package/compiled/schema-utils/ajv/dist/compile/codegen/scope.d.ts +79 -0
- package/compiled/schema-utils/ajv/dist/compile/errors.d.ts +13 -0
- package/compiled/schema-utils/ajv/dist/compile/index.d.ts +80 -0
- package/compiled/schema-utils/ajv/dist/compile/ref_error.d.ts +5 -0
- package/compiled/schema-utils/ajv/dist/compile/resolve.d.ts +12 -0
- package/compiled/schema-utils/ajv/dist/compile/rules.d.ts +28 -0
- package/compiled/schema-utils/ajv/dist/compile/util.d.ts +40 -0
- package/compiled/schema-utils/ajv/dist/compile/validate/index.d.ts +42 -0
- package/compiled/schema-utils/ajv/dist/compile/validate/subschema.d.ts +47 -0
- package/compiled/schema-utils/ajv/dist/core.d.ts +171 -0
- package/compiled/schema-utils/ajv/dist/runtime/validation_error.d.ts +7 -0
- package/compiled/schema-utils/ajv/dist/types/index.d.ts +177 -0
- package/compiled/schema-utils/ajv/dist/types/json-schema.d.ts +124 -0
- package/compiled/schema-utils/ajv/dist/types/jtd-schema.d.ts +168 -0
- package/compiled/schema-utils/declarations/validate.d.ts +4 -4
- package/compiled/schema-utils/index.js +8 -2
- package/compiled/schema-utils/uri-js/dist/es5/uri.all.d.ts +59 -0
- package/compiled/style-loader/index.js +1 -1
- package/compiled/terser/index.js +1 -1
- package/compiled/terser-webpack-plugin/index.js +393 -517
- package/compiled/terser-webpack-plugin/jest-worker/build/types.d.ts +1 -0
- package/compiled/terser-webpack-plugin/minify.js +10 -3
- package/compiled/terser-webpack-plugin/package.json +1 -1
- package/compiled/terser-webpack-plugin/types/index.d.ts +183 -149
- package/compiled/terser-webpack-plugin/types/minify.d.ts +17 -0
- package/compiled/terser-webpack-plugin/types/utils.d.ts +10 -15
- package/compiled/terser-webpack-plugin/utils.js +118 -25
- package/compiled/webpack/index.js +10464 -5286
- package/compiled/webpack-dev-middleware/index.js +11 -5
- package/compiled/webpack-dev-middleware/package.json +1 -1
- package/compiled/webpack-manifest-plugin/LICENSE +21 -0
- package/compiled/webpack-manifest-plugin/index.js +1 -0
- package/compiled/webpack-manifest-plugin/package.json +1 -0
- 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 +5 -3
- package/dist/build.js +2 -1
- package/dist/cli.js +4 -7
- package/dist/config/assetRules.js +6 -14
- package/dist/config/compressPlugin.js +6 -0
- package/dist/config/config.d.ts +7 -2
- package/dist/config/config.js +49 -7
- package/dist/config/cssRules.js +1 -1
- 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/forkTSCheckerPlugin.d.ts +11 -0
- package/dist/config/forkTSCheckerPlugin.js +34 -0
- package/dist/config/harmonyLinkingErrorPlugin.d.ts +6 -0
- package/dist/config/harmonyLinkingErrorPlugin.js +42 -0
- package/dist/config/javaScriptRules.d.ts +1 -0
- package/dist/config/javaScriptRules.js +31 -20
- package/dist/config/manifestPlugin.d.ts +11 -0
- package/dist/config/manifestPlugin.js +25 -0
- package/dist/config/miniCSSExtractPlugin.d.ts +1 -0
- package/dist/config/miniCSSExtractPlugin.js +2 -3
- package/dist/config/svgRules.d.ts +1 -0
- package/dist/config/svgRules.js +17 -3
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +4 -1
- package/dist/dev.d.ts +4 -2
- package/dist/dev.js +31 -5
- package/dist/loader/svgr.d.ts +4 -0
- package/dist/loader/svgr.js +67 -0
- package/dist/loader/swc.d.ts +4 -0
- package/dist/loader/swc.js +79 -0
- package/dist/plugins/ParcelCSSMinifyPlugin.d.ts +10 -0
- package/dist/plugins/ParcelCSSMinifyPlugin.js +74 -0
- package/dist/plugins/RuntimePublicPathPlugin.d.ts +4 -0
- package/dist/plugins/RuntimePublicPathPlugin.js +20 -0
- package/dist/requireHook.js +1 -1
- package/dist/schema.js +14 -6
- package/dist/server/server.js +20 -1
- package/dist/swcPlugins/autoCSSModules.d.ts +7 -2
- package/dist/swcPlugins/autoCSSModules.js +13 -16
- package/dist/swcPlugins/lockCoreJS.d.ts +6 -0
- package/dist/swcPlugins/lockCoreJS.js +23 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.js +1 -0
- package/dist/utils/depMatch.js +1 -1
- package/package.json +45 -39
- package/compiled/@svgr/webpack/LICENSE +0 -7
- package/compiled/@svgr/webpack/index.js +0 -266
- package/compiled/@svgr/webpack/package.json +0 -1
- package/compiled/swc-loader/LICENSE +0 -25
- package/compiled/swc-loader/index.js +0 -1
- package/compiled/swc-loader/package.json +0 -1
|
@@ -34,10 +34,17 @@ async function transform(options) {
|
|
|
34
34
|
// 'use strict' => this === undefined (Clean Scope)
|
|
35
35
|
// Safer for possible security issues, albeit not critical at all here
|
|
36
36
|
// eslint-disable-next-line no-param-reassign
|
|
37
|
-
const evaluatedOptions =
|
|
37
|
+
const evaluatedOptions =
|
|
38
|
+
/**
|
|
39
|
+
* @template T
|
|
40
|
+
* @type {import("./index.js").InternalOptions<T>}
|
|
41
|
+
* */
|
|
42
|
+
// eslint-disable-next-line no-new-func
|
|
38
43
|
new Function("exports", "require", "module", "__filename", "__dirname", `'use strict'\nreturn ${options}`)(exports, require, module, __filename, __dirname);
|
|
39
44
|
return minify(evaluatedOptions);
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
module.exports
|
|
43
|
-
|
|
47
|
+
module.exports = {
|
|
48
|
+
minify,
|
|
49
|
+
transform
|
|
50
|
+
};
|
|
@@ -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,18 +122,18 @@ 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
|
-
* @returns {
|
|
127
|
+
* @returns {Error}
|
|
226
128
|
*/
|
|
227
129
|
private static buildWarning;
|
|
228
130
|
/**
|
|
229
131
|
* @private
|
|
230
132
|
* @param {any} error
|
|
231
133
|
* @param {string} file
|
|
232
|
-
* @param {Compilation["requestShortener"]} [requestShortener]
|
|
233
134
|
* @param {SourceMapConsumer} [sourceMap]
|
|
234
|
-
* @
|
|
135
|
+
* @param {Compilation["requestShortener"]} [requestShortener]
|
|
136
|
+
* @returns {Error}
|
|
235
137
|
*/
|
|
236
138
|
private static buildError;
|
|
237
139
|
/**
|
|
@@ -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>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type Task<T> = () => Promise<T>;
|
|
1
2
|
export type RawSourceMap = import('../source-map').RawSourceMap;
|
|
2
3
|
export type TerserFormatOptions = import('../../terser').FormatOptions;
|
|
3
4
|
export type TerserOptions = import('../../terser').MinifyOptions;
|
|
@@ -11,26 +12,20 @@ export type ExtractCommentsCondition =
|
|
|
11
12
|
export type Input = import('./index').Input;
|
|
12
13
|
export type MinimizedResult = import('./index').MinimizedResult;
|
|
13
14
|
export type PredefinedOptions = import('./index').PredefinedOptions;
|
|
14
|
-
export type CustomOptions =
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
};
|
|
15
|
+
export type CustomOptions = import('./index').CustomOptions;
|
|
17
16
|
export type ExtractedComments = Array<string>;
|
|
18
|
-
/** @typedef {import('../source-map').RawSourceMap} RawSourceMap */
|
|
19
|
-
/** @typedef {import('../../terser').FormatOptions} TerserFormatOptions */
|
|
20
|
-
/** @typedef {import('../../terser').MinifyOptions} TerserOptions */
|
|
21
|
-
/** @typedef {import('../../terser').ECMA} TerserECMA */
|
|
22
|
-
/** @typedef {import('./index').ExtractCommentsOptions} ExtractCommentsOptions */
|
|
23
|
-
/** @typedef {import('./index').ExtractCommentsFunction} ExtractCommentsFunction */
|
|
24
|
-
/** @typedef {import('./index').ExtractCommentsCondition} ExtractCommentsCondition */
|
|
25
|
-
/** @typedef {import('./index').Input} Input */
|
|
26
|
-
/** @typedef {import('./index').MinimizedResult} MinimizedResult */
|
|
27
|
-
/** @typedef {import('./index').PredefinedOptions} PredefinedOptions */
|
|
28
17
|
/**
|
|
29
|
-
* @
|
|
18
|
+
* @template T
|
|
19
|
+
* @typedef {() => Promise<T>} Task
|
|
30
20
|
*/
|
|
31
21
|
/**
|
|
32
|
-
*
|
|
22
|
+
* Run tasks with limited concurency.
|
|
23
|
+
* @template T
|
|
24
|
+
* @param {number} limit - Limit of tasks that run at once.
|
|
25
|
+
* @param {Task<T>[]} tasks - List of tasks to run.
|
|
26
|
+
* @returns {Promise<T[]>} A promise that fulfills to an array of the results
|
|
33
27
|
*/
|
|
28
|
+
export function throttleAll<T>(limit: number, tasks: Task<T>[]): Promise<T[]>;
|
|
34
29
|
/**
|
|
35
30
|
* @param {Input} input
|
|
36
31
|
* @param {RawSourceMap | undefined} sourceMap
|