Socket
Socket
Sign inDemoInstall

terser-webpack-plugin

Package Overview
Dependencies
125
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.0.1

8

CHANGELOG.md

@@ -5,2 +5,10 @@ # Changelog

### [3.0.1](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v3.0.0...v3.0.1) (2020-05-06)
### Bug Fixes
* parallelism in multi compilation mode ([0ee7ed2](https://github.com/webpack-contrib/terser-webpack-plugin/commit/0ee7ed270b8cbf6312cc1009c5aa5f909fc7fbb7))
* remove redundant code for the `chunkFilter` option ([#243](https://github.com/webpack-contrib/terser-webpack-plugin/issues/243)) ([7220734](https://github.com/webpack-contrib/terser-webpack-plugin/commit/722073494ae708e7cd94cdb9df26fb483e93e8de))
## [3.0.0](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v2.3.6...v3.0.0) (2020-05-01)

@@ -7,0 +15,0 @@

52

dist/index.js

@@ -48,3 +48,2 @@ "use strict";

test = /\.m?js(\?.*)?$/i,
chunkFilter = () => true,
warningsFilter = () => true,

@@ -61,3 +60,2 @@ extractComments = true,

test,
chunkFilter,
warningsFilter,

@@ -361,23 +359,16 @@ extractComments,

async runTask(task) {
if (this.worker) {
return this.worker.transform((0, _serializeJavascript.default)(task));
}
return (0, _minify.minify)(task);
}
async runTasks() {
async runTasks(assetNames) {
const availableNumberOfCores = TerserPlugin.getAvailableNumberOfCores(this.options.parallel);
let concurrency = Infinity;
let worker;
if (availableNumberOfCores > 0) {
// Do not create unnecessary workers when the number of files is less than the available cores, it saves memory
const numWorkers = Math.min(this.assetNames.length, availableNumberOfCores);
const numWorkers = Math.min(assetNames.length, availableNumberOfCores);
concurrency = numWorkers;
this.worker = new _jestWorker.default(require.resolve('./minify'), {
worker = new _jestWorker.default(require.resolve('./minify'), {
numWorkers
}); // https://github.com/facebook/jest/issues/8872#issuecomment-524822081
const workerStdout = this.worker.getStdout();
const workerStdout = worker.getStdout();

@@ -390,3 +381,3 @@ if (workerStdout) {

const workerStderr = this.worker.getStderr();
const workerStderr = worker.getStderr();

@@ -403,3 +394,3 @@ if (workerStderr) {

for (const assetName of this.assetNames) {
for (const assetName of assetNames) {
const enqueue = async task => {

@@ -409,3 +400,7 @@ let taskResult;

try {
taskResult = await this.runTask(task);
if (worker) {
taskResult = await worker.transform((0, _serializeJavascript.default)(task));
} else {
taskResult = (0, _minify.minify)(task);
}
} catch (error) {

@@ -441,11 +436,9 @@ taskResult = {

return Promise.all(scheduledTasks);
}
return Promise.all(scheduledTasks).then(() => {
if (worker) {
return worker.end();
}
async exitTasks() {
if (!this.worker) {
return Promise.resolve();
}
return this.worker.end();
});
}

@@ -474,9 +467,11 @@

let assetNames;
if (TerserPlugin.isWebpack4()) {
this.assetNames = [].concat(Array.from(compilation.additionalChunkAssets || [])).concat(Array.from(chunksOrAssets).reduce((acc, chunk) => acc.concat(Array.from(chunk.files || [])), [])).filter(file => matchObject(file));
assetNames = [].concat(Array.from(compilation.additionalChunkAssets || [])).concat(Array.from(chunksOrAssets).reduce((acc, chunk) => acc.concat(Array.from(chunk.files || [])), [])).filter(file => matchObject(file));
} else {
this.assetNames = [].concat(Object.keys(chunksOrAssets)).filter(file => matchObject(file));
assetNames = [].concat(Object.keys(chunksOrAssets)).filter(file => matchObject(file));
}
if (this.assetNames.length === 0) {
if (assetNames.length === 0) {
return Promise.resolve();

@@ -493,4 +488,3 @@ }

this.getTaskForAsset = this.taskGenerator.bind(this, compiler, compilation, allExtractedComments);
await this.runTasks();
await this.exitTasks();
await this.runTasks(assetNames);
Object.keys(allExtractedComments).forEach(commentsFilename => {

@@ -497,0 +491,0 @@ const extractedComments = new Set([...allExtractedComments[commentsFilename].sort()]); // eslint-disable-next-line no-param-reassign

{
"name": "terser-webpack-plugin",
"version": "3.0.0",
"version": "3.0.1",
"description": "Terser plugin for webpack",

@@ -46,3 +46,3 @@ "license": "MIT",

"find-cache-dir": "^3.3.1",
"jest-worker": "^25.5.0",
"jest-worker": "^26.0.0",
"p-limit": "^2.3.0",

@@ -63,3 +63,3 @@ "schema-utils": "^2.6.6",

"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^25.5.1",
"babel-jest": "^26.0.1",
"cross-env": "^7.0.2",

@@ -72,3 +72,3 @@ "del": "^5.1.0",

"husky": "^4.2.5",
"jest": "^25.5.3",
"jest": "^26.0.1",
"lint-staged": "^10.2.2",

@@ -79,4 +79,4 @@ "memfs": "^3.1.2",

"standard-version": "^7.1.0",
"uglify-js": "^3.9.1",
"webpack": "^4.43.0"
"uglify-js": "^3.9.2",
"webpack": "next"
},

@@ -83,0 +83,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc