asset-hash
Advanced tools
Comparing version 2.2.9 to 2.3.0
@@ -1,2 +0,2 @@ | ||
/*! asset-hash v2.2.9 by Sebastian Werner <s.werner@sebastian-software.de> */ | ||
/*! asset-hash v2.3.0 by Sebastian Werner <s.werner@sebastian-software.de> */ | ||
'use strict'; | ||
@@ -16,6 +16,12 @@ | ||
var metrohash = require('metrohash'); | ||
var XXHash32 = require('xxhash'); | ||
var XXHash32__default = _interopDefault(XXHash32); | ||
var DEFAULT_HASH = "metrohash128", | ||
var xxhash = null; | ||
try { | ||
xxhash = require("xxhash"); | ||
} catch (e) {} | ||
var XXHash32 = xxhash ? xxhash : null, | ||
XXHash64 = xxhash ? xxhash.XXHash64 : null, | ||
DEFAULT_HASH = "metrohash128", | ||
DEFAULT_ENCODING = "base52", | ||
@@ -117,5 +123,13 @@ DEFAULT_MAX_LENGTH = 8, | ||
if (hash === "xxhash32") { | ||
hasher = new XXHash32__default(XXHASH_CONSTRUCT); | ||
if (!XXHash32) { | ||
throw new Error("Install xxhash module to use xxhash32 hasher"); | ||
} | ||
hasher = new XXHash32(XXHASH_CONSTRUCT); | ||
} else if (hash === "xxhash64") { | ||
hasher = new XXHash32.XXHash64(XXHASH_CONSTRUCT); | ||
if (!XXHash64) { | ||
throw new Error("Install xxhash module to use xxhash64 hasher"); | ||
} | ||
hasher = new XXHash64(XXHASH_CONSTRUCT); | ||
} else if (hash === "metrohash64") { | ||
@@ -163,5 +177,5 @@ hasher = new metrohash.MetroHash64(); | ||
var hashed, extension; | ||
return Promise.resolve(getHash(fileName, options)).then(function ($await_3) { | ||
return Promise.resolve(getHash(fileName, options)).then(function ($await_4) { | ||
try { | ||
hashed = $await_3; | ||
hashed = $await_4; | ||
extension = path.extname(fileName); | ||
@@ -168,0 +182,0 @@ return $return(hashed + extension); |
@@ -1,2 +0,2 @@ | ||
/*! asset-hash v2.2.9 by Sebastian Werner <s.werner@sebastian-software.de> */ | ||
/*! asset-hash v2.3.0 by Sebastian Werner <s.werner@sebastian-software.de> */ | ||
import 'core-js/modules/es6.promise'; | ||
@@ -10,5 +10,12 @@ import 'core-js/modules/es6.regexp.to-string'; | ||
import { MetroHash64, MetroHash128 } from 'metrohash'; | ||
import XXHash32, { XXHash64 } from 'xxhash'; | ||
var DEFAULT_HASH = "metrohash128", | ||
var xxhash = null; | ||
try { | ||
xxhash = require("xxhash"); | ||
} catch (e) {} | ||
var XXHash32 = xxhash ? xxhash : null, | ||
XXHash64 = xxhash ? xxhash.XXHash64 : null, | ||
DEFAULT_HASH = "metrohash128", | ||
DEFAULT_ENCODING = "base52", | ||
@@ -110,4 +117,12 @@ DEFAULT_MAX_LENGTH = 8, | ||
if (hash === "xxhash32") { | ||
if (!XXHash32) { | ||
throw new Error("Install xxhash module to use xxhash32 hasher"); | ||
} | ||
hasher = new XXHash32(XXHASH_CONSTRUCT); | ||
} else if (hash === "xxhash64") { | ||
if (!XXHash64) { | ||
throw new Error("Install xxhash module to use xxhash64 hasher"); | ||
} | ||
hasher = new XXHash64(XXHASH_CONSTRUCT); | ||
@@ -156,5 +171,5 @@ } else if (hash === "metrohash64") { | ||
var hashed, extension; | ||
return Promise.resolve(getHash(fileName, options)).then(function ($await_3) { | ||
return Promise.resolve(getHash(fileName, options)).then(function ($await_4) { | ||
try { | ||
hashed = $await_3; | ||
hashed = $await_4; | ||
extension = extname(fileName); | ||
@@ -161,0 +176,0 @@ return $return(hashed + extension); |
{ | ||
"name": "asset-hash", | ||
"version": "2.2.9", | ||
"version": "2.3.0", | ||
"description": "Very fast asset hashing function for using e.g. during front-end deployments.", | ||
@@ -42,17 +42,19 @@ "main": "lib/index.cjs.js", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-jest": "^23.6.0", | ||
"babel-preset-edge": "^4.14.4", | ||
"eslint": "^5.12.1", | ||
"eslint-config-readable": "^2.3.0", | ||
"jest": "^23.6.0", | ||
"preppy": "^7.4.2", | ||
"prettier": "^1.16.1" | ||
"babel-jest": "^24.1.0", | ||
"babel-preset-edge": "^4.14.5", | ||
"eslint": "^5.14.1", | ||
"eslint-config-readable": "^2.3.2", | ||
"jest": "^24.1.0", | ||
"preppy": "^7.5.0", | ||
"prettier": "^1.16.4" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.3.1", | ||
"@babel/runtime": "^7.3.4", | ||
"big.js": "^5.2.2", | ||
"core-js": "^2.6.3", | ||
"metrohash": "^2.5.1", | ||
"core-js": "^2.6.5", | ||
"metrohash": "^2.5.1" | ||
}, | ||
"optionalDependencies": { | ||
"xxhash": "^0.2.4" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
36147
321
- Removedxxhash@^0.2.4
Updated@babel/runtime@^7.3.4
Updatedcore-js@^2.6.5