webpack-chunk-hash
Advanced tools
Comparing version 0.5.0 to 0.6.0
35
index.js
@@ -18,7 +18,36 @@ var crypto = require('crypto'); | ||
compiler.plugin('compilation', function(compilation) | ||
var compilerPlugin; | ||
var compilationPlugin; | ||
if (compiler.hooks) { | ||
compilerPlugin = function (fn) | ||
{ | ||
compiler.hooks.compilation.tap('WebpackChunkHash', fn); | ||
}; | ||
compilationPlugin = function (compilation, fn) | ||
{ | ||
compilation.hooks.chunkHash.tap('WebpackChunkHash', fn); | ||
} | ||
} else { | ||
compilerPlugin = function (fn) | ||
{ | ||
compiler.plugin('compilation', fn); | ||
}; | ||
compilationPlugin = function (compilation, fn) | ||
{ | ||
compilation.plugin('chunk-hash', fn); | ||
} | ||
} | ||
compilerPlugin(function(compilation) | ||
{ | ||
compilation.plugin('chunk-hash', function(chunk, chunkHash) | ||
compilationPlugin(compilation, function(chunk, chunkHash) | ||
{ | ||
var modules = chunk.mapModules ? chunk.mapModules(getModuleSource) : chunk.modules.map(getModuleSource) | ||
var modules; | ||
if (chunk.modulesIterable) { | ||
modules = Array.from(chunk.modulesIterable, getModuleSource); | ||
} else if (chunk.mapModules) { | ||
modules = chunk.mapModules(getModuleSource); | ||
} else { | ||
modules = chunk.modules.map(getModuleSource); | ||
} | ||
var source = modules.sort(sortById).reduce(concatenateSource, '') | ||
@@ -25,0 +54,0 @@ , hash = crypto.createHash(_plugin.algorithm).update(source + _plugin.additionalHashContent(chunk)) |
{ | ||
"name": "webpack-chunk-hash", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Plugin to replace a standard webpack chunk hashing with custom (md5) one.", | ||
@@ -28,3 +28,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@types/webpack": "^3.0.5" | ||
"@types/webpack": "^3.0.0 || ^4.0.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6068
98
1
+ Added@types/source-list-map@0.1.6(transitive)
+ Added@types/tapable@1.0.12(transitive)
+ Added@types/webpack@4.41.38(transitive)
+ Added@types/webpack-sources@3.2.3(transitive)
+ Addedanymatch@3.1.3(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedsource-map@0.7.4(transitive)
- Removed@types/tapable@0.2.9(transitive)
- Removed@types/webpack@3.8.27(transitive)