Skip to content

Commit

Permalink
deps: lru-cache@10.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Nov 14, 2023
1 parent d12a2cf commit 3ab57e9
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 73 deletions.
1 change: 1 addition & 0 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ 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;
Expand Down
2 changes: 0 additions & 2 deletions node_modules/lru-cache/dist/cjs/index.min.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@ class LRUCache {
if (ttls[index]) {
const ttl = ttls[index];
const start = starts[index];
/* c8 ignore next */
if (!ttl || !start)
return;
status.ttl = ttl;
status.start = start;
status.now = cachedNow || getNow();
Expand Down Expand Up @@ -466,16 +469,16 @@ class LRUCache {
}
const ttl = ttls[index];
const start = starts[index];
if (ttl === 0 || start === 0) {
if (!ttl || !start) {
return Infinity;
}
const age = (cachedNow || getNow()) - start;
return ttl - age;
};
this.#isStale = index => {
return (ttls[index] !== 0 &&
starts[index] !== 0 &&
(cachedNow || getNow()) - starts[index] > ttls[index]);
const s = starts[index];
const t = ttls[index];
return !!t && !!s && (cachedNow || getNow()) - s > t;
};
}
// conditionally set private methods related to TTL
Expand Down Expand Up @@ -999,12 +1002,13 @@ class LRUCache {
peek(k, peekOptions = {}) {
const { allowStale = this.allowStale } = peekOptions;
const index = this.#keyMap.get(k);
if (index !== undefined &&
(allowStale || !this.#isStale(index))) {
const v = this.#valList[index];
// either stale and allowed, or forcing a refresh of non-stale value
return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
if (index === undefined ||
(!allowStale && this.#isStale(index))) {
return;
}
const v = this.#valList[index];
// either stale and allowed, or forcing a refresh of non-stale value
return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
}
#backgroundFetch(k, index, options, context) {
const v = index === undefined ? undefined : this.#valList[index];
Expand Down Expand Up @@ -1340,8 +1344,10 @@ class LRUCache {
this.#head = this.#next[index];
}
else {
this.#next[this.#prev[index]] = this.#next[index];
this.#prev[this.#next[index]] = this.#prev[index];
const pi = this.#prev[index];
this.#next[pi] = this.#next[index];
const ni = this.#next[index];
this.#prev[ni] = this.#prev[index];
}
this.#size--;
this.#free.push(index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ export class LRUCache {
if (ttls[index]) {
const ttl = ttls[index];
const start = starts[index];
/* c8 ignore next */
if (!ttl || !start)
return;
status.ttl = ttl;
status.start = start;
status.now = cachedNow || getNow();
Expand Down Expand Up @@ -463,16 +466,16 @@ export class LRUCache {
}
const ttl = ttls[index];
const start = starts[index];
if (ttl === 0 || start === 0) {
if (!ttl || !start) {
return Infinity;
}
const age = (cachedNow || getNow()) - start;
return ttl - age;
};
this.#isStale = index => {
return (ttls[index] !== 0 &&
starts[index] !== 0 &&
(cachedNow || getNow()) - starts[index] > ttls[index]);
const s = starts[index];
const t = ttls[index];
return !!t && !!s && (cachedNow || getNow()) - s > t;
};
}
// conditionally set private methods related to TTL
Expand Down Expand Up @@ -996,12 +999,13 @@ export class LRUCache {
peek(k, peekOptions = {}) {
const { allowStale = this.allowStale } = peekOptions;
const index = this.#keyMap.get(k);
if (index !== undefined &&
(allowStale || !this.#isStale(index))) {
const v = this.#valList[index];
// either stale and allowed, or forcing a refresh of non-stale value
return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
if (index === undefined ||
(!allowStale && this.#isStale(index))) {
return;
}
const v = this.#valList[index];
// either stale and allowed, or forcing a refresh of non-stale value
return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
}
#backgroundFetch(k, index, options, context) {
const v = index === undefined ? undefined : this.#valList[index];
Expand Down Expand Up @@ -1337,8 +1341,10 @@ export class LRUCache {
this.#head = this.#next[index];
}
else {
this.#next[this.#prev[index]] = this.#next[index];
this.#prev[this.#next[index]] = this.#prev[index];
const pi = this.#prev[index];
this.#next[pi] = this.#next[index];
const ni = this.#next[index];
this.#prev[ni] = this.#prev[index];
}
this.#size--;
this.#free.push(index);
Expand Down
2 changes: 0 additions & 2 deletions node_modules/lru-cache/dist/mjs/index.min.js

This file was deleted.

98 changes: 54 additions & 44 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": "10.0.1",
"version": "10.0.2",
"author": "Isaac Z. Schlueter <i@izs.me>",
"keywords": [
"mru",
Expand All @@ -11,67 +11,57 @@
"sideEffects": false,
"scripts": {
"build": "npm run prepare",
"preprepare": "rm -rf dist",
"prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json",
"prepare": "tshy",
"postprepare": "bash fixup.sh",
"pretest": "npm run prepare",
"presnap": "npm run prepare",
"test": "c8 tap",
"snap": "c8 tap",
"test": "tap",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"format": "prettier --write .",
"typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts",
"typedoc": "typedoc --tsconfig ./.tshy/esm.json ./src/*.ts",
"benchmark-results-typedoc": "bash scripts/benchmark-results-typedoc.sh",
"prebenchmark": "npm run prepare",
"benchmark": "make -C benchmark",
"preprofile": "npm run prepare",
"profile": "make -C benchmark profile"
},
"main": "./dist/cjs/index.js",
"module": "./dist/mjs/index.js",
"exports": {
"./min": {
"import": {
"types": "./dist/mjs/index.d.ts",
"default": "./dist/mjs/index.min.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.min.js"
}
},
".": {
"import": {
"types": "./dist/mjs/index.d.ts",
"default": "./dist/mjs/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
"main": "./dist/commonjs/index.js",
"types": "./dist/commonjs/index.d.ts",
"tshy": {
"exports": {
".": "./src/index.ts",
"./min": {
"import": {
"types": "./dist/mjs/index.d.ts",
"default": "./dist/mjs/index.min.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.min.js"
}
}
}
},
"repository": "git://github.com/isaacs/node-lru-cache.git",
"devDependencies": {
"@size-limit/preset-small-lib": "^7.0.8",
"@tapjs/clock": "^1.1.16",
"@types/node": "^20.2.5",
"@types/tap": "^15.0.6",
"benchmark": "^2.1.4",
"c8": "^7.11.2",
"clock-mock": "^1.0.6",
"clock-mock": "^2.0.2",
"esbuild": "^0.17.11",
"eslint-config-prettier": "^8.5.0",
"marked": "^4.2.12",
"mkdirp": "^2.1.5",
"prettier": "^2.6.2",
"size-limit": "^7.0.8",
"tap": "^16.3.4",
"ts-node": "^10.9.1",
"tap": "^18.5.7",
"tshy": "^1.8.0",
"tslib": "^2.4.0",
"typedoc": "^0.24.6",
"typescript": "^5.0.4"
"typedoc": "^0.25.3",
"typescript": "^5.2.2"
},
"license": "ISC",
"files": [
Expand All @@ -92,17 +82,37 @@
"endOfLine": "lf"
},
"tap": {
"coverage": false,
"node-arg": [
"--expose-gc",
"-r",
"ts-node/register"
"--expose-gc"
],
"ts": false
"plugin": [
"@tapjs/clock"
]
},
"size-limit": [
{
"path": "./dist/mjs/index.js"
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
},
"./min": {
"import": {
"types": "./dist/mjs/index.d.ts",
"default": "./dist/mjs/index.min.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.min.js"
}
}
]
},
"type": "module",
"dependencies": {
"semver": "^7.3.5"
}
}
9 changes: 6 additions & 3 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -10200,10 +10200,13 @@
}
},
"node_modules/lru-cache": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz",
"integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==",
"version": "10.0.2",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.2.tgz",
"integrity": "sha512-Yj9mA8fPiVgOUpByoTZO5pNrcl5Yk37FcSHsUINpAsaBIEZIuqcCclDZJCVxqQShDsmYX8QG63svJiTbOATZwg==",
"inBundle": true,
"dependencies": {
"semver": "^7.3.5"
},
"engines": {
"node": "14 || >=16.14"
}
Expand Down

0 comments on commit 3ab57e9

Please sign in to comment.