@types/terser-webpack-plugin
Advanced tools
Comparing version 2.2.0 to 3.0.0
@@ -1,4 +0,5 @@ | ||
// Type definitions for terser-webpack-plugin 2.2 | ||
// Type definitions for terser-webpack-plugin 3.0 | ||
// Project: https://github.com/webpack-contrib/terser-webpack-plugin | ||
// Definitions by: Daniel Schopf <https://github.com/Danscho> | ||
// Piotr Błażejewicz <https://github.com/peterblazejewicz> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -9,10 +10,6 @@ // TypeScript Version: 3.0 | ||
import { MinifyOptions } from 'terser'; | ||
import webpack = require('webpack'); | ||
export = TerserPlugin; | ||
declare class TerserPlugin extends Plugin { | ||
constructor(opts?: TerserPlugin.TerserPluginOptions); | ||
} | ||
/** | ||
* This plugin uses terser to minify your JavaScript. | ||
*/ | ||
declare namespace TerserPlugin { | ||
@@ -27,30 +24,103 @@ interface MinifyResult { | ||
interface FileData { | ||
readonly filename: string; | ||
readonly basename: string; | ||
readonly query: string; | ||
readonly hash: string; | ||
} | ||
interface ExtractCommentOptions { | ||
condition: boolean | string | RegExp | ExtractCommentFn | object; | ||
filename?: string | FormatFn; | ||
condition: string | RegExp | ExtractCommentFn; | ||
filename?: string | FilenameFn; | ||
banner?: boolean | string | FormatFn; | ||
} | ||
type ExtractCommentFn = (node: any, comment: any) => (boolean | object); | ||
type ExtractCommentFn = (astNode: any, comment: any) => boolean | object; | ||
type FormatFn = (input: string) => string; | ||
type FilenameFn = (fileData: FileData) => string; | ||
interface TerserPluginOptions { | ||
/** | ||
* Test to match files against. | ||
* @default /\.m?js(\?.*)?$/i | ||
*/ | ||
test?: string | RegExp | Array<string | RegExp>; | ||
/** | ||
* Files to include. | ||
* @default undefined | ||
*/ | ||
include?: string | RegExp | Array<string | RegExp>; | ||
/** | ||
* Files to exclude. | ||
* @default undefined | ||
*/ | ||
exclude?: string | RegExp | Array<string | RegExp>; | ||
chunkFilter?: (chunk: webpack.compilation.Chunk) => boolean; | ||
/** | ||
* ⚠ Ignored in webpack 5! Please use {@link webpack.js.org/configuration/other-options/#cache.} | ||
* Enable/disable file caching. | ||
* Default path to cache directory: `node_modules/.cache/terser-webpack-plugin`. | ||
* @default true | ||
*/ | ||
cache?: boolean | string; | ||
/** | ||
* ⚠ Ignored in webpack 5! Please use {@link webpack.js.org/configuration/other-options/#cache}. | ||
* Allows you to override default cache keys. | ||
*/ | ||
cacheKeys?: (defaultCacheKeys: any, file: any) => object; | ||
/** | ||
* Enable/disable multi-process parallel running. | ||
* Use multi-process parallel running to improve the build speed. Default number of concurrent runs: os.cpus().length - 1. | ||
* @default true | ||
*/ | ||
parallel?: boolean | number; | ||
/** | ||
* Use source maps to map error message locations to modules (this slows down the compilation). | ||
* If you use your own minify function please read the minify section for handling source maps correctly. | ||
* @default false | ||
*/ | ||
sourceMap?: boolean; | ||
/** | ||
* Allows you to override default minify function. | ||
* By default plugin uses terser package. Useful for using and testing unpublished versions or forks | ||
* @default undefined | ||
*/ | ||
minify?: (file: any, sourceMap: any) => MinifyResult; | ||
/** | ||
* Terser minify {@link https://github.com/terser/terser#minify-options|options}. | ||
*/ | ||
terserOptions?: MinifyOptions; | ||
extractComments?: boolean | ||
| string | ||
| RegExp | ||
| ExtractCommentFn | ||
| ExtractCommentOptions; | ||
warningsFilter?: (warning: string, source: string | undefined, file: string) => boolean; | ||
/** | ||
* Whether comments shall be extracted to a separate file, (see details). | ||
* By default extract only comments using /^\**!|@preserve|@license|@cc_on/i regexp condition and remove remaining comments. | ||
* If the original file is named foo.js, then the comments will be stored to foo.js.LICENSE.txt. | ||
* The terserOptions.output.comments option specifies whether the comment will be preserved, | ||
* i.e. it is possible to preserve some comments (e.g. annotations) while extracting others or even preserving comments that have been extracted | ||
* @default true | ||
*/ | ||
extractComments?: boolean | string | RegExp | ExtractCommentFn | ExtractCommentOptions; | ||
/** | ||
* Allow to filter terser warnings. | ||
* ⚠️ The source argument will contain undefined if you don't use source maps. | ||
* @default () => true | ||
*/ | ||
warningsFilter?: (warning: string, file: string, source?: string) => boolean | null | undefined; | ||
} | ||
} | ||
declare class TerserPlugin extends Plugin { | ||
constructor(opts?: TerserPlugin.TerserPluginOptions); | ||
} | ||
export = TerserPlugin; |
{ | ||
"name": "@types/terser-webpack-plugin", | ||
"version": "2.2.0", | ||
"version": "3.0.0", | ||
"description": "TypeScript definitions for terser-webpack-plugin", | ||
@@ -11,6 +11,11 @@ "license": "MIT", | ||
"githubUsername": "Danscho" | ||
}, | ||
{ | ||
"name": "Piotr Błażejewicz", | ||
"url": "https://github.com/peterblazejewicz", | ||
"githubUsername": "peterblazejewicz" | ||
} | ||
], | ||
"main": "", | ||
"types": "index", | ||
"types": "index.d.ts", | ||
"repository": { | ||
@@ -24,6 +29,6 @@ "type": "git", | ||
"@types/webpack": "*", | ||
"terser": "^4.3.9" | ||
"terser": "^4.6.13" | ||
}, | ||
"typesPublisherContentHash": "f5d56bced77874b81bf368834803c92828e9b498491be03c0da6e8f6c2713f7f", | ||
"typesPublisherContentHash": "92f4b77a9e9e07182f926a35a738e3713a71d7c4f0606a6d5d6b90f43788dfb7", | ||
"typeScriptVersion": "3.0" | ||
} |
@@ -8,10 +8,10 @@ # Installation | ||
# Details | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/terser-webpack-plugin | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/terser-webpack-plugin. | ||
Additional Details | ||
* Last updated: Tue, 05 Nov 2019 01:05:41 GMT | ||
* Dependencies: @types/webpack, @types/terser | ||
### Additional Details | ||
* Last updated: Sat, 30 May 2020 00:47:01 GMT | ||
* Dependencies: [@types/webpack](https://npmjs.com/package/@types/webpack), [@types/terser](https://npmjs.com/package/@types/terser) | ||
* Global values: none | ||
# Credits | ||
These definitions were written by Daniel Schopf <https://github.com/Danscho>. | ||
These definitions were written by [Daniel Schopf](https://github.com/Danscho), and [Piotr Błażejewicz](https://github.com/peterblazejewicz). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7261
104
Updatedterser@^4.6.13