mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
types: inline @types/terser-webpack-plugin
(#9078)
This commit is contained in:
parent
558227f628
commit
1be68ca129
3
packages/types/config/build.d.ts
vendored
3
packages/types/config/build.d.ts
vendored
@ -12,7 +12,6 @@ import { Options as SassOptions } from 'sass'
|
||||
import { Options as OptimizeCssAssetsWebpackPluginOptions } from 'optimize-css-assets-webpack-plugin'
|
||||
import { Plugin as PostcssPlugin } from 'postcss'
|
||||
import { Options as PugOptions } from 'pug'
|
||||
import { TerserPluginOptions } from 'terser-webpack-plugin'
|
||||
import { VueLoaderOptions } from 'vue-loader'
|
||||
import {
|
||||
Configuration as WebpackConfiguration,
|
||||
@ -25,6 +24,8 @@ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
|
||||
import { Options as WebpackDevMiddlewareOptions } from 'webpack-dev-middleware'
|
||||
import { MiddlewareOptions as WebpackHotMiddlewareOptions, ClientOptions as WebpackHotMiddlewareClientOptions } from 'webpack-hot-middleware'
|
||||
|
||||
import { TerserPluginOptions } from '../terser-webpack-plugins'
|
||||
|
||||
type CssLoaderUrlFunction = (url: string, resourcePath: string) => boolean
|
||||
type CssLoaderImportFunction = (url: string, media: string, resourcePath: string) => boolean
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
"@types/pug": "^2.0.4",
|
||||
"@types/sass": "^1.16.0",
|
||||
"@types/serve-static": "^1.13.9",
|
||||
"@types/terser-webpack-plugin": "^4.2.0",
|
||||
"@types/webpack": "^4.41.27",
|
||||
"@types/webpack-bundle-analyzer": "^3.9.2",
|
||||
"@types/webpack-dev-middleware": "^4.1.2",
|
||||
|
115
packages/types/terser-webpack-plugins/index.d.ts
vendored
Normal file
115
packages/types/terser-webpack-plugins/index.d.ts
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
// Type definitions for terser-webpack-plugin 4.2
|
||||
// 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
|
||||
|
||||
/* eslint-disable */
|
||||
import { Plugin } from 'webpack';
|
||||
import { MinifyOptions } from 'terser';
|
||||
|
||||
/**
|
||||
* This plugin uses terser to minify your JavaScript.
|
||||
*/
|
||||
declare namespace TerserPlugin {
|
||||
interface MinifyResult {
|
||||
map: any;
|
||||
code: any;
|
||||
extractedComments: any;
|
||||
}
|
||||
|
||||
interface FileData {
|
||||
readonly filename: string;
|
||||
readonly basename: string;
|
||||
readonly query: string;
|
||||
readonly hash: string;
|
||||
}
|
||||
|
||||
interface ExtractCommentOptions {
|
||||
condition: string | RegExp | ExtractCommentFn;
|
||||
filename?: string | FilenameFn;
|
||||
banner?: boolean | string | FormatFn;
|
||||
}
|
||||
|
||||
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>;
|
||||
|
||||
/**
|
||||
* ⚠ 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, minimizerOptions?: MinifyOptions) => MinifyResult;
|
||||
|
||||
/**
|
||||
* Terser minify {@link https://github.com/terser/terser#minify-options|options}.
|
||||
*/
|
||||
terserOptions?: MinifyOptions;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
declare class TerserPlugin extends Plugin {
|
||||
constructor(opts?: TerserPlugin.TerserPluginOptions);
|
||||
}
|
||||
|
||||
export = TerserPlugin;
|
34
yarn.lock
34
yarn.lock
@ -2648,14 +2648,6 @@
|
||||
resolved "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.7.tgz#545158342f949e8fd3bfd813224971ecddc3fac4"
|
||||
integrity sha512-0VBprVqfgFD7Ehb2vd8Lh9TG3jP98gvr8rgehQqzztZNI7o8zS8Ad4jyZneKELphpuE212D8J70LnSNQSyO6bQ==
|
||||
|
||||
"@types/terser-webpack-plugin@^4.2.0":
|
||||
version "4.2.0"
|
||||
resolved "https://registry.npmjs.org/@types/terser-webpack-plugin/-/terser-webpack-plugin-4.2.0.tgz#fe39917d334287c5cf25abcf370867a31ed59cd6"
|
||||
integrity sha512-oGfGZzjwKY7s8gAYLZJuVuu9GXuc/ACo7bL/DQg7ROFkEMFQULB1W7qZjQrTXf2SkTfQx7/zcerfuLkUCVFGhg==
|
||||
dependencies:
|
||||
"@types/webpack" "*"
|
||||
terser "^4.6.13"
|
||||
|
||||
"@types/uglify-js@*":
|
||||
version "3.13.0"
|
||||
resolved "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.13.0.tgz#1cad8df1fb0b143c5aba08de5712ea9d1ff71124"
|
||||
@ -2695,18 +2687,6 @@
|
||||
"@types/source-list-map" "*"
|
||||
source-map "^0.7.3"
|
||||
|
||||
"@types/webpack@*", "@types/webpack@^4.41.8":
|
||||
version "4.41.26"
|
||||
resolved "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.26.tgz#27a30d7d531e16489f9c7607c747be6bc1a459ef"
|
||||
integrity sha512-7ZyTfxjCRwexh+EJFwRUM+CDB2XvgHl4vfuqf1ZKrgGvcS5BrNvPQqJh3tsZ0P6h6Aa1qClVHaJZszLPzpqHeA==
|
||||
dependencies:
|
||||
"@types/anymatch" "*"
|
||||
"@types/node" "*"
|
||||
"@types/tapable" "*"
|
||||
"@types/uglify-js" "*"
|
||||
"@types/webpack-sources" "*"
|
||||
source-map "^0.6.0"
|
||||
|
||||
"@types/webpack@^4", "@types/webpack@^4.41.27":
|
||||
version "4.41.27"
|
||||
resolved "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.27.tgz#f47da488c8037e7f1b2dbf2714fbbacb61ec0ffc"
|
||||
@ -2719,6 +2699,18 @@
|
||||
"@types/webpack-sources" "*"
|
||||
source-map "^0.6.0"
|
||||
|
||||
"@types/webpack@^4.41.8":
|
||||
version "4.41.26"
|
||||
resolved "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.26.tgz#27a30d7d531e16489f9c7607c747be6bc1a459ef"
|
||||
integrity sha512-7ZyTfxjCRwexh+EJFwRUM+CDB2XvgHl4vfuqf1ZKrgGvcS5BrNvPQqJh3tsZ0P6h6Aa1qClVHaJZszLPzpqHeA==
|
||||
dependencies:
|
||||
"@types/anymatch" "*"
|
||||
"@types/node" "*"
|
||||
"@types/tapable" "*"
|
||||
"@types/uglify-js" "*"
|
||||
"@types/webpack-sources" "*"
|
||||
source-map "^0.6.0"
|
||||
|
||||
"@types/yargs-parser@*":
|
||||
version "20.2.0"
|
||||
resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.0.tgz#dd3e6699ba3237f0348cd085e4698780204842f9"
|
||||
@ -12757,7 +12749,7 @@ terser-webpack-plugin@^4.2.3:
|
||||
terser "^5.3.4"
|
||||
webpack-sources "^1.4.3"
|
||||
|
||||
terser@^4.1.2, terser@^4.6.13, terser@^4.6.3:
|
||||
terser@^4.1.2, terser@^4.6.3:
|
||||
version "4.8.0"
|
||||
resolved "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17"
|
||||
integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==
|
||||
|
Loading…
Reference in New Issue
Block a user