asset-hash
Advanced tools
Comparing version 4.0.6 to 4.1.0
@@ -1,2 +0,2 @@ | ||
/*! asset-hash v4.0.6 by Sebastian Werner <s.werner@sebastian-software.de> */ | ||
/*! asset-hash v4.1.0 by Sebastian Werner <s.werner@sebastian-software.de> */ | ||
'use strict'; | ||
@@ -93,5 +93,9 @@ | ||
return; | ||
} | ||
} // Allow failing initialization for platforms < Node v16 | ||
xxHashInstance = await xxhash__default(); | ||
try { | ||
xxHashInstance = await xxhash__default(); | ||
} catch {} | ||
hasherReady = true; | ||
@@ -155,3 +159,5 @@ } | ||
const DEFAULT_ALGORITHM = "xxhash64"; | ||
const NODE_MAJOR_VERSION = parseInt(process.versions.node.split('.')[0], 10); | ||
const NODE_SUPPORTS_BIGINT_SINCE = 16; | ||
const DEFAULT_ALGORITHM = NODE_MAJOR_VERSION < NODE_SUPPORTS_BIGINT_SINCE ? "farmhash64" : "xxhash64"; | ||
const DEFAULT_ENCODING = "base52"; | ||
@@ -242,2 +248,5 @@ const DEFAULT_MAX_LENGTH = 8; | ||
exports.DEFAULT_ALGORITHM = DEFAULT_ALGORITHM; | ||
exports.DEFAULT_ENCODING = DEFAULT_ENCODING; | ||
exports.DEFAULT_MAX_LENGTH = DEFAULT_MAX_LENGTH; | ||
exports.Hasher = Hasher; | ||
@@ -244,0 +253,0 @@ exports.getHash = getHash; |
/// <reference types="node" /> | ||
import { DigestOptions, SupportedEncoding } from "./encode"; | ||
import { HashAlgorithm, initHashClasses } from "./hash"; | ||
export declare const DEFAULT_ALGORITHM: string; | ||
export declare const DEFAULT_ENCODING = "base52"; | ||
export declare const DEFAULT_MAX_LENGTH = 8; | ||
export declare type HashOptions = DigestOptions & { | ||
@@ -5,0 +8,0 @@ algorithm?: HashAlgorithm; |
@@ -1,2 +0,2 @@ | ||
/*! asset-hash v4.0.6 by Sebastian Werner <s.werner@sebastian-software.de> */ | ||
/*! asset-hash v4.1.0 by Sebastian Werner <s.werner@sebastian-software.de> */ | ||
import 'core-js/modules/es.error.cause.js'; | ||
@@ -85,5 +85,9 @@ import { createReadStream } from 'fs'; | ||
return; | ||
} | ||
} // Allow failing initialization for platforms < Node v16 | ||
xxHashInstance = await xxhash(); | ||
try { | ||
xxHashInstance = await xxhash(); | ||
} catch {} | ||
hasherReady = true; | ||
@@ -147,3 +151,5 @@ } | ||
const DEFAULT_ALGORITHM = "xxhash64"; | ||
const NODE_MAJOR_VERSION = parseInt(process.versions.node.split('.')[0], 10); | ||
const NODE_SUPPORTS_BIGINT_SINCE = 16; | ||
const DEFAULT_ALGORITHM = NODE_MAJOR_VERSION < NODE_SUPPORTS_BIGINT_SINCE ? "farmhash64" : "xxhash64"; | ||
const DEFAULT_ENCODING = "base52"; | ||
@@ -234,3 +240,3 @@ const DEFAULT_MAX_LENGTH = 8; | ||
export { Hasher, getHash, getHashedName, initHashClasses }; | ||
export { DEFAULT_ALGORITHM, DEFAULT_ENCODING, DEFAULT_MAX_LENGTH, Hasher, getHash, getHashedName, initHashClasses }; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "asset-hash", | ||
"version": "4.0.6", | ||
"version": "4.1.0", | ||
"description": "Very fast asset hashing function for using e.g. during front-end deployments.", | ||
@@ -35,3 +35,3 @@ "main": "lib/index.cjs.js", | ||
"engines": { | ||
"node": ">=16.0.0" | ||
"node": ">=14" | ||
}, | ||
@@ -58,7 +58,7 @@ "jest": { | ||
"babel-jest": "^27.5.1", | ||
"eslint": "^8.10.0", | ||
"eslint": "^8.11.0", | ||
"jest": "^27.5.1", | ||
"preppy": "^11.0.2", | ||
"prettier": "^2.5.1", | ||
"release-it": "^14.12.5", | ||
"prettier": "^2.6.0", | ||
"release-it": "^14.13.1", | ||
"semver": "^7.3.5", | ||
@@ -65,0 +65,0 @@ "typescript": "^4.6.2" |
@@ -9,2 +9,5 @@ # _Asset Hash_ | ||
Note: Using the modern XXHash-WASM requires NodeJS >= v16. The module still supports older NodeJS v14 through the usage of | ||
the (optional) farmhash module. | ||
[sponsor]: https://www.sebastian-software.de | ||
@@ -46,3 +49,3 @@ [sponsor-img]: https://badgen.net/badge/Sponsored%20by/Sebastian%20Software/c41e54 | ||
```console | ||
$ npm install asset-hash | ||
npm install asset-hash | ||
``` | ||
@@ -53,3 +56,3 @@ | ||
```console | ||
$ yarn add asset-hash | ||
yarn add asset-hash | ||
``` | ||
@@ -56,0 +59,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
66657
502
139