From c44c2b02920854897ba7a663ef705b9b474c2250 Mon Sep 17 00:00:00 2001 From: Gar Date: Wed, 6 Apr 2022 09:24:11 -0700 Subject: [PATCH] deps: lru-cache@7.7.3 --- node_modules/lru-cache/index.js | 19 +++++++++++++------ node_modules/lru-cache/package.json | 4 ++-- package-lock.json | 9 ++++++--- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/node_modules/lru-cache/index.js b/node_modules/lru-cache/index.js index 978b8f4ee9595..2168fd3a67bb4 100644 --- a/node_modules/lru-cache/index.js +++ b/node_modules/lru-cache/index.js @@ -127,7 +127,7 @@ class LRUCache { throw new TypeError('cannot set sizeCalculation without setting maxSize') } if (typeof this.sizeCalculation !== 'function') { - throw new TypeError('sizeCalculating set to non-function') + throw new TypeError('sizeCalculation set to non-function') } } @@ -273,11 +273,18 @@ class LRUCache { this.sizes = new ZeroArray(this.max) this.removeItemSize = index => this.calculatedSize -= this.sizes[index] this.requireSize = (k, v, size, sizeCalculation) => { - if (sizeCalculation && !size) { - size = sizeCalculation(v, k) - } if (!isPosInt(size)) { - throw new TypeError('size must be positive integer') + if (sizeCalculation) { + if (typeof sizeCalculation !== 'function') { + throw new TypeError('sizeCalculation must be a function') + } + size = sizeCalculation(v, k) + if (!isPosInt(size)) { + throw new TypeError('sizeCalculation return invalid (expect positive integer)') + } + } else { + throw new TypeError('invalid size value (must be positive integer)') + } } return size } @@ -559,7 +566,7 @@ class LRUCache { if (this.isBackgroundFetch(v)) { return v } - const ac = new AbortController() + const ac = new AC() const fetchOpts = { signal: ac.signal, options, diff --git a/node_modules/lru-cache/package.json b/node_modules/lru-cache/package.json index 84d199c2b21b3..ca75abf004021 100644 --- a/node_modules/lru-cache/package.json +++ b/node_modules/lru-cache/package.json @@ -1,7 +1,7 @@ { "name": "lru-cache", "description": "A cache object that deletes the least-recently-used items.", - "version": "7.7.1", + "version": "7.7.3", "author": "Isaac Z. Schlueter ", "keywords": [ "mru", @@ -22,7 +22,7 @@ "devDependencies": { "@size-limit/preset-small-lib": "^7.0.8", "benchmark": "^2.1.4", - "clock-mock": "^1.0.3", + "clock-mock": "^1.0.4", "size-limit": "^7.0.8", "tap": "^15.1.6" }, diff --git a/package-lock.json b/package-lock.json index e0ddcc99cb134..5c9f21f3cab3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4525,9 +4525,10 @@ } }, "node_modules/lru-cache": { - "version": "7.7.1", + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz", + "integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw==", "inBundle": true, - "license": "ISC", "engines": { "node": ">=12" } @@ -12859,7 +12860,9 @@ "peer": true }, "lru-cache": { - "version": "7.7.1" + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz", + "integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw==" }, "make-dir": { "version": "3.1.0",