From ff1204aff0651e32679ecd09d0a2a62de49f4eac Mon Sep 17 00:00:00 2001 From: Gar Date: Wed, 6 Dec 2023 11:10:55 -0800 Subject: [PATCH] deps: lru-cache@10.1.0 --- DEPENDENCIES.md | 1 - node_modules/lru-cache/dist/commonjs/index.js | 31 +++++++++++++++++++ node_modules/lru-cache/dist/esm/index.js | 31 +++++++++++++++++++ node_modules/lru-cache/package.json | 12 +++---- package-lock.json | 9 ++---- 5 files changed, 71 insertions(+), 13 deletions(-) diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index d9b176a8a76ed..c2b41286b400c 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -441,7 +441,6 @@ graph LR; libnpmversion-->require-inject; libnpmversion-->semver; libnpmversion-->tap; - lru-cache-->semver; lru-cache-->yallist; make-fetch-happen-->cacache; make-fetch-happen-->http-cache-semantics; diff --git a/node_modules/lru-cache/dist/commonjs/index.js b/node_modules/lru-cache/dist/commonjs/index.js index d7aef5b86b081..4177cfe43d0a4 100644 --- a/node_modules/lru-cache/dist/commonjs/index.js +++ b/node_modules/lru-cache/dist/commonjs/index.js @@ -736,6 +736,37 @@ class LRUCache { } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === undefined) + return undefined; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) + ? v.__staleWhileFetching + : v; + if (value === undefined) + return undefined; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() diff --git a/node_modules/lru-cache/dist/esm/index.js b/node_modules/lru-cache/dist/esm/index.js index 4f26d6defa68b..42ae40b3dcfc4 100644 --- a/node_modules/lru-cache/dist/esm/index.js +++ b/node_modules/lru-cache/dist/esm/index.js @@ -733,6 +733,37 @@ export class LRUCache { } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === undefined) + return undefined; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) + ? v.__staleWhileFetching + : v; + if (value === undefined) + return undefined; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() diff --git a/node_modules/lru-cache/package.json b/node_modules/lru-cache/package.json index e6cb6b32153b5..3702e6ef425bc 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": "10.0.2", + "version": "10.1.0", "author": "Isaac Z. Schlueter ", "keywords": [ "mru", @@ -45,7 +45,10 @@ } } }, - "repository": "git://github.com/isaacs/node-lru-cache.git", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-lru-cache.git" + }, "devDependencies": { "@tapjs/clock": "^1.1.16", "@types/node": "^20.2.5", @@ -111,8 +114,5 @@ } } }, - "type": "module", - "dependencies": { - "semver": "^7.3.5" - } + "type": "module" } diff --git a/package-lock.json b/package-lock.json index 892bddf36e07e..d3b84950150f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10248,13 +10248,10 @@ } }, "node_modules/lru-cache": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.2.tgz", - "integrity": "sha512-Yj9mA8fPiVgOUpByoTZO5pNrcl5Yk37FcSHsUINpAsaBIEZIuqcCclDZJCVxqQShDsmYX8QG63svJiTbOATZwg==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", + "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", "inBundle": true, - "dependencies": { - "semver": "^7.3.5" - }, "engines": { "node": "14 || >=16.14" }