terser-webpack-plugin
Advanced tools
Comparing version 2.3.3 to 2.3.4
@@ -5,2 +5,10 @@ # Changelog | ||
### [2.3.4](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v2.3.3...v2.3.4) (2020-01-30) | ||
### Bug Fixes | ||
* respect stdout and stderr of workers and do not create warnings ([#215](https://github.com/webpack-contrib/terser-webpack-plugin/issues/215)) ([5708574](https://github.com/webpack-contrib/terser-webpack-plugin/commit/5708574d3337158a02d60a81275467900da5f42d)) | ||
* use webpack hash options rather than hard-code MD4 ([#213](https://github.com/webpack-contrib/terser-webpack-plugin/issues/213)) ([330c1f6](https://github.com/webpack-contrib/terser-webpack-plugin/commit/330c1f6cf3468fd6312e86960b272df1591f1a64)) | ||
### [2.3.3](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v2.3.2...v2.3.3) (2020-01-28) | ||
@@ -7,0 +15,0 @@ |
@@ -8,4 +8,2 @@ "use strict"; | ||
var _crypto = _interopRequireDefault(require("crypto")); | ||
var _path = _interopRequireDefault(require("path")); | ||
@@ -305,2 +303,20 @@ | ||
if (TerserPlugin.isWebpack4()) { | ||
const { | ||
outputOptions: { | ||
hashSalt, | ||
hashDigest, | ||
hashDigestLength, | ||
hashFunction | ||
} | ||
} = compilation; | ||
const hash = _webpack.util.createHash(hashFunction); | ||
if (hashSalt) { | ||
hash.update(hashSalt); | ||
} | ||
hash.update(input); | ||
const digest = hash.digest(hashDigest); | ||
if (this.options.cache) { | ||
@@ -314,3 +330,3 @@ const defaultCacheKeys = { | ||
filename: file, | ||
contentHash: _crypto.default.createHash('md4').update(input).digest('hex') | ||
contentHash: digest.substr(0, hashDigestLength) | ||
}; | ||
@@ -369,3 +385,3 @@ task.cacheKeys = this.options.cacheKeys(defaultCacheKeys, file); | ||
files, | ||
cache: new CacheEngine(compilation, this.options), | ||
cache: new CacheEngine(compiler, compilation, this.options), | ||
parallel: this.options.parallel | ||
@@ -372,0 +388,0 @@ }); |
@@ -62,9 +62,18 @@ "use strict"; | ||
numWorkers | ||
}); // Show syntax error from jest-worker | ||
// https://github.com/facebook/jest/issues/8872#issuecomment-524822081 | ||
}); // https://github.com/facebook/jest/issues/8872#issuecomment-524822081 | ||
const workerStdout = this.worker.getStdout(); | ||
if (workerStdout) { | ||
workerStdout.on('data', chunk => { | ||
return process.stdout.write(chunk); | ||
}); | ||
} | ||
const workerStderr = this.worker.getStderr(); | ||
if (workerStderr) { | ||
workerStderr.pipe(process.stderr); | ||
workerStderr.on('data', chunk => { | ||
return process.stderr.write(chunk); | ||
}); | ||
} | ||
@@ -71,0 +80,0 @@ } |
@@ -19,3 +19,3 @@ "use strict"; | ||
class Webpack4Cache { | ||
constructor(compilation, options) { | ||
constructor(compiler, compilation, options) { | ||
this.options = options; | ||
@@ -22,0 +22,0 @@ this.cacheDir = options.cache === true ? Webpack4Cache.getCacheDirectory() : options.cache; |
@@ -8,4 +8,2 @@ "use strict"; | ||
var _crypto = _interopRequireDefault(require("crypto")); | ||
var _getLazyHashedEtag = _interopRequireDefault(require("webpack/lib/cache/getLazyHashedEtag")); | ||
@@ -15,2 +13,4 @@ | ||
var _webpack = require("webpack"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -20,5 +20,6 @@ | ||
class Cache { | ||
constructor(compilation, options) { | ||
constructor(compiler, compilation, options) { | ||
this.compiler = compiler; | ||
this.compilation = compilation; | ||
this.options = options; | ||
this.compilation = compilation; | ||
} | ||
@@ -31,4 +32,20 @@ | ||
createCacheIdent(task) { | ||
const cacheKeys = _crypto.default.createHash('md4').update((0, _serializeJavascript.default)(task.cacheKeys)).digest('hex'); | ||
const { | ||
outputOptions: { | ||
hashSalt, | ||
hashDigest, | ||
hashDigestLength, | ||
hashFunction | ||
} | ||
} = this.compilation; | ||
const hash = _webpack.util.createHash(hashFunction); | ||
if (hashSalt) { | ||
hash.update(hashSalt); | ||
} | ||
hash.update((0, _serializeJavascript.default)(task.cacheKeys)); | ||
const digest = hash.digest(hashDigest); | ||
const cacheKeys = digest.substr(0, hashDigestLength); | ||
return `${this.compilation.compilerPath}/TerserWebpackPlugin/${cacheKeys}/${task.file}`; | ||
@@ -35,0 +52,0 @@ } |
{ | ||
"name": "terser-webpack-plugin", | ||
"version": "2.3.3", | ||
"version": "2.3.4", | ||
"description": "Terser plugin for webpack", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
65402
889
1