mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
revert(9078): add terser webpack plugin types back (#9099)
This commit is contained in:
parent
18d1cd086a
commit
9212d34edf
3
packages/types/config/build.d.ts
vendored
3
packages/types/config/build.d.ts
vendored
@ -12,6 +12,7 @@ import { Options as SassOptions } from 'sass-loader'
|
|||||||
import { Options as OptimizeCssAssetsWebpackPluginOptions } from 'optimize-css-assets-webpack-plugin'
|
import { Options as OptimizeCssAssetsWebpackPluginOptions } from 'optimize-css-assets-webpack-plugin'
|
||||||
import { Plugin as PostcssPlugin } from 'postcss'
|
import { Plugin as PostcssPlugin } from 'postcss'
|
||||||
import { Options as PugOptions } from 'pug'
|
import { Options as PugOptions } from 'pug'
|
||||||
|
import { TerserPluginOptions } from 'terser-webpack-plugin'
|
||||||
import { VueLoaderOptions } from 'vue-loader'
|
import { VueLoaderOptions } from 'vue-loader'
|
||||||
import {
|
import {
|
||||||
Configuration as WebpackConfiguration,
|
Configuration as WebpackConfiguration,
|
||||||
@ -24,8 +25,6 @@ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
|
|||||||
import { Options as WebpackDevMiddlewareOptions } from 'webpack-dev-middleware'
|
import { Options as WebpackDevMiddlewareOptions } from 'webpack-dev-middleware'
|
||||||
import { MiddlewareOptions as WebpackHotMiddlewareOptions, ClientOptions as WebpackHotMiddlewareClientOptions } from 'webpack-hot-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 CssLoaderUrlFunction = (url: string, resourcePath: string) => boolean
|
||||||
type CssLoaderImportFunction = (url: string, media: string, resourcePath: string) => boolean
|
type CssLoaderImportFunction = (url: string, media: string, resourcePath: string) => boolean
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
"@types/pug": "^2.0.4",
|
"@types/pug": "^2.0.4",
|
||||||
"@types/sass-loader": "8.0.1",
|
"@types/sass-loader": "8.0.1",
|
||||||
"@types/serve-static": "^1.13.9",
|
"@types/serve-static": "^1.13.9",
|
||||||
|
"@types/terser-webpack-plugin": "^4.2.1",
|
||||||
"@types/webpack": "^4.41.27",
|
"@types/webpack": "^4.41.27",
|
||||||
"@types/webpack-bundle-analyzer": "^3.9.2",
|
"@types/webpack-bundle-analyzer": "^3.9.2",
|
||||||
"@types/webpack-dev-middleware": "^4.1.2",
|
"@types/webpack-dev-middleware": "^4.1.2",
|
||||||
|
115
packages/types/terser-webpack-plugins/index.d.ts
vendored
115
packages/types/terser-webpack-plugins/index.d.ts
vendored
@ -1,115 +0,0 @@
|
|||||||
// 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;
|
|
36
yarn.lock
36
yarn.lock
@ -2524,11 +2524,26 @@
|
|||||||
resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.0.tgz#7036640b4e21cc2f259ae826ce843d277dad8cff"
|
resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.0.tgz#7036640b4e21cc2f259ae826ce843d277dad8cff"
|
||||||
integrity sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw==
|
integrity sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw==
|
||||||
|
|
||||||
|
"@types/tapable@*":
|
||||||
|
version "2.2.2"
|
||||||
|
resolved "https://registry.npmjs.org/@types/tapable/-/tapable-2.2.2.tgz#1d324b524190954a5700d86b6328bfc57e1fda48"
|
||||||
|
integrity sha512-ujqOVJEeLcwpDVJPnp/k3u1UXmTKq5urJq9fO8aUKg8Vlel5RNOFbVKEfqfh6wGfF/M+HiTJlBJMLC1aDfyf0Q==
|
||||||
|
dependencies:
|
||||||
|
tapable "^2.2.0"
|
||||||
|
|
||||||
"@types/tapable@^1", "@types/tapable@^1.0.5":
|
"@types/tapable@^1", "@types/tapable@^1.0.5":
|
||||||
version "1.0.7"
|
version "1.0.7"
|
||||||
resolved "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.7.tgz#545158342f949e8fd3bfd813224971ecddc3fac4"
|
resolved "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.7.tgz#545158342f949e8fd3bfd813224971ecddc3fac4"
|
||||||
integrity sha512-0VBprVqfgFD7Ehb2vd8Lh9TG3jP98gvr8rgehQqzztZNI7o8zS8Ad4jyZneKELphpuE212D8J70LnSNQSyO6bQ==
|
integrity sha512-0VBprVqfgFD7Ehb2vd8Lh9TG3jP98gvr8rgehQqzztZNI7o8zS8Ad4jyZneKELphpuE212D8J70LnSNQSyO6bQ==
|
||||||
|
|
||||||
|
"@types/terser-webpack-plugin@^4.2.1":
|
||||||
|
version "4.2.1"
|
||||||
|
resolved "https://registry.npmjs.org/@types/terser-webpack-plugin/-/terser-webpack-plugin-4.2.1.tgz#cbeccec2b011ad12a9ddcd60b4089c9e138a313a"
|
||||||
|
integrity sha512-x688KsgQKJF8PPfv4qSvHQztdZNHLlWJdolN9/ptAGimHVy3rY+vHdfglQDFh1Z39h7eMWOd6fQ7ke3PKQcdyA==
|
||||||
|
dependencies:
|
||||||
|
"@types/webpack" "^4"
|
||||||
|
terser "^4.6.13"
|
||||||
|
|
||||||
"@types/uglify-js@*":
|
"@types/uglify-js@*":
|
||||||
version "3.13.0"
|
version "3.13.0"
|
||||||
resolved "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.13.0.tgz#1cad8df1fb0b143c5aba08de5712ea9d1ff71124"
|
resolved "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.13.0.tgz#1cad8df1fb0b143c5aba08de5712ea9d1ff71124"
|
||||||
@ -2568,7 +2583,7 @@
|
|||||||
"@types/source-list-map" "*"
|
"@types/source-list-map" "*"
|
||||||
source-map "^0.7.3"
|
source-map "^0.7.3"
|
||||||
|
|
||||||
"@types/webpack@^4", "@types/webpack@^4.41.27", "@types/webpack@^4.41.8":
|
"@types/webpack@^4", "@types/webpack@^4.41.27":
|
||||||
version "4.41.27"
|
version "4.41.27"
|
||||||
resolved "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.27.tgz#f47da488c8037e7f1b2dbf2714fbbacb61ec0ffc"
|
resolved "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.27.tgz#f47da488c8037e7f1b2dbf2714fbbacb61ec0ffc"
|
||||||
integrity sha512-wK/oi5gcHi72VMTbOaQ70VcDxSQ1uX8S2tukBK9ARuGXrYM/+u4ou73roc7trXDNmCxCoerE8zruQqX/wuHszA==
|
integrity sha512-wK/oi5gcHi72VMTbOaQ70VcDxSQ1uX8S2tukBK9ARuGXrYM/+u4ou73roc7trXDNmCxCoerE8zruQqX/wuHszA==
|
||||||
@ -2580,6 +2595,18 @@
|
|||||||
"@types/webpack-sources" "*"
|
"@types/webpack-sources" "*"
|
||||||
source-map "^0.6.0"
|
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@*":
|
"@types/yargs-parser@*":
|
||||||
version "20.2.0"
|
version "20.2.0"
|
||||||
resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.0.tgz#dd3e6699ba3237f0348cd085e4698780204842f9"
|
resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.0.tgz#dd3e6699ba3237f0348cd085e4698780204842f9"
|
||||||
@ -12416,6 +12443,11 @@ tapable@^1.0.0, tapable@^1.0.0-beta.5, tapable@^1.1.3:
|
|||||||
resolved "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
|
resolved "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
|
||||||
integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==
|
integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==
|
||||||
|
|
||||||
|
tapable@^2.2.0:
|
||||||
|
version "2.2.0"
|
||||||
|
resolved "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz#5c373d281d9c672848213d0e037d1c4165ab426b"
|
||||||
|
integrity sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==
|
||||||
|
|
||||||
tar-fs@^2.0.0:
|
tar-fs@^2.0.0:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784"
|
resolved "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784"
|
||||||
@ -12516,7 +12548,7 @@ terser-webpack-plugin@^4.2.3:
|
|||||||
terser "^5.3.4"
|
terser "^5.3.4"
|
||||||
webpack-sources "^1.4.3"
|
webpack-sources "^1.4.3"
|
||||||
|
|
||||||
terser@^4.1.2, terser@^4.6.3:
|
terser@^4.1.2, terser@^4.6.13, terser@^4.6.3:
|
||||||
version "4.8.0"
|
version "4.8.0"
|
||||||
resolved "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17"
|
resolved "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17"
|
||||||
integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==
|
integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==
|
||||||
|
Loading…
Reference in New Issue
Block a user