Skip to content

Commit

Permalink
deps: lru-cache@7.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed May 11, 2022
1 parent cc7be6b commit 0432c7d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 20 deletions.
52 changes: 40 additions & 12 deletions node_modules/lru-cache/index.js
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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) {}
Expand Down Expand Up @@ -730,6 +752,7 @@ class LRUCache {
deprecatedMethod('del', 'delete')
return this.delete
}

delete (k) {
let deleted = false
if (this.size !== 0) {
Expand Down Expand Up @@ -809,6 +832,7 @@ class LRUCache {
}
}
}

get reset () {
deprecatedMethod('reset', 'clear')
return this.clear
Expand All @@ -818,6 +842,10 @@ class LRUCache {
deprecatedProperty('length', 'size')
return this.size
}

static get AbortController () {
return AC
}
}

module.exports = LRUCache
3 changes: 1 addition & 2 deletions node_modules/lru-cache/package.json
Original file line number Diff line number Diff line change
@@ -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 <i@izs.me>",
"keywords": [
"mru",
Expand All @@ -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"
},
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 0432c7d

Please sign in to comment.