loader-utils
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -48,5 +48,7 @@ "use strict"; | ||
let createMd4 = undefined; | ||
let BatchedHash = undefined; | ||
let BulkUpdateDecorator = undefined; | ||
function getHashDigest(buffer, hashType, digestType, maxLength) { | ||
hashType = hashType || "xxhash64"; | ||
function getHashDigest(buffer, algorithm, digestType, maxLength) { | ||
algorithm = algorithm || "xxhash64"; | ||
maxLength = maxLength || 9999; | ||
@@ -56,9 +58,13 @@ | ||
if (hashType === "xxhash64") { | ||
if (algorithm === "xxhash64") { | ||
if (createXXHash64 === undefined) { | ||
createXXHash64 = require("./hash/xxhash64"); | ||
if (BatchedHash === undefined) { | ||
BatchedHash = require("./hash/BatchedHash"); | ||
} | ||
} | ||
hash = createXXHash64(); | ||
} else if (hashType === "md4") { | ||
hash = new BatchedHash(createXXHash64()); | ||
} else if (algorithm === "md4") { | ||
if (createMd4 === undefined) { | ||
@@ -68,15 +74,26 @@ createMd4 = require("./hash/md4"); | ||
hash = createMd4(); | ||
} else if (hashType === "native-md4") { | ||
hash = new BatchedHash(createMd4()); | ||
} else if (algorithm === "native-md4") { | ||
if (typeof crypto === "undefined") { | ||
crypto = require("crypto"); | ||
if (BulkUpdateDecorator === undefined) { | ||
BulkUpdateDecorator = require("./hash/BulkUpdateDecorator"); | ||
} | ||
} | ||
hash = crypto.createHash("md4"); | ||
hash = new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4"); | ||
} else { | ||
if (typeof crypto === "undefined") { | ||
crypto = require("crypto"); | ||
if (BulkUpdateDecorator === undefined) { | ||
BulkUpdateDecorator = require("./hash/BulkUpdateDecorator"); | ||
} | ||
} | ||
hash = crypto.createHash(hashType); | ||
hash = new BulkUpdateDecorator( | ||
() => crypto.createHash(algorithm), | ||
algorithm | ||
); | ||
} | ||
@@ -93,4 +110,3 @@ | ||
digestType === "base58" || | ||
digestType === "base62" || | ||
digestType === "base64" | ||
digestType === "base62" | ||
) { | ||
@@ -97,0 +113,0 @@ return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr( |
{ | ||
"name": "loader-utils", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -10,6 +10,7 @@ "description": "utils for webpack loaders", | ||
"scripts": { | ||
"lint": "prettier --list-different . && eslint lib test", | ||
"lint": "prettier --list-different . && eslint .", | ||
"pretest": "yarn lint", | ||
"test": "jest", | ||
"test:ci": "jest --coverage", | ||
"test:only": "jest --coverage", | ||
"test:ci": "yarn test:only", | ||
"release": "yarn test && standard-version" | ||
@@ -16,0 +17,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31077
13
622