From 0432c7d8a22ddbfdf238c2b22dd3c7bd263e2d6c Mon Sep 17 00:00:00 2001 From: Gar Date: Wed, 11 May 2022 07:23:07 -0700 Subject: [PATCH] deps: lru-cache@7.9.0 --- node_modules/lru-cache/index.js | 52 ++++++++++++++++++++++------- node_modules/lru-cache/package.json | 3 +- package-lock.json | 12 +++---- 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/node_modules/lru-cache/index.js b/node_modules/lru-cache/index.js index b63be6e988835..fb1a076fa3ae8 100644 --- a/node_modules/lru-cache/index.js +++ b/node_modules/lru-cache/index.js @@ -1,15 +1,46 @@ const perf = typeof performance === 'object' && performance && typeof performance.now === 'function' ? performance : Date -const hasAbortController = typeof AbortController !== 'undefined' +const hasAbortController = typeof AbortController === 'function' // minimal backwards-compatibility polyfill +// this doesn't have nearly all the checks and whatnot that +// actual AbortController/Signal has, but it's enough for +// our purposes, and if used properly, behaves the same. const AC = hasAbortController ? AbortController : Object.assign( class AbortController { constructor () { this.signal = new AC.AbortSignal } - abort () { this.signal.aborted = true } + abort () { + this.signal.dispatchEvent('abort') + } }, - { AbortSignal: class AbortSignal { constructor () { this.aborted = false }}} + { + AbortSignal: class AbortSignal { + constructor () { + this.aborted = false + this._listeners = [] + } + dispatchEvent (type) { + if (type === 'abort') { + this.aborted = true + const e = { type, target: this } + this.onabort(e) + this._listeners.forEach(f => f(e), this) + } + } + onabort () {} + addEventListener (ev, fn) { + if (ev === 'abort') { + this._listeners.push(fn) + } + } + removeEventListener (ev, fn) { + if (ev === 'abort') { + this._listeners = this._listeners.filter(f => f !== fn) + } + } + } + } ) const warned = new Set() @@ -306,15 +337,6 @@ class LRUCache { } this.calculatedSize += this.sizes[index] } - this.delete = k => { - if (this.size !== 0) { - const index = this.keyMap.get(k) - if (index !== undefined) { - this.calculatedSize -= this.sizes[index] - } - } - return LRUCache.prototype.delete.call(this, k) - } } removeItemSize (index) {} addItemSize (index, v, k, size) {} @@ -730,6 +752,7 @@ class LRUCache { deprecatedMethod('del', 'delete') return this.delete } + delete (k) { let deleted = false if (this.size !== 0) { @@ -809,6 +832,7 @@ class LRUCache { } } } + get reset () { deprecatedMethod('reset', 'clear') return this.clear @@ -818,6 +842,10 @@ class LRUCache { deprecatedProperty('length', 'size') return this.size } + + static get AbortController () { + return AC + } } module.exports = LRUCache diff --git a/node_modules/lru-cache/package.json b/node_modules/lru-cache/package.json index 32fb9da24e56e..5364b09d2002c 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.8.1", + "version": "7.9.0", "author": "Isaac Z. Schlueter ", "keywords": [ "mru", @@ -23,7 +23,6 @@ "@size-limit/preset-small-lib": "^7.0.8", "benchmark": "^2.1.4", "clock-mock": "^1.0.4", - "heapdump": "^0.3.15", "size-limit": "^7.0.8", "tap": "^15.1.6" }, diff --git a/package-lock.json b/package-lock.json index 309e9d123d10c..446c018c7e59a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4569,9 +4569,9 @@ } }, "node_modules/lru-cache": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.8.1.tgz", - "integrity": "sha512-E1v547OCgJvbvevfjgK9sNKIVXO96NnsTsFPBlg4ZxjhsJSODoH9lk8Bm0OxvHNm6Vm5Yqkl/1fErDxhYL8Skg==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.9.0.tgz", + "integrity": "sha512-lkcNMUKqdJk96TuIXUidxaPuEg5sJo/+ZyVE2BDFnuZGzwXem7d8582eG8vbu4todLfT14snP6iHriCHXXi5Rw==", "inBundle": true, "engines": { "node": ">=12" @@ -13239,9 +13239,9 @@ "peer": true }, "lru-cache": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.8.1.tgz", - "integrity": "sha512-E1v547OCgJvbvevfjgK9sNKIVXO96NnsTsFPBlg4ZxjhsJSODoH9lk8Bm0OxvHNm6Vm5Yqkl/1fErDxhYL8Skg==" + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.9.0.tgz", + "integrity": "sha512-lkcNMUKqdJk96TuIXUidxaPuEg5sJo/+ZyVE2BDFnuZGzwXem7d8582eG8vbu4todLfT14snP6iHriCHXXi5Rw==" }, "make-dir": { "version": "3.1.0",