@@ -82,7 +82,7 @@ Using supported `devtool` values enable source map generation.
8282Type:
8383
8484``` ts
85- type test = string | RegExp | Array < string | RegExp > ;
85+ type test = string | RegExp | ( string | RegExp )[] ;
8686```
8787
8888Default: ` /\.m?js(\?.*)?$/i `
@@ -109,7 +109,7 @@ module.exports = {
109109Type:
110110
111111``` ts
112- type include = string | RegExp | Array < string | RegExp > ;
112+ type include = string | RegExp | ( string | RegExp )[] ;
113113```
114114
115115Default: ` undefined `
@@ -136,7 +136,7 @@ module.exports = {
136136Type:
137137
138138``` ts
139- type exclude = string | RegExp | Array < string | RegExp > ;
139+ type exclude = string | RegExp | ( string | RegExp )[] ;
140140```
141141
142142Default: ` undefined `
@@ -224,9 +224,7 @@ Type:
224224
225225``` ts
226226type minify = (
227- input : {
228- [file : string ]: string ;
229- },
227+ input : Record <string , string >,
230228 sourceMap : import (" @jridgewell/trace-mapping" ).SourceMapInput | undefined ,
231229 minifyOptions : {
232230 module? : boolean | undefined ;
@@ -245,7 +243,7 @@ type minify = (
245243 pos: number ;
246244 line: number ;
247245 col: number ;
248- }
246+ },
249247 ) => boolean )
250248 | {
251249 condition? :
@@ -261,7 +259,7 @@ type minify = (
261259 pos: number ;
262260 line: number ;
263261 col: number ;
264- }
262+ },
265263 ) => boolean )
266264 | undefined ;
267265 filename? : string | ((fileData : any ) => string ) | undefined ;
@@ -271,7 +269,7 @@ type minify = (
271269 | ((commentsFile : string ) => string )
272270 | undefined ;
273271 }
274- | undefined
272+ | undefined ,
275273) => Promise <{
276274 code: string ;
277275 map? : import (" @jridgewell/trace-mapping" ).SourceMapInput | undefined ;
@@ -316,7 +314,6 @@ minify.getMinimizerVersion = () => {
316314 let packageJson;
317315
318316 try {
319- // eslint-disable-next-line global-require, import/no-extraneous-dependencies
320317 packageJson = require (" uglify-module/package.json" );
321318 } catch (error) {
322319 // Ignore
@@ -345,7 +342,7 @@ module.exports = {
345342Type:
346343
347344``` ts
348- type terserOptions = {
345+ interface terserOptions {
349346 compress? : boolean | CompressOptions ;
350347 ecma? : ECMA ;
351348 enclose? : boolean | string ;
@@ -362,7 +359,7 @@ type terserOptions = {
362359 safari10? : boolean ;
363360 sourceMap? : boolean | SourceMapOptions ;
364361 toplevel? : boolean ;
365- };
362+ }
366363```
367364
368365Default: [ default] ( https://github.com/terser/terser#minify-options )
@@ -416,7 +413,7 @@ type extractComments =
416413 pos: number ;
417414 line: number ;
418415 col: number ;
419- }
416+ },
420417 ) => boolean )
421418 | {
422419 condition? :
@@ -432,7 +429,7 @@ type extractComments =
432429 pos: number ;
433430 line: number ;
434431 col: number ;
435- }
432+ },
436433 ) => boolean )
437434 | undefined ;
438435 filename? : string | ((fileData : any ) => string ) | undefined ;
@@ -550,13 +547,11 @@ module.exports = {
550547 new TerserPlugin ({
551548 extractComments: {
552549 condition: / ^ \* * !| @preserve| @license| @cc_on/ i ,
553- filename : (fileData ) => {
550+ filename : (fileData ) =>
554551 // The "fileData" argument contains object with "filename", "basename", "query" and "hash"
555- return ` ${ fileData .filename } .LICENSE.txt${ fileData .query } ` ;
556- },
557- banner : (licenseFile ) => {
558- return ` License information can be found in ${ licenseFile} ` ;
559- },
552+ ` ${ fileData .filename } .LICENSE.txt${ fileData .query } ` ,
553+ banner : (licenseFile ) =>
554+ ` License information can be found in ${ licenseFile} ` ,
560555 },
561556 }),
562557 ],
@@ -582,7 +577,7 @@ type condition =
582577 pos: number ;
583578 line: number ;
584579 col: number ;
585- }
580+ },
586581 ) => boolean )
587582 | undefined ;
588583```
@@ -599,13 +594,11 @@ module.exports = {
599594 new TerserPlugin ({
600595 extractComments: {
601596 condition: " some" ,
602- filename : (fileData ) => {
597+ filename : (fileData ) =>
603598 // The "fileData" argument contains object with "filename", "basename", "query" and "hash"
604- return ` ${ fileData .filename } .LICENSE.txt${ fileData .query } ` ;
605- },
606- banner : (licenseFile ) => {
607- return ` License information can be found in ${ licenseFile} ` ;
608- },
599+ ` ${ fileData .filename } .LICENSE.txt${ fileData .query } ` ,
600+ banner : (licenseFile ) =>
601+ ` License information can be found in ${ licenseFile} ` ,
609602 },
610603 }),
611604 ],
@@ -644,9 +637,8 @@ module.exports = {
644637 extractComments: {
645638 condition: / ^ \* * !| @preserve| @license| @cc_on/ i ,
646639 filename: " extracted-comments.js" ,
647- banner : (licenseFile ) => {
648- return ` License information can be found in ${ licenseFile} ` ;
649- },
640+ banner : (licenseFile ) =>
641+ ` License information can be found in ${ licenseFile} ` ,
650642 },
651643 }),
652644 ],
@@ -680,13 +672,11 @@ module.exports = {
680672 new TerserPlugin ({
681673 extractComments: {
682674 condition: true ,
683- filename : (fileData ) => {
675+ filename : (fileData ) =>
684676 // The "fileData" argument contains object with "filename", "basename", "query" and "hash"
685- return ` ${ fileData .filename } .LICENSE.txt${ fileData .query } ` ;
686- },
687- banner : (commentsFile ) => {
688- return ` My custom banner about license information ${ commentsFile} ` ;
689- },
677+ ` ${ fileData .filename } .LICENSE.txt${ fileData .query } ` ,
678+ banner : (commentsFile ) =>
679+ ` My custom banner about license information ${ commentsFile} ` ,
690680 },
691681 }),
692682 ],
@@ -879,10 +869,10 @@ module.exports = {
879869With built-in minify functions:
880870
881871``` ts
882- import type { JsMinifyOptions as SwcOptions } from " @swc/core" ;
883- import type { MinifyOptions as UglifyJSOptions } from " uglify-js " ;
884- import type { TransformOptions as EsbuildOptions } from " esbuild " ;
885- import type { MinifyOptions as TerserOptions } from " terser " ;
872+ import { type JsMinifyOptions as SwcOptions } from " @swc/core" ;
873+ import { type TransformOptions as EsbuildOptions } from " esbuild " ;
874+ import { type MinifyOptions as TerserOptions } from " terser " ;
875+ import { type MinifyOptions as UglifyJSOptions } from " uglify-js " ;
886876
887877module .exports = {
888878 optimization: {
0 commit comments