@umijs/bundler-webpack 4.0.0-rc.1 → 4.0.0-rc.10

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.
Files changed (111) hide show
  1. package/client/client/client.js +49 -35
  2. package/client/constants.js +3 -0
  3. package/compiled/autoprefixer/browserslist/index.d.ts +6 -0
  4. package/compiled/autoprefixer/index.js +3 -3
  5. package/compiled/autoprefixer/postcss/lib/at-rule.d.ts +1 -1
  6. package/compiled/autoprefixer/postcss/lib/comment.d.ts +1 -1
  7. package/compiled/autoprefixer/postcss/lib/declaration.d.ts +2 -2
  8. package/compiled/autoprefixer/postcss/lib/node.d.ts +2 -2
  9. package/compiled/autoprefixer/postcss/lib/rule.d.ts +1 -1
  10. package/compiled/autoprefixer/source-map-js/source-map.d.ts +99 -82
  11. package/compiled/babel-loader/index.js +2 -2
  12. package/compiled/copy-webpack-plugin/939.index.js +1171 -0
  13. package/compiled/copy-webpack-plugin/index.js +16 -10
  14. package/compiled/copy-webpack-plugin/package.json +1 -1
  15. package/compiled/css-minimizer-webpack-plugin/index.js +8 -2
  16. package/compiled/css-minimizer-webpack-plugin/minify.js +25 -11
  17. package/compiled/css-minimizer-webpack-plugin/package.json +1 -1
  18. package/compiled/css-minimizer-webpack-plugin/utils.js +225 -28
  19. package/compiled/cssnano/index.js +12 -11
  20. package/compiled/cssnano/package.json +1 -1
  21. package/compiled/express.d.ts +2 -0
  22. package/compiled/fork-ts-checker-webpack-plugin/index.js +14 -15
  23. package/compiled/http-proxy-middleware/dist/types.d.ts +5 -5
  24. package/compiled/http-proxy-middleware/http-proxy/index.d.ts +1 -1
  25. package/compiled/http-proxy-middleware/index.js +10 -10
  26. package/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +60 -8
  27. package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +13 -1
  28. package/compiled/mini-css-extract-plugin/index.js +4523 -4036
  29. package/compiled/mini-css-extract-plugin/loader.js +179 -54
  30. package/compiled/mini-css-extract-plugin/package.json +1 -1
  31. package/compiled/mini-css-extract-plugin/utils.js +79 -23
  32. package/compiled/sass-loader/index.js +1 -1
  33. package/compiled/terser/index.js +1 -1
  34. package/compiled/terser-webpack-plugin/index.js +296 -297
  35. package/compiled/terser-webpack-plugin/minify.js +4 -2
  36. package/compiled/terser-webpack-plugin/package.json +1 -1
  37. package/compiled/terser-webpack-plugin/types/index.d.ts +180 -146
  38. package/compiled/terser-webpack-plugin/types/minify.d.ts +17 -0
  39. package/compiled/terser-webpack-plugin/types/utils.d.ts +1 -3
  40. package/compiled/terser-webpack-plugin/utils.js +9 -12
  41. package/compiled/webpack/index.js +9855 -4185
  42. package/compiled/webpack-dev-middleware/index.js +7 -7
  43. package/compiled/webpack-dev-middleware/package.json +1 -1
  44. package/compiled/webpack-manifest-plugin/index.js +1 -1
  45. package/compiled/webpack-sources/index.js +1 -1
  46. package/compiled/ws/index.d.ts +1 -2
  47. package/compiled/ws/index.js +1 -1
  48. package/dist/build.d.ts +2 -1
  49. package/dist/build.js +1 -1
  50. package/dist/client/client.js +7 -2
  51. package/dist/config/compressPlugin.js +6 -0
  52. package/dist/config/config.js +4 -3
  53. package/dist/config/cssRules.js +1 -1
  54. package/dist/config/detectDeadCode.d.ts +12 -0
  55. package/dist/config/detectDeadCode.js +120 -0
  56. package/dist/config/detectDeadCodePlugin.d.ts +9 -0
  57. package/dist/config/detectDeadCodePlugin.js +75 -0
  58. package/dist/config/javaScriptRules.js +7 -12
  59. package/dist/constants.d.ts +3 -0
  60. package/dist/constants.js +4 -1
  61. package/dist/dev.d.ts +1 -0
  62. package/dist/dev.js +13 -5
  63. package/dist/index.d.ts +4 -1
  64. package/dist/index.js +5 -1
  65. package/dist/loader/swc.js +14 -18
  66. package/dist/plugins/ESBuildCSSMinifyPlugin.js +1 -3
  67. package/dist/plugins/ParcelCSSMinifyPlugin.d.ts +10 -0
  68. package/dist/plugins/ParcelCSSMinifyPlugin.js +75 -0
  69. package/dist/plugins/ProgressPlugin.js +2 -2
  70. package/dist/plugins/RuntimePublicPathPlugin.js +1 -1
  71. package/dist/requireHook.js +1 -1
  72. package/dist/schema.js +10 -6
  73. package/dist/server/server.d.ts +1 -2
  74. package/dist/server/server.js +27 -11
  75. package/dist/server/ws.d.ts +3 -2
  76. package/dist/swcPlugins/autoCSSModules.d.ts +7 -2
  77. package/dist/swcPlugins/autoCSSModules.js +14 -17
  78. package/dist/swcPlugins/changeImportFromString.d.ts +2 -0
  79. package/dist/swcPlugins/changeImportFromString.js +10 -0
  80. package/dist/swcPlugins/lockCoreJS.d.ts +1 -1
  81. package/dist/swcPlugins/lockCoreJS.js +3 -2
  82. package/dist/types.d.ts +16 -12
  83. package/dist/types.js +1 -0
  84. package/dist/utils/depMatch.js +1 -1
  85. package/dist/utils/server.d.ts +5 -0
  86. package/dist/utils/server.js +93 -0
  87. package/package.json +38 -41
  88. package/compiled/css-loader/LICENSE +0 -20
  89. package/compiled/css-loader/api.js +0 -102
  90. package/compiled/css-loader/getUrl.js +0 -29
  91. package/compiled/css-loader/index.js +0 -2
  92. package/compiled/css-loader/noSourceMaps.js +0 -5
  93. package/compiled/css-loader/package.json +0 -1
  94. package/compiled/css-loader/sourceMaps.js +0 -22
  95. package/compiled/express/LICENSE +0 -24
  96. package/compiled/express/body-parser/index.d.ts +0 -104
  97. package/compiled/express/connect/index.d.ts +0 -93
  98. package/compiled/express/express-serve-static-core/index.d.ts +0 -1252
  99. package/compiled/express/index.d.ts +0 -133
  100. package/compiled/express/index.js +0 -338
  101. package/compiled/express/mime/index.d.ts +0 -35
  102. package/compiled/express/package.json +0 -1
  103. package/compiled/express/qs/index.d.ts +0 -62
  104. package/compiled/express/range-parser/index.d.ts +0 -35
  105. package/compiled/express/serve-static/index.d.ts +0 -108
  106. package/compiled/less/index.js +0 -31
  107. package/compiled/less/package.json +0 -1
  108. package/dist/esbuildHandler/autoCssModules.d.ts +0 -2
  109. package/dist/esbuildHandler/autoCssModules.js +0 -23
  110. package/dist/loader/esbuild.d.ts +0 -5
  111. package/dist/loader/esbuild.js +0 -53
@@ -44,5 +44,7 @@ async function transform(options) {
44
44
  return minify(evaluatedOptions);
45
45
  }
46
46
 
47
- module.exports.minify = minify;
48
- module.exports.transform = transform;
47
+ module.exports = {
48
+ minify,
49
+ transform
50
+ };
@@ -1 +1 @@
1
- {"name":"terser-webpack-plugin","author":"webpack Contrib Team","license":"MIT","types":"types/cjs.d.ts"}
1
+ {"name":"terser-webpack-plugin","author":"webpack Contrib Team","license":"MIT","types":"types/index.d.ts"}
@@ -1,106 +1,4 @@
1
- export default TerserPlugin;
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 {Object} PredefinedOptions
153
- * @property {boolean} [module]
154
- * @property {any} [ecma]
46
+ * @typedef {{ [file: string]: string }} Input
155
47
  */
156
48
  /**
157
- * @template T
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 {Object} InternalOptions
165
- * @property {string} name
166
- * @property {string} input
167
- * @property {RawSourceMap | undefined} inputSourceMap
168
- * @property {ExtractCommentsOptions | undefined} extractComments
169
- * @property {MinimizerImplementationAndOptions<T>} minimizer
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 {JestWorker & { transform: (options: string) => MinimizedResult, minify: (options: InternalOptions<T>) => MinimizedResult }} MinimizerWorker
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 } MinimizerImplementation
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 infer U ? U : CustomOptions} InferDefaultType
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 {InferDefaultType<T> extends TerserOptions ? { minify?: MinimizerImplementation<InferDefaultType<T>> | undefined, terserOptions?: InferDefaultType<T> | undefined } : { minify: MinimizerImplementation<InferDefaultType<T>>, terserOptions?: InferDefaultType<T> | undefined }} DefinedDefaultMinimizerAndOptions
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 = TerserOptions> {
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 {Error | string} warning
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
- options: {
258
- test: Rules;
259
- extractComments: ExtractCommentsOptions;
260
- parallel: number | boolean;
261
- include: Rules | undefined;
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 { terserMinify };
287
- export { uglifyJsMinify };
288
- export { swcMinify };
289
- export { esbuildMinify };
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
- import { Worker } from '../jest-worker';
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
  };