Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-03-15 23:27:44 +0300
committernlf <nlf@github.com>2022-03-15 23:38:37 +0300
commitf95396a033b75e2a3e9aa83f0b06c527641027a4 (patch)
treea806ab48473c03b1f4276e94582f7865d24222e4 /node_modules
parent1cb88f4b31019af9cb8eac8a46433b44bba9d061 (diff)
deps: cacache@16.0.1
Diffstat (limited to 'node_modules')
-rw-r--r--node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.js1
-rw-r--r--node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.mjs1
-rw-r--r--node_modules/@npmcli/git/node_modules/lru-cache/index.js587
-rw-r--r--node_modules/@npmcli/git/node_modules/lru-cache/package.json52
-rw-r--r--node_modules/cacache/lib/memoization.js10
-rw-r--r--node_modules/cacache/package.json8
-rw-r--r--node_modules/hosted-git-info/node_modules/lru-cache/LICENSE15
-rw-r--r--node_modules/hosted-git-info/node_modules/lru-cache/index.js615
-rw-r--r--node_modules/lru-cache/LICENSE2
-rw-r--r--node_modules/lru-cache/index.js801
-rw-r--r--node_modules/lru-cache/package.json23
-rw-r--r--node_modules/make-fetch-happen/node_modules/lru-cache/LICENSE15
-rw-r--r--node_modules/make-fetch-happen/node_modules/lru-cache/index.js615
-rw-r--r--node_modules/make-fetch-happen/node_modules/lru-cache/package.json43
-rw-r--r--node_modules/semver/node_modules/lru-cache/LICENSE (renamed from node_modules/@npmcli/git/node_modules/lru-cache/LICENSE)2
-rw-r--r--node_modules/semver/node_modules/lru-cache/index.js334
-rw-r--r--node_modules/semver/node_modules/lru-cache/package.json (renamed from node_modules/hosted-git-info/node_modules/lru-cache/package.json)23
17 files changed, 908 insertions, 2239 deletions
diff --git a/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.js b/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.js
deleted file mode 100644
index 7eef327e9..000000000
--- a/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.js
+++ /dev/null
@@ -1 +0,0 @@
-(()=>{var t={10:t=>{const i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,s=new Set,e=(t,i)=>{const s=`LRU_CACHE_OPTION_${t}`;l(s)&&o(s,`${t} option`,`options.${i}`,d)},h=(t,i)=>{const s=`LRU_CACHE_METHOD_${t}`;if(l(s)){const{prototype:e}=d,{get:h}=Object.getOwnPropertyDescriptor(e,t);o(s,`${t} method`,`cache.${i}()`,h)}},l=t=>!(process.noDeprecation||s.has(t)),o=(t,i,e,h)=>{s.add(t),process.emitWarning(`The ${i} is deprecated. Please use ${e} instead.`,"DeprecationWarning",t,h)},n=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),a=t=>n(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?r:null:null;class r extends Array{constructor(t){super(t),this.fill(0)}}class p{constructor(t){const i=a(t);this.heap=new i(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class d{constructor(t={}){const{max:i,ttl:s,ttlResolution:h=1,ttlAutopurge:l,updateAgeOnGet:o,allowStale:r,dispose:c,disposeAfter:f,noDisposeOnSet:u,noUpdateTTL:z,maxSize:v,sizeCalculation:y}=t,{length:g,maxAge:m,stale:S}=t instanceof d?{}:t;if(!n(i))throw new TypeError("max option must be an integer");const x=a(i);if(!x)throw new Error("invalid max value: "+i);if(this.max=i,this.maxSize=v||0,this.sizeCalculation=y||g,this.sizeCalculation){if(!this.maxSize)throw new TypeError("cannot set sizeCalculation without setting maxSize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculating set to non-function")}if(this.keyMap=new Map,this.keyList=new Array(i).fill(null),this.valList=new Array(i).fill(null),this.next=new x(i),this.prev=new x(i),this.head=0,this.tail=0,this.free=new p(i),this.initialFill=1,this.size=0,"function"==typeof c&&(this.dispose=c),"function"==typeof f?(this.disposeAfter=f,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!u,this.noUpdateTTL=!!z,this.maxSize){if(!n(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!r||!!S,this.updateAgeOnGet=!!o,this.ttlResolution=n(h)||0===h?h:1,this.ttlAutopurge=!!l,this.ttl=s||m||0,this.ttl){if(!n(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}S&&e("stale","allowStale"),m&&e("maxAge","ttl"),g&&e("length","sizeCalculation")}initializeTTLTracking(){this.ttls=new r(this.max),this.starts=new r(this.max),this.setItemTTL=(t,s)=>{if(this.starts[t]=0!==s?i.now():0,this.ttls[t]=s,0!==s&&this.ttlAutopurge){const i=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),s+1);i.unref&&i.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?i.now():0};let t=0;const s=()=>{const s=i.now();if(this.ttlResolution>0){t=s;const i=setTimeout((()=>t=0),this.ttlResolution);i.unref&&i.unref()}return s};this.isStale=i=>0!==this.ttls[i]&&0!==this.starts[i]&&(t||s())-this.starts[i]>this.ttls[i]}updateItemAge(t){}setItemTTL(t,i){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new r(this.max),this.removeItemSize=t=>this.calculatedSize-=this.sizes[t],this.addItemSize=(t,i,s,e,h)=>{const l=e||(h?h(i,s):0);this.sizes[t]=n(l)?l:0;const o=this.maxSize-this.sizes[t];for(;this.calculatedSize>o;)this.evict();this.calculatedSize+=this.sizes[t]},this.delete=t=>{if(0!==this.size){const i=this.keyMap.get(t);void 0!==i&&(this.calculatedSize-=this.sizes[i])}return d.prototype.delete.call(this,t)}}removeItemSize(t){}addItemSize(t,i,s,e,h){}*indexes(){if(this.size)for(let t=this.tail;this.isStale(t)||(yield t),t!==this.head;t=this.prev[t]);}*rindexes(){if(this.size)for(let t=this.head;this.isStale(t)||(yield t),t!==this.tail;t=this.next[t]);}*entries(){for(const t of this.indexes())yield[this.keyList[t],this.valList[t]]}*keys(){for(const t of this.indexes())yield this.keyList[t]}*values(){for(const t of this.indexes())yield this.valList[t]}[Symbol.iterator](){return this.entries()}find(t,i={}){for(const s of this.indexes())if(t(this.valList[s],this.keyList[s],this))return this.get(this.keyList[s],i)}forEach(t,i=this){for(const s of this.indexes())t.call(i,this.valList[s],this.keyList[s],this)}rforEach(t,i=this){for(const s of this.rindexes())t.call(i,this.valList[s],this.keyList[s],this)}get prune(){return h("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;if(this.size)for(let i=this.head;;i=this.next[i]){const s=i===this.tail;if(this.isStale(i)&&(this.delete(this.keyList[i]),t=!0),s)break}return t}dump(){const t=[];for(const i of this.indexes()){const s=this.keyList[i],e={value:this.valList[i]};this.ttls&&(e.ttl=this.ttls[i]),this.sizes&&(e.size=this.sizes[i]),t.unshift([s,e])}return t}load(t){this.clear();for(const[i,s]of t)this.set(i,s.value,s)}dispose(t,i,s){}set(t,i,{ttl:s=this.ttl,noDisposeOnSet:e=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:o=this.noUpdateTTL}={}){let n=0===this.size?void 0:this.keyMap.get(t);if(void 0===n)n=this.newIndex(),this.keyList[n]=t,this.valList[n]=i,this.keyMap.set(t,n),this.next[this.tail]=n,this.prev[n]=this.tail,this.tail=n,this.size++,this.addItemSize(n,i,t,h,l),o=!1;else{const s=this.valList[n];i!==s&&(e||(this.dispose(s,t,"set"),this.disposeAfter&&this.disposed.push([s,t,"set"])),this.removeItemSize(n),this.valList[n]=i,this.addItemSize(n,i,t,h,l)),this.moveToTail(n)}if(0===s||0!==this.ttl||this.ttls||this.initializeTTLTracking(),o||this.setItemTTL(n,s),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max?this.evict():0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(),t}}evict(){const t=this.head,i=this.keyList[t],s=this.valList[t];return this.dispose(s,i,"evict"),this.disposeAfter&&this.disposed.push([s,i,"evict"]),this.removeItemSize(t),this.head=this.next[t],this.keyMap.delete(i),this.size--,t}has(t){return this.keyMap.has(t)&&!this.isStale(this.keyMap.get(t))}peek(t,{allowStale:i=this.allowStale}={}){const s=this.keyMap.get(t);if(void 0!==s&&(i||!this.isStale(s)))return this.valList[s]}get(t,{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet}={}){const e=this.keyMap.get(t);if(void 0!==e){if(this.isStale(e)){const s=i?this.valList[e]:void 0;return this.delete(t),s}return this.moveToTail(e),s&&this.updateItemAge(e),this.valList[e]}}connect(t,i){this.prev[i]=t,this.next[t]=i}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return h("del","delete"),this.delete}delete(t){let i=!1;if(0!==this.size){const s=this.keyMap.get(t);void 0!==s&&(i=!0,1===this.size?this.clear():(this.removeItemSize(s),this.dispose(this.valList[s],t,"delete"),this.disposeAfter&&this.disposed.push([this.valList[s],t,"delete"]),this.keyMap.delete(t),this.keyList[s]=null,this.valList[s]=null,s===this.tail?this.tail=this.prev[s]:s===this.head?this.head=this.next[s]:(this.next[this.prev[s]]=this.next[s],this.prev[this.next[s]]=this.prev[s]),this.size--,this.free.push(s)))}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return i}clear(){if(this.dispose!==d.prototype.dispose)for(const t of this.rindexes())this.dispose(this.valList[t],this.keyList[t],"delete");if(this.disposeAfter)for(const t of this.rindexes())this.disposed.push([this.valList[t],this.keyList[t],"delete"]);if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return h("reset","clear"),this.clear}get length(){return((t,i)=>{const s="LRU_CACHE_PROPERTY_length";if(l(s)){const{prototype:i}=d,{get:e}=Object.getOwnPropertyDescriptor(i,t);o(s,"length property","cache.size",e)}})("length"),this.size}}t.exports=d}},i={},s=function s(e){var h=i[e];if(void 0!==h)return h.exports;var l=i[e]={exports:{}};return t[e](l,l.exports,s),l.exports}(10);module.exports=s})(); \ No newline at end of file
diff --git a/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.mjs b/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.mjs
deleted file mode 100644
index 3a4d674c0..000000000
--- a/node_modules/@npmcli/git/node_modules/lru-cache/bundle/main.mjs
+++ /dev/null
@@ -1 +0,0 @@
-var t={10:t=>{const i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,s=new Set,e=(t,i)=>{const s=`LRU_CACHE_OPTION_${t}`;l(s)&&o(s,`${t} option`,`options.${i}`,d)},h=(t,i)=>{const s=`LRU_CACHE_METHOD_${t}`;if(l(s)){const{prototype:e}=d,{get:h}=Object.getOwnPropertyDescriptor(e,t);o(s,`${t} method`,`cache.${i}()`,h)}},l=t=>!(process.noDeprecation||s.has(t)),o=(t,i,e,h)=>{s.add(t),process.emitWarning(`The ${i} is deprecated. Please use ${e} instead.`,"DeprecationWarning",t,h)},n=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),a=t=>n(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?r:null:null;class r extends Array{constructor(t){super(t),this.fill(0)}}class p{constructor(t){const i=a(t);this.heap=new i(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class d{constructor(t={}){const{max:i,ttl:s,ttlResolution:h=1,ttlAutopurge:l,updateAgeOnGet:o,allowStale:r,dispose:c,disposeAfter:f,noDisposeOnSet:u,noUpdateTTL:z,maxSize:v,sizeCalculation:y}=t,{length:g,maxAge:m,stale:S}=t instanceof d?{}:t;if(!n(i))throw new TypeError("max option must be an integer");const L=a(i);if(!L)throw new Error("invalid max value: "+i);if(this.max=i,this.maxSize=v||0,this.sizeCalculation=y||g,this.sizeCalculation){if(!this.maxSize)throw new TypeError("cannot set sizeCalculation without setting maxSize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculating set to non-function")}if(this.keyMap=new Map,this.keyList=new Array(i).fill(null),this.valList=new Array(i).fill(null),this.next=new L(i),this.prev=new L(i),this.head=0,this.tail=0,this.free=new p(i),this.initialFill=1,this.size=0,"function"==typeof c&&(this.dispose=c),"function"==typeof f?(this.disposeAfter=f,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!u,this.noUpdateTTL=!!z,this.maxSize){if(!n(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!r||!!S,this.updateAgeOnGet=!!o,this.ttlResolution=n(h)||0===h?h:1,this.ttlAutopurge=!!l,this.ttl=s||m||0,this.ttl){if(!n(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}S&&e("stale","allowStale"),m&&e("maxAge","ttl"),g&&e("length","sizeCalculation")}initializeTTLTracking(){this.ttls=new r(this.max),this.starts=new r(this.max),this.setItemTTL=(t,s)=>{if(this.starts[t]=0!==s?i.now():0,this.ttls[t]=s,0!==s&&this.ttlAutopurge){const i=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),s+1);i.unref&&i.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?i.now():0};let t=0;const s=()=>{const s=i.now();if(this.ttlResolution>0){t=s;const i=setTimeout((()=>t=0),this.ttlResolution);i.unref&&i.unref()}return s};this.isStale=i=>0!==this.ttls[i]&&0!==this.starts[i]&&(t||s())-this.starts[i]>this.ttls[i]}updateItemAge(t){}setItemTTL(t,i){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new r(this.max),this.removeItemSize=t=>this.calculatedSize-=this.sizes[t],this.addItemSize=(t,i,s,e,h)=>{const l=e||(h?h(i,s):0);this.sizes[t]=n(l)?l:0;const o=this.maxSize-this.sizes[t];for(;this.calculatedSize>o;)this.evict();this.calculatedSize+=this.sizes[t]},this.delete=t=>{if(0!==this.size){const i=this.keyMap.get(t);void 0!==i&&(this.calculatedSize-=this.sizes[i])}return d.prototype.delete.call(this,t)}}removeItemSize(t){}addItemSize(t,i,s,e,h){}*indexes(){if(this.size)for(let t=this.tail;this.isStale(t)||(yield t),t!==this.head;t=this.prev[t]);}*rindexes(){if(this.size)for(let t=this.head;this.isStale(t)||(yield t),t!==this.tail;t=this.next[t]);}*entries(){for(const t of this.indexes())yield[this.keyList[t],this.valList[t]]}*keys(){for(const t of this.indexes())yield this.keyList[t]}*values(){for(const t of this.indexes())yield this.valList[t]}[Symbol.iterator](){return this.entries()}find(t,i={}){for(const s of this.indexes())if(t(this.valList[s],this.keyList[s],this))return this.get(this.keyList[s],i)}forEach(t,i=this){for(const s of this.indexes())t.call(i,this.valList[s],this.keyList[s],this)}rforEach(t,i=this){for(const s of this.rindexes())t.call(i,this.valList[s],this.keyList[s],this)}get prune(){return h("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;if(this.size)for(let i=this.head;;i=this.next[i]){const s=i===this.tail;if(this.isStale(i)&&(this.delete(this.keyList[i]),t=!0),s)break}return t}dump(){const t=[];for(const i of this.indexes()){const s=this.keyList[i],e={value:this.valList[i]};this.ttls&&(e.ttl=this.ttls[i]),this.sizes&&(e.size=this.sizes[i]),t.unshift([s,e])}return t}load(t){this.clear();for(const[i,s]of t)this.set(i,s.value,s)}dispose(t,i,s){}set(t,i,{ttl:s=this.ttl,noDisposeOnSet:e=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:o=this.noUpdateTTL}={}){let n=0===this.size?void 0:this.keyMap.get(t);if(void 0===n)n=this.newIndex(),this.keyList[n]=t,this.valList[n]=i,this.keyMap.set(t,n),this.next[this.tail]=n,this.prev[n]=this.tail,this.tail=n,this.size++,this.addItemSize(n,i,t,h,l),o=!1;else{const s=this.valList[n];i!==s&&(e||(this.dispose(s,t,"set"),this.disposeAfter&&this.disposed.push([s,t,"set"])),this.removeItemSize(n),this.valList[n]=i,this.addItemSize(n,i,t,h,l)),this.moveToTail(n)}if(0===s||0!==this.ttl||this.ttls||this.initializeTTLTracking(),o||this.setItemTTL(n,s),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max?this.evict():0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(),t}}evict(){const t=this.head,i=this.keyList[t],s=this.valList[t];return this.dispose(s,i,"evict"),this.disposeAfter&&this.disposed.push([s,i,"evict"]),this.removeItemSize(t),this.head=this.next[t],this.keyMap.delete(i),this.size--,t}has(t){return this.keyMap.has(t)&&!this.isStale(this.keyMap.get(t))}peek(t,{allowStale:i=this.allowStale}={}){const s=this.keyMap.get(t);if(void 0!==s&&(i||!this.isStale(s)))return this.valList[s]}get(t,{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet}={}){const e=this.keyMap.get(t);if(void 0!==e){if(this.isStale(e)){const s=i?this.valList[e]:void 0;return this.delete(t),s}return this.moveToTail(e),s&&this.updateItemAge(e),this.valList[e]}}connect(t,i){this.prev[i]=t,this.next[t]=i}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return h("del","delete"),this.delete}delete(t){let i=!1;if(0!==this.size){const s=this.keyMap.get(t);void 0!==s&&(i=!0,1===this.size?this.clear():(this.removeItemSize(s),this.dispose(this.valList[s],t,"delete"),this.disposeAfter&&this.disposed.push([this.valList[s],t,"delete"]),this.keyMap.delete(t),this.keyList[s]=null,this.valList[s]=null,s===this.tail?this.tail=this.prev[s]:s===this.head?this.head=this.next[s]:(this.next[this.prev[s]]=this.next[s],this.prev[this.next[s]]=this.prev[s]),this.size--,this.free.push(s)))}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return i}clear(){if(this.dispose!==d.prototype.dispose)for(const t of this.rindexes())this.dispose(this.valList[t],this.keyList[t],"delete");if(this.disposeAfter)for(const t of this.rindexes())this.disposed.push([this.valList[t],this.keyList[t],"delete"]);if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return h("reset","clear"),this.clear}get length(){return((t,i)=>{const s="LRU_CACHE_PROPERTY_length";if(l(s)){const{prototype:i}=d,{get:e}=Object.getOwnPropertyDescriptor(i,t);o(s,"length property","cache.size",e)}})("length"),this.size}}t.exports=d}},i={};!function s(e){var h=i[e];if(void 0!==h)return h.exports;var l=i[e]={exports:{}};return t[e](l,l.exports,s),l.exports}(10); \ No newline at end of file
diff --git a/node_modules/@npmcli/git/node_modules/lru-cache/index.js b/node_modules/@npmcli/git/node_modules/lru-cache/index.js
deleted file mode 100644
index e9b2f3701..000000000
--- a/node_modules/@npmcli/git/node_modules/lru-cache/index.js
+++ /dev/null
@@ -1,587 +0,0 @@
-const perf = typeof performance === 'object' && performance &&
- typeof performance.now === 'function' ? performance : Date
-
-const warned = new Set()
-const deprecatedOption = (opt, instead) => {
- const code = `LRU_CACHE_OPTION_${opt}`
- if (shouldWarn(code)) {
- warn(code, `${opt} option`, `options.${instead}`, LRUCache)
- }
-}
-const deprecatedMethod = (method, instead) => {
- const code = `LRU_CACHE_METHOD_${method}`
- if (shouldWarn(code)) {
- const { prototype } = LRUCache
- const { get } = Object.getOwnPropertyDescriptor(prototype, method)
- warn(code, `${method} method`, `cache.${instead}()`, get)
- }
-}
-const deprecatedProperty = (field, instead) => {
- const code = `LRU_CACHE_PROPERTY_${field}`
- if (shouldWarn(code)) {
- const { prototype } = LRUCache
- const { get } = Object.getOwnPropertyDescriptor(prototype, field)
- warn(code, `${field} property`, `cache.${instead}`, get)
- }
-}
-const shouldWarn = (code) => !(process.noDeprecation || warned.has(code))
-const warn = (code, what, instead, fn) => {
- warned.add(code)
- process.emitWarning(`The ${what} is deprecated. Please use ${instead} instead.`, 'DeprecationWarning', code, fn)
-}
-
-const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n)
-
-/* istanbul ignore next - This is a little bit ridiculous, tbh.
- * The maximum array length is 2^32-1 or thereabouts on most JS impls.
- * And well before that point, you're caching the entire world, I mean,
- * that's ~32GB of just integers for the next/prev links, plus whatever
- * else to hold that many keys and values. Just filling the memory with
- * zeroes at init time is brutal when you get that big.
- * But why not be complete?
- * Maybe in the future, these limits will have expanded. */
-const getUintArray = max => !isPosInt(max) ? null
-: max <= Math.pow(2, 8) ? Uint8Array
-: max <= Math.pow(2, 16) ? Uint16Array
-: max <= Math.pow(2, 32) ? Uint32Array
-: max <= Number.MAX_SAFE_INTEGER ? ZeroArray
-: null
-
-class ZeroArray extends Array {
- constructor (size) {
- super(size)
- this.fill(0)
- }
-}
-
-class Stack {
- constructor (max) {
- const UintArray = getUintArray(max)
- this.heap = new UintArray(max)
- this.length = 0
- }
- push (n) {
- this.heap[this.length++] = n
- }
- pop () {
- return this.heap[--this.length]
- }
-}
-
-class LRUCache {
- constructor (options = {}) {
- const {
- max,
- ttl,
- ttlResolution = 1,
- ttlAutopurge,
- updateAgeOnGet,
- allowStale,
- dispose,
- disposeAfter,
- noDisposeOnSet,
- noUpdateTTL,
- maxSize,
- sizeCalculation,
- } = options
-
- // deprecated options, don't trigger a warning for getting them if
- // the thing being passed in is another LRUCache we're copying.
- const {
- length,
- maxAge,
- stale,
- } = options instanceof LRUCache ? {} : options
-
- if (!isPosInt(max)) {
- throw new TypeError('max option must be an integer')
- }
-
- const UintArray = getUintArray(max)
- if (!UintArray) {
- throw new Error('invalid max value: ' + max)
- }
-
- this.max = max
- this.maxSize = maxSize || 0
- this.sizeCalculation = sizeCalculation || length
- if (this.sizeCalculation) {
- if (!this.maxSize) {
- throw new TypeError('cannot set sizeCalculation without setting maxSize')
- }
- if (typeof this.sizeCalculation !== 'function') {
- throw new TypeError('sizeCalculating set to non-function')
- }
- }
- this.keyMap = new Map()
- this.keyList = new Array(max).fill(null)
- this.valList = new Array(max).fill(null)
- this.next = new UintArray(max)
- this.prev = new UintArray(max)
- this.head = 0
- this.tail = 0
- this.free = new Stack(max)
- this.initialFill = 1
- this.size = 0
-
- if (typeof dispose === 'function') {
- this.dispose = dispose
- }
- if (typeof disposeAfter === 'function') {
- this.disposeAfter = disposeAfter
- this.disposed = []
- } else {
- this.disposeAfter = null
- this.disposed = null
- }
- this.noDisposeOnSet = !!noDisposeOnSet
- this.noUpdateTTL = !!noUpdateTTL
-
- if (this.maxSize) {
- if (!isPosInt(this.maxSize)) {
- throw new TypeError('maxSize must be a positive integer if specified')
- }
- this.initializeSizeTracking()
- }
-
- this.allowStale = !!allowStale || !!stale
- this.updateAgeOnGet = !!updateAgeOnGet
- this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0
- ? ttlResolution : 1
- this.ttlAutopurge = !!ttlAutopurge
- this.ttl = ttl || maxAge || 0
- if (this.ttl) {
- if (!isPosInt(this.ttl)) {
- throw new TypeError('ttl must be a positive integer if specified')
- }
- this.initializeTTLTracking()
- }
-
- if (stale) {
- deprecatedOption('stale', 'allowStale')
- }
- if (maxAge) {
- deprecatedOption('maxAge', 'ttl')
- }
- if (length) {
- deprecatedOption('length', 'sizeCalculation')
- }
- }
-
- initializeTTLTracking () {
- this.ttls = new ZeroArray(this.max)
- this.starts = new ZeroArray(this.max)
- this.setItemTTL = (index, ttl) => {
- this.starts[index] = ttl !== 0 ? perf.now() : 0
- this.ttls[index] = ttl
- if (ttl !== 0 && this.ttlAutopurge) {
- const t = setTimeout(() => {
- if (this.isStale(index)) {
- this.delete(this.keyList[index])
- }
- }, ttl + 1)
- /* istanbul ignore else - unref() not supported on all platforms */
- if (t.unref) {
- t.unref()
- }
- }
- }
- this.updateItemAge = (index) => {
- this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0
- }
- // debounce calls to perf.now() to 1s so we're not hitting
- // that costly call repeatedly.
- let cachedNow = 0
- const getNow = () => {
- const n = perf.now()
- if (this.ttlResolution > 0) {
- cachedNow = n
- const t = setTimeout(() => cachedNow = 0, this.ttlResolution)
- /* istanbul ignore else - not available on all platforms */
- if (t.unref) {
- t.unref()
- }
- }
- return n
- }
- this.isStale = (index) => {
- return this.ttls[index] !== 0 && this.starts[index] !== 0 &&
- ((cachedNow || getNow()) - this.starts[index] > this.ttls[index])
- }
- }
- updateItemAge (index) {}
- setItemTTL (index, ttl) {}
- isStale (index) { return false }
-
- initializeSizeTracking () {
- this.calculatedSize = 0
- this.sizes = new ZeroArray(this.max)
- this.removeItemSize = index => this.calculatedSize -= this.sizes[index]
- this.addItemSize = (index, v, k, size, sizeCalculation) => {
- const s = size || (sizeCalculation ? sizeCalculation(v, k) : 0)
- this.sizes[index] = isPosInt(s) ? s : 0
- const maxSize = this.maxSize - this.sizes[index]
- while (this.calculatedSize > maxSize) {
- this.evict()
- }
- 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, sizeCalculation) {}
-
- *indexes () {
- if (this.size) {
- for (let i = this.tail; true; i = this.prev[i]) {
- if (!this.isStale(i)) {
- yield i
- }
- if (i === this.head) {
- break
- }
- }
- }
- }
- *rindexes () {
- if (this.size) {
- for (let i = this.head; true; i = this.next[i]) {
- if (!this.isStale(i)) {
- yield i
- }
- if (i === this.tail) {
- break
- }
- }
- }
- }
-
- *entries () {
- for (const i of this.indexes()) {
- yield [this.keyList[i], this.valList[i]]
- }
- }
-
- *keys () {
- for (const i of this.indexes()) {
- yield this.keyList[i]
- }
- }
-
- *values () {
- for (const i of this.indexes()) {
- yield this.valList[i]
- }
- }
-
- [Symbol.iterator] () {
- return this.entries()
- }
-
- find (fn, getOptions = {}) {
- for (const i of this.indexes()) {
- if (fn(this.valList[i], this.keyList[i], this)) {
- return this.get(this.keyList[i], getOptions)
- }
- }
- }
-
- forEach (fn, thisp = this) {
- for (const i of this.indexes()) {
- fn.call(thisp, this.valList[i], this.keyList[i], this)
- }
- }
-
- rforEach (fn, thisp = this) {
- for (const i of this.rindexes()) {
- fn.call(thisp, this.valList[i], this.keyList[i], this)
- }
- }
-
- get prune () {
- deprecatedMethod('prune', 'purgeStale')
- return this.purgeStale
- }
-
- purgeStale () {
- let deleted = false
- if (this.size) {
- for (let i = this.head; true; i = this.next[i]) {
- const b = i === this.tail
- if (this.isStale(i)) {
- this.delete(this.keyList[i])
- deleted = true
- }
- if (b) {
- break
- }
- }
- }
- return deleted
- }
-
- dump () {
- const arr = []
- for (const i of this.indexes()) {
- const key = this.keyList[i]
- const value = this.valList[i]
- const entry = { value }
- if (this.ttls) {
- entry.ttl = this.ttls[i]
- }
- if (this.sizes) {
- entry.size = this.sizes[i]
- }
- arr.unshift([key, entry])
- }
- return arr
- }
-
- load (arr) {
- this.clear()
- for (const [key, entry] of arr) {
- this.set(key, entry.value, entry)
- }
- }
-
- dispose (v, k, reason) {}
-
- set (k, v, {
- ttl = this.ttl,
- noDisposeOnSet = this.noDisposeOnSet,
- size = 0,
- sizeCalculation = this.sizeCalculation,
- noUpdateTTL = this.noUpdateTTL,
- } = {}) {
- let index = this.size === 0 ? undefined : this.keyMap.get(k)
- if (index === undefined) {
- // addition
- index = this.newIndex()
- this.keyList[index] = k
- this.valList[index] = v
- this.keyMap.set(k, index)
- this.next[this.tail] = index
- this.prev[index] = this.tail
- this.tail = index
- this.size ++
- this.addItemSize(index, v, k, size, sizeCalculation)
- noUpdateTTL = false
- } else {
- // update
- const oldVal = this.valList[index]
- if (v !== oldVal) {
- if (!noDisposeOnSet) {
- this.dispose(oldVal, k, 'set')
- if (this.disposeAfter) {
- this.disposed.push([oldVal, k, 'set'])
- }
- }
- this.removeItemSize(index)
- this.valList[index] = v
- this.addItemSize(index, v, k, size, sizeCalculation)
- }
- this.moveToTail(index)
- }
- if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
- this.initializeTTLTracking()
- }
- if (!noUpdateTTL) {
- this.setItemTTL(index, ttl)
- }
- if (this.disposeAfter) {
- while (this.disposed.length) {
- this.disposeAfter(...this.disposed.shift())
- }
- }
- return this
- }
-
- newIndex () {
- if (this.size === 0) {
- return this.tail
- }
- if (this.size === this.max) {
- return this.evict()
- }
- if (this.free.length !== 0) {
- return this.free.pop()
- }
- // initial fill, just keep writing down the list
- return this.initialFill++
- }
-
- pop () {
- if (this.size) {
- const val = this.valList[this.head]
- this.evict()
- return val
- }
- }
-
- evict () {
- const head = this.head
- const k = this.keyList[head]
- const v = this.valList[head]
- this.dispose(v, k, 'evict')
- if (this.disposeAfter) {
- this.disposed.push([v, k, 'evict'])
- }
- this.removeItemSize(head)
- this.head = this.next[head]
- this.keyMap.delete(k)
- this.size --
- return head
- }
-
- has (k) {
- return this.keyMap.has(k) && !this.isStale(this.keyMap.get(k))
- }
-
- // like get(), but without any LRU updating or TTL expiration
- peek (k, { allowStale = this.allowStale } = {}) {
- const index = this.keyMap.get(k)
- if (index !== undefined && (allowStale || !this.isStale(index))) {
- return this.valList[index]
- }
- }
-
- get (k, {
- allowStale = this.allowStale,
- updateAgeOnGet = this.updateAgeOnGet,
- } = {}) {
- const index = this.keyMap.get(k)
- if (index !== undefined) {
- if (this.isStale(index)) {
- const value = allowStale ? this.valList[index] : undefined
- this.delete(k)
- return value
- } else {
- this.moveToTail(index)
- if (updateAgeOnGet) {
- this.updateItemAge(index)
- }
- return this.valList[index]
- }
- }
- }
-
- connect (p, n) {
- this.prev[n] = p
- this.next[p] = n
- }
-
- moveToTail (index) {
- // if tail already, nothing to do
- // if head, move head to next[index]
- // else
- // move next[prev[index]] to next[index] (head has no prev)
- // move prev[next[index]] to prev[index]
- // prev[index] = tail
- // next[tail] = index
- // tail = index
- if (index !== this.tail) {
- if (index === this.head) {
- this.head = this.next[index]
- } else {
- this.connect(this.prev[index], this.next[index])
- }
- this.connect(this.tail, index)
- this.tail = index
- }
- }
-
- get del () {
- deprecatedMethod('del', 'delete')
- return this.delete
- }
- delete (k) {
- let deleted = false
- if (this.size !== 0) {
- const index = this.keyMap.get(k)
- if (index !== undefined) {
- deleted = true
- if (this.size === 1) {
- this.clear()
- } else {
- this.removeItemSize(index)
- this.dispose(this.valList[index], k, 'delete')
- if (this.disposeAfter) {
- this.disposed.push([this.valList[index], k, 'delete'])
- }
- this.keyMap.delete(k)
- this.keyList[index] = null
- this.valList[index] = null
- if (index === this.tail) {
- this.tail = this.prev[index]
- } else if (index === this.head) {
- this.head = this.next[index]
- } else {
- this.next[this.prev[index]] = this.next[index]
- this.prev[this.next[index]] = this.prev[index]
- }
- this.size --
- this.free.push(index)
- }
- }
- }
- if (this.disposed) {
- while (this.disposed.length) {
- this.disposeAfter(...this.disposed.shift())
- }
- }
- return deleted
- }
-
- clear () {
- if (this.dispose !== LRUCache.prototype.dispose) {
- for (const index of this.rindexes()) {
- this.dispose(this.valList[index], this.keyList[index], 'delete')
- }
- }
- if (this.disposeAfter) {
- for (const index of this.rindexes()) {
- this.disposed.push([this.valList[index], this.keyList[index], 'delete'])
- }
- }
- this.keyMap.clear()
- this.valList.fill(null)
- this.keyList.fill(null)
- if (this.ttls) {
- this.ttls.fill(0)
- this.starts.fill(0)
- }
- if (this.sizes) {
- this.sizes.fill(0)
- }
- this.head = 0
- this.tail = 0
- this.initialFill = 1
- this.free.length = 0
- this.calculatedSize = 0
- this.size = 0
- if (this.disposed) {
- while (this.disposed.length) {
- this.disposeAfter(...this.disposed.shift())
- }
- }
- }
- get reset () {
- deprecatedMethod('reset', 'clear')
- return this.clear
- }
-
- get length () {
- deprecatedProperty('length', 'size')
- return this.size
- }
-}
-
-module.exports = LRUCache
diff --git a/node_modules/@npmcli/git/node_modules/lru-cache/package.json b/node_modules/@npmcli/git/node_modules/lru-cache/package.json
deleted file mode 100644
index ae9211697..000000000
--- a/node_modules/@npmcli/git/node_modules/lru-cache/package.json
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "name": "lru-cache",
- "description": "A cache object that deletes the least-recently-used items.",
- "version": "7.4.0",
- "author": "Isaac Z. Schlueter <i@izs.me>",
- "keywords": [
- "mru",
- "lru",
- "cache"
- ],
- "scripts": {
- "prepare": "webpack-cli -o bundle ./index.js --node-env production",
- "build": "npm run prepare",
- "presize": "npm run prepare",
- "test": "tap",
- "snap": "tap",
- "size": "size-limit",
- "preversion": "npm test",
- "postversion": "npm publish",
- "prepublishOnly": "git push origin --follow-tags"
- },
- "main": "index.js",
- "browser": "./bundle/main.js",
- "exports": {
- ".": "./index.js",
- "./browser": "./bundle/main.js"
- },
- "repository": "git://github.com/isaacs/node-lru-cache.git",
- "devDependencies": {
- "@size-limit/preset-small-lib": "^7.0.8",
- "benchmark": "^2.1.4",
- "size-limit": "^7.0.8",
- "tap": "^15.1.6",
- "webpack-cli": "^4.9.2"
- },
- "license": "ISC",
- "files": [
- "index.js",
- "bundle"
- ],
- "engines": {
- "node": ">=12"
- },
- "tap": {
- "coverage-map": "map.js"
- },
- "size-limit": [
- {
- "path": "./bundle/main.js"
- }
- ]
-}
diff --git a/node_modules/cacache/lib/memoization.js b/node_modules/cacache/lib/memoization.js
index e1b13dd5f..cd25f2013 100644
--- a/node_modules/cacache/lib/memoization.js
+++ b/node_modules/cacache/lib/memoization.js
@@ -2,13 +2,11 @@
const LRU = require('lru-cache')
-const MAX_SIZE = 50 * 1024 * 1024 // 50MB
-const MAX_AGE = 3 * 60 * 1000
-
const MEMOIZED = new LRU({
- max: MAX_SIZE,
- maxAge: MAX_AGE,
- length: (entry, key) => key.startsWith('key:') ? entry.data.length : entry.length,
+ max: 500,
+ maxSize: 50 * 1024 * 1024, // 50MB
+ ttl: 3 * 60 * 1000, // 3 minutes
+ sizeCalculation: (entry, key) => key.startsWith('key:') ? entry.data.length : entry.length,
})
module.exports.clearMemoized = clearMemoized
diff --git a/node_modules/cacache/package.json b/node_modules/cacache/package.json
index b9efa92d9..1003230cd 100644
--- a/node_modules/cacache/package.json
+++ b/node_modules/cacache/package.json
@@ -1,6 +1,6 @@
{
"name": "cacache",
- "version": "16.0.0",
+ "version": "16.0.1",
"cache-version": {
"content": "2",
"index": "5"
@@ -50,10 +50,10 @@
"@npmcli/move-file": "^1.1.2",
"chownr": "^2.0.0",
"fs-minipass": "^2.1.0",
- "glob": "^7.1.4",
+ "glob": "^7.2.0",
"infer-owner": "^1.0.4",
- "lru-cache": "^6.0.0",
- "minipass": "^3.1.1",
+ "lru-cache": "^7.5.1",
+ "minipass": "^3.1.6",
"minipass-collect": "^1.0.2",
"minipass-flush": "^1.0.5",
"minipass-pipeline": "^1.2.4",
diff --git a/node_modules/hosted-git-info/node_modules/lru-cache/LICENSE b/node_modules/hosted-git-info/node_modules/lru-cache/LICENSE
deleted file mode 100644
index 9b58a3e03..000000000
--- a/node_modules/hosted-git-info/node_modules/lru-cache/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/hosted-git-info/node_modules/lru-cache/index.js b/node_modules/hosted-git-info/node_modules/lru-cache/index.js
deleted file mode 100644
index e37f51616..000000000
--- a/node_modules/hosted-git-info/node_modules/lru-cache/index.js
+++ /dev/null
@@ -1,615 +0,0 @@
-const perf = typeof performance === 'object' && performance &&
- typeof performance.now === 'function' ? performance : Date
-
-const warned = new Set()
-const deprecatedOption = (opt, instead) => {
- const code = `LRU_CACHE_OPTION_${opt}`
- if (shouldWarn(code)) {
- warn(code, `${opt} option`, `options.${instead}`, LRUCache)
- }
-}
-const deprecatedMethod = (method, instead) => {
- const code = `LRU_CACHE_METHOD_${method}`
- if (shouldWarn(code)) {
- const { prototype } = LRUCache
- const { get } = Object.getOwnPropertyDescriptor(prototype, method)
- warn(code, `${method} method`, `cache.${instead}()`, get)
- }
-}
-const deprecatedProperty = (field, instead) => {
- const code = `LRU_CACHE_PROPERTY_${field}`
- if (shouldWarn(code)) {
- const { prototype } = LRUCache
- const { get } = Object.getOwnPropertyDescriptor(prototype, field)
- warn(code, `${field} property`, `cache.${instead}`, get)
- }
-}
-const shouldWarn = (code) => typeof process === 'object' &&
- process &&
- !(process.noDeprecation || warned.has(code))
-const warn = (code, what, instead, fn) => {
- warned.add(code)
- process.emitWarning(`The ${what} is deprecated. Please use ${instead} instead.`, 'DeprecationWarning', code, fn)
-}
-
-const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n)
-
-/* istanbul ignore next - This is a little bit ridiculous, tbh.
- * The maximum array length is 2^32-1 or thereabouts on most JS impls.
- * And well before that point, you're caching the entire world, I mean,
- * that's ~32GB of just integers for the next/prev links, plus whatever
- * else to hold that many keys and values. Just filling the memory with
- * zeroes at init time is brutal when you get that big.
- * But why not be complete?
- * Maybe in the future, these limits will have expanded. */
-const getUintArray = max => !isPosInt(max) ? null
-: max <= Math.pow(2, 8) ? Uint8Array
-: max <= Math.pow(2, 16) ? Uint16Array
-: max <= Math.pow(2, 32) ? Uint32Array
-: max <= Number.MAX_SAFE_INTEGER ? ZeroArray
-: null
-
-class ZeroArray extends Array {
- constructor (size) {
- super(size)
- this.fill(0)
- }
-}
-
-class Stack {
- constructor (max) {
- const UintArray = getUintArray(max)
- this.heap = new UintArray(max)
- this.length = 0
- }
- push (n) {
- this.heap[this.length++] = n
- }
- pop () {
- return this.heap[--this.length]
- }
-}
-
-class LRUCache {
- constructor (options = {}) {
- const {
- max,
- ttl,
- ttlResolution = 1,
- ttlAutopurge,
- updateAgeOnGet,
- allowStale,
- dispose,
- disposeAfter,
- noDisposeOnSet,
- noUpdateTTL,
- maxSize,
- sizeCalculation,
- } = options
-
- // deprecated options, don't trigger a warning for getting them if
- // the thing being passed in is another LRUCache we're copying.
- const {
- length,
- maxAge,
- stale,
- } = options instanceof LRUCache ? {} : options
-
- if (!isPosInt(max)) {
- throw new TypeError('max option must be an integer')
- }
-
- const UintArray = getUintArray(max)
- if (!UintArray) {
- throw new Error('invalid max value: ' + max)
- }
-
- this.max = max
- this.maxSize = maxSize || 0
- this.sizeCalculation = sizeCalculation || length
- if (this.sizeCalculation) {
- if (!this.maxSize) {
- throw new TypeError('cannot set sizeCalculation without setting maxSize')
- }
- if (typeof this.sizeCalculation !== 'function') {
- throw new TypeError('sizeCalculating set to non-function')
- }
- }
- this.keyMap = new Map()
- this.keyList = new Array(max).fill(null)
- this.valList = new Array(max).fill(null)
- this.next = new UintArray(max)
- this.prev = new UintArray(max)
- this.head = 0
- this.tail = 0
- this.free = new Stack(max)
- this.initialFill = 1
- this.size = 0
-
- if (typeof dispose === 'function') {
- this.dispose = dispose
- }
- if (typeof disposeAfter === 'function') {
- this.disposeAfter = disposeAfter
- this.disposed = []
- } else {
- this.disposeAfter = null
- this.disposed = null
- }
- this.noDisposeOnSet = !!noDisposeOnSet
- this.noUpdateTTL = !!noUpdateTTL
-
- if (this.maxSize) {
- if (!isPosInt(this.maxSize)) {
- throw new TypeError('maxSize must be a positive integer if specified')
- }
- this.initializeSizeTracking()
- }
-
- this.allowStale = !!allowStale || !!stale
- this.updateAgeOnGet = !!updateAgeOnGet
- this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0
- ? ttlResolution : 1
- this.ttlAutopurge = !!ttlAutopurge
- this.ttl = ttl || maxAge || 0
- if (this.ttl) {
- if (!isPosInt(this.ttl)) {
- throw new TypeError('ttl must be a positive integer if specified')
- }
- this.initializeTTLTracking()
- }
-
- if (stale) {
- deprecatedOption('stale', 'allowStale')
- }
- if (maxAge) {
- deprecatedOption('maxAge', 'ttl')
- }
- if (length) {
- deprecatedOption('length', 'sizeCalculation')
- }
- }
-
- initializeTTLTracking () {
- this.ttls = new ZeroArray(this.max)
- this.starts = new ZeroArray(this.max)
- this.setItemTTL = (index, ttl) => {
- this.starts[index] = ttl !== 0 ? perf.now() : 0
- this.ttls[index] = ttl
- if (ttl !== 0 && this.ttlAutopurge) {
- const t = setTimeout(() => {
- if (this.isStale(index)) {
- this.delete(this.keyList[index])
- }
- }, ttl + 1)
- /* istanbul ignore else - unref() not supported on all platforms */
- if (t.unref) {
- t.unref()
- }
- }
- }
- this.updateItemAge = (index) => {
- this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0
- }
- // debounce calls to perf.now() to 1s so we're not hitting
- // that costly call repeatedly.
- let cachedNow = 0
- const getNow = () => {
- const n = perf.now()
- if (this.ttlResolution > 0) {
- cachedNow = n
- const t = setTimeout(() => cachedNow = 0, this.ttlResolution)
- /* istanbul ignore else - not available on all platforms */
- if (t.unref) {
- t.unref()
- }
- }
- return n
- }
- this.isStale = (index) => {
- return this.ttls[index] !== 0 && this.starts[index] !== 0 &&
- ((cachedNow || getNow()) - this.starts[index] > this.ttls[index])
- }
- }
- updateItemAge (index) {}
- setItemTTL (index, ttl) {}
- isStale (index) { return false }
-
- initializeSizeTracking () {
- this.calculatedSize = 0
- this.sizes = new ZeroArray(this.max)
- this.removeItemSize = index => this.calculatedSize -= this.sizes[index]
- this.addItemSize = (index, v, k, size, sizeCalculation) => {
- const s = size || (sizeCalculation ? sizeCalculation(v, k) : 0)
- this.sizes[index] = isPosInt(s) ? s : 0
- const maxSize = this.maxSize - this.sizes[index]
- while (this.calculatedSize > maxSize) {
- this.evict()
- }
- 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, sizeCalculation) {}
-
- *indexes ({ allowStale = this.allowStale } = {}) {
- if (this.size) {
- for (let i = this.tail, j; true; ) {
- if (!this.isValidIndex(i)) {
- break
- }
- j = i === this.head
- if (allowStale || !this.isStale(i)) {
- yield i
- }
- if (i === this.head) {
- break
- } else {
- i = this.prev[i]
- }
- }
- }
- }
-
- *rindexes ({ allowStale = this.allowStale } = {}) {
- if (this.size) {
- for (let i = this.head, j; true; ) {
- if (!this.isValidIndex(i)) {
- break
- }
- if (allowStale || !this.isStale(i)) {
- yield i
- }
- // either the tail now, or WAS the tail, and deleted
- if (i === this.tail) {
- break
- } else {
- i = this.next[i]
- }
- }
- }
- }
-
- isValidIndex (index) {
- return this.keyMap.get(this.keyList[index]) === index
- }
-
- *entries () {
- for (const i of this.indexes()) {
- yield [this.keyList[i], this.valList[i]]
- }
- }
- *rentries () {
- for (const i of this.rindexes()) {
- yield [this.keyList[i], this.valList[i]]
- }
- }
-
- *keys () {
- for (const i of this.indexes()) {
- yield this.keyList[i]
- }
- }
- *rkeys () {
- for (const i of this.rindexes()) {
- yield this.keyList[i]
- }
- }
-
- *values () {
- for (const i of this.indexes()) {
- yield this.valList[i]
- }
- }
- *rvalues () {
- for (const i of this.rindexes()) {
- yield this.valList[i]
- }
- }
-
- [Symbol.iterator] () {
- return this.entries()
- }
-
- find (fn, getOptions = {}) {
- for (const i of this.indexes()) {
- if (fn(this.valList[i], this.keyList[i], this)) {
- return this.get(this.keyList[i], getOptions)
- }
- }
- }
-
- forEach (fn, thisp = this) {
- for (const i of this.indexes()) {
- fn.call(thisp, this.valList[i], this.keyList[i], this)
- }
- }
-
- rforEach (fn, thisp = this) {
- for (const i of this.rindexes()) {
- fn.call(thisp, this.valList[i], this.keyList[i], this)
- }
- }
-
- get prune () {
- deprecatedMethod('prune', 'purgeStale')
- return this.purgeStale
- }
-
- purgeStale () {
- let deleted = false
- for (const i of this.rindexes({ allowStale: true })) {
- if (this.isStale(i)) {
- this.delete(this.keyList[i])
- deleted = true
- }
- }
- return deleted
- }
-
- dump () {
- const arr = []
- for (const i of this.indexes()) {
- const key = this.keyList[i]
- const value = this.valList[i]
- const entry = { value }
- if (this.ttls) {
- entry.ttl = this.ttls[i]
- }
- if (this.sizes) {
- entry.size = this.sizes[i]
- }
- arr.unshift([key, entry])
- }
- return arr
- }
-
- load (arr) {
- this.clear()
- for (const [key, entry] of arr) {
- this.set(key, entry.value, entry)
- }
- }
-
- dispose (v, k, reason) {}
-
- set (k, v, {
- ttl = this.ttl,
- noDisposeOnSet = this.noDisposeOnSet,
- size = 0,
- sizeCalculation = this.sizeCalculation,
- noUpdateTTL = this.noUpdateTTL,
- } = {}) {
- let index = this.size === 0 ? undefined : this.keyMap.get(k)
- if (index === undefined) {
- // addition
- index = this.newIndex()
- this.keyList[index] = k
- this.valList[index] = v
- this.keyMap.set(k, index)
- this.next[this.tail] = index
- this.prev[index] = this.tail
- this.tail = index
- this.size ++
- this.addItemSize(index, v, k, size, sizeCalculation)
- noUpdateTTL = false
- } else {
- // update
- const oldVal = this.valList[index]
- if (v !== oldVal) {
- if (!noDisposeOnSet) {
- this.dispose(oldVal, k, 'set')
- if (this.disposeAfter) {
- this.disposed.push([oldVal, k, 'set'])
- }
- }
- this.removeItemSize(index)
- this.valList[index] = v
- this.addItemSize(index, v, k, size, sizeCalculation)
- }
- this.moveToTail(index)
- }
- if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
- this.initializeTTLTracking()
- }
- if (!noUpdateTTL) {
- this.setItemTTL(index, ttl)
- }
- if (this.disposeAfter) {
- while (this.disposed.length) {
- this.disposeAfter(...this.disposed.shift())
- }
- }
- return this
- }
-
- newIndex () {
- if (this.size === 0) {
- return this.tail
- }
- if (this.size === this.max) {
- return this.evict()
- }
- if (this.free.length !== 0) {
- return this.free.pop()
- }
- // initial fill, just keep writing down the list
- return this.initialFill++
- }
-
- pop () {
- if (this.size) {
- const val = this.valList[this.head]
- this.evict()
- return val
- }
- }
-
- evict () {
- const head = this.head
- const k = this.keyList[head]
- const v = this.valList[head]
- this.dispose(v, k, 'evict')
- if (this.disposeAfter) {
- this.disposed.push([v, k, 'evict'])
- }
- this.removeItemSize(head)
- this.head = this.next[head]
- this.keyMap.delete(k)
- this.size --
- return head
- }
-
- has (k) {
- return this.keyMap.has(k) && !this.isStale(this.keyMap.get(k))
- }
-
- // like get(), but without any LRU updating or TTL expiration
- peek (k, { allowStale = this.allowStale } = {}) {
- const index = this.keyMap.get(k)
- if (index !== undefined && (allowStale || !this.isStale(index))) {
- return this.valList[index]
- }
- }
-
- get (k, {
- allowStale = this.allowStale,
- updateAgeOnGet = this.updateAgeOnGet,
- } = {}) {
- const index = this.keyMap.get(k)
- if (index !== undefined) {
- if (this.isStale(index)) {
- const value = allowStale ? this.valList[index] : undefined
- this.delete(k)
- return value
- } else {
- this.moveToTail(index)
- if (updateAgeOnGet) {
- this.updateItemAge(index)
- }
- return this.valList[index]
- }
- }
- }
-
- connect (p, n) {
- this.prev[n] = p
- this.next[p] = n
- }
-
- moveToTail (index) {
- // if tail already, nothing to do
- // if head, move head to next[index]
- // else
- // move next[prev[index]] to next[index] (head has no prev)
- // move prev[next[index]] to prev[index]
- // prev[index] = tail
- // next[tail] = index
- // tail = index
- if (index !== this.tail) {
- if (index === this.head) {
- this.head = this.next[index]
- } else {
- this.connect(this.prev[index], this.next[index])
- }
- this.connect(this.tail, index)
- this.tail = index
- }
- }
-
- get del () {
- deprecatedMethod('del', 'delete')
- return this.delete
- }
- delete (k) {
- let deleted = false
- if (this.size !== 0) {
- const index = this.keyMap.get(k)
- if (index !== undefined) {
- deleted = true
- if (this.size === 1) {
- this.clear()
- } else {
- this.removeItemSize(index)
- this.dispose(this.valList[index], k, 'delete')
- if (this.disposeAfter) {
- this.disposed.push([this.valList[index], k, 'delete'])
- }
- this.keyMap.delete(k)
- this.keyList[index] = null
- this.valList[index] = null
- if (index === this.tail) {
- this.tail = this.prev[index]
- } else if (index === this.head) {
- this.head = this.next[index]
- } else {
- this.next[this.prev[index]] = this.next[index]
- this.prev[this.next[index]] = this.prev[index]
- }
- this.size --
- this.free.push(index)
- }
- }
- }
- if (this.disposed) {
- while (this.disposed.length) {
- this.disposeAfter(...this.disposed.shift())
- }
- }
- return deleted
- }
-
- clear () {
- if (this.dispose !== LRUCache.prototype.dispose) {
- for (const index of this.rindexes({ allowStale: true })) {
- this.dispose(this.valList[index], this.keyList[index], 'delete')
- }
- }
- if (this.disposeAfter) {
- for (const index of this.rindexes({ allowStale: true })) {
- this.disposed.push([this.valList[index], this.keyList[index], 'delete'])
- }
- }
- this.keyMap.clear()
- this.valList.fill(null)
- this.keyList.fill(null)
- if (this.ttls) {
- this.ttls.fill(0)
- this.starts.fill(0)
- }
- if (this.sizes) {
- this.sizes.fill(0)
- }
- this.head = 0
- this.tail = 0
- this.initialFill = 1
- this.free.length = 0
- this.calculatedSize = 0
- this.size = 0
- if (this.disposed) {
- while (this.disposed.length) {
- this.disposeAfter(...this.disposed.shift())
- }
- }
- }
- get reset () {
- deprecatedMethod('reset', 'clear')
- return this.clear
- }
-
- get length () {
- deprecatedProperty('length', 'size')
- return this.size
- }
-}
-
-module.exports = LRUCache
diff --git a/node_modules/lru-cache/LICENSE b/node_modules/lru-cache/LICENSE
index 19129e315..9b58a3e03 100644
--- a/node_modules/lru-cache/LICENSE
+++ b/node_modules/lru-cache/LICENSE
@@ -1,6 +1,6 @@
The ISC License
-Copyright (c) Isaac Z. Schlueter and Contributors
+Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/node_modules/lru-cache/index.js b/node_modules/lru-cache/index.js
index 573b6b85b..e37f51616 100644
--- a/node_modules/lru-cache/index.js
+++ b/node_modules/lru-cache/index.js
@@ -1,334 +1,615 @@
-'use strict'
-
-// A linked list to keep track of recently-used-ness
-const Yallist = require('yallist')
-
-const MAX = Symbol('max')
-const LENGTH = Symbol('length')
-const LENGTH_CALCULATOR = Symbol('lengthCalculator')
-const ALLOW_STALE = Symbol('allowStale')
-const MAX_AGE = Symbol('maxAge')
-const DISPOSE = Symbol('dispose')
-const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
-const LRU_LIST = Symbol('lruList')
-const CACHE = Symbol('cache')
-const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
-
-const naiveLength = () => 1
-
-// lruList is a yallist where the head is the youngest
-// item, and the tail is the oldest. the list contains the Hit
-// objects as the entries.
-// Each Hit object has a reference to its Yallist.Node. This
-// never changes.
-//
-// cache is a Map (or PseudoMap) that matches the keys to
-// the Yallist.Node object.
-class LRUCache {
- constructor (options) {
- if (typeof options === 'number')
- options = { max: options }
-
- if (!options)
- options = {}
-
- if (options.max && (typeof options.max !== 'number' || options.max < 0))
- throw new TypeError('max must be a non-negative number')
- // Kind of weird to have a default max of Infinity, but oh well.
- const max = this[MAX] = options.max || Infinity
-
- const lc = options.length || naiveLength
- this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
- this[ALLOW_STALE] = options.stale || false
- if (options.maxAge && typeof options.maxAge !== 'number')
- throw new TypeError('maxAge must be a number')
- this[MAX_AGE] = options.maxAge || 0
- this[DISPOSE] = options.dispose
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
- this.reset()
+const perf = typeof performance === 'object' && performance &&
+ typeof performance.now === 'function' ? performance : Date
+
+const warned = new Set()
+const deprecatedOption = (opt, instead) => {
+ const code = `LRU_CACHE_OPTION_${opt}`
+ if (shouldWarn(code)) {
+ warn(code, `${opt} option`, `options.${instead}`, LRUCache)
}
-
- // resize the cache when the max changes.
- set max (mL) {
- if (typeof mL !== 'number' || mL < 0)
- throw new TypeError('max must be a non-negative number')
-
- this[MAX] = mL || Infinity
- trim(this)
+}
+const deprecatedMethod = (method, instead) => {
+ const code = `LRU_CACHE_METHOD_${method}`
+ if (shouldWarn(code)) {
+ const { prototype } = LRUCache
+ const { get } = Object.getOwnPropertyDescriptor(prototype, method)
+ warn(code, `${method} method`, `cache.${instead}()`, get)
}
- get max () {
- return this[MAX]
+}
+const deprecatedProperty = (field, instead) => {
+ const code = `LRU_CACHE_PROPERTY_${field}`
+ if (shouldWarn(code)) {
+ const { prototype } = LRUCache
+ const { get } = Object.getOwnPropertyDescriptor(prototype, field)
+ warn(code, `${field} property`, `cache.${instead}`, get)
}
+}
+const shouldWarn = (code) => typeof process === 'object' &&
+ process &&
+ !(process.noDeprecation || warned.has(code))
+const warn = (code, what, instead, fn) => {
+ warned.add(code)
+ process.emitWarning(`The ${what} is deprecated. Please use ${instead} instead.`, 'DeprecationWarning', code, fn)
+}
- set allowStale (allowStale) {
- this[ALLOW_STALE] = !!allowStale
- }
- get allowStale () {
- return this[ALLOW_STALE]
+const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n)
+
+/* istanbul ignore next - This is a little bit ridiculous, tbh.
+ * The maximum array length is 2^32-1 or thereabouts on most JS impls.
+ * And well before that point, you're caching the entire world, I mean,
+ * that's ~32GB of just integers for the next/prev links, plus whatever
+ * else to hold that many keys and values. Just filling the memory with
+ * zeroes at init time is brutal when you get that big.
+ * But why not be complete?
+ * Maybe in the future, these limits will have expanded. */
+const getUintArray = max => !isPosInt(max) ? null
+: max <= Math.pow(2, 8) ? Uint8Array
+: max <= Math.pow(2, 16) ? Uint16Array
+: max <= Math.pow(2, 32) ? Uint32Array
+: max <= Number.MAX_SAFE_INTEGER ? ZeroArray
+: null
+
+class ZeroArray extends Array {
+ constructor (size) {
+ super(size)
+ this.fill(0)
}
+}
- set maxAge (mA) {
- if (typeof mA !== 'number')
- throw new TypeError('maxAge must be a non-negative number')
-
- this[MAX_AGE] = mA
- trim(this)
+class Stack {
+ constructor (max) {
+ const UintArray = getUintArray(max)
+ this.heap = new UintArray(max)
+ this.length = 0
}
- get maxAge () {
- return this[MAX_AGE]
+ push (n) {
+ this.heap[this.length++] = n
}
+ pop () {
+ return this.heap[--this.length]
+ }
+}
- // resize the cache when the lengthCalculator changes.
- set lengthCalculator (lC) {
- if (typeof lC !== 'function')
- lC = naiveLength
+class LRUCache {
+ constructor (options = {}) {
+ const {
+ max,
+ ttl,
+ ttlResolution = 1,
+ ttlAutopurge,
+ updateAgeOnGet,
+ allowStale,
+ dispose,
+ disposeAfter,
+ noDisposeOnSet,
+ noUpdateTTL,
+ maxSize,
+ sizeCalculation,
+ } = options
+
+ // deprecated options, don't trigger a warning for getting them if
+ // the thing being passed in is another LRUCache we're copying.
+ const {
+ length,
+ maxAge,
+ stale,
+ } = options instanceof LRUCache ? {} : options
+
+ if (!isPosInt(max)) {
+ throw new TypeError('max option must be an integer')
+ }
- if (lC !== this[LENGTH_CALCULATOR]) {
- this[LENGTH_CALCULATOR] = lC
- this[LENGTH] = 0
- this[LRU_LIST].forEach(hit => {
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
- this[LENGTH] += hit.length
- })
+ const UintArray = getUintArray(max)
+ if (!UintArray) {
+ throw new Error('invalid max value: ' + max)
}
- trim(this)
- }
- get lengthCalculator () { return this[LENGTH_CALCULATOR] }
- get length () { return this[LENGTH] }
- get itemCount () { return this[LRU_LIST].length }
+ this.max = max
+ this.maxSize = maxSize || 0
+ this.sizeCalculation = sizeCalculation || length
+ if (this.sizeCalculation) {
+ if (!this.maxSize) {
+ throw new TypeError('cannot set sizeCalculation without setting maxSize')
+ }
+ if (typeof this.sizeCalculation !== 'function') {
+ throw new TypeError('sizeCalculating set to non-function')
+ }
+ }
+ this.keyMap = new Map()
+ this.keyList = new Array(max).fill(null)
+ this.valList = new Array(max).fill(null)
+ this.next = new UintArray(max)
+ this.prev = new UintArray(max)
+ this.head = 0
+ this.tail = 0
+ this.free = new Stack(max)
+ this.initialFill = 1
+ this.size = 0
+
+ if (typeof dispose === 'function') {
+ this.dispose = dispose
+ }
+ if (typeof disposeAfter === 'function') {
+ this.disposeAfter = disposeAfter
+ this.disposed = []
+ } else {
+ this.disposeAfter = null
+ this.disposed = null
+ }
+ this.noDisposeOnSet = !!noDisposeOnSet
+ this.noUpdateTTL = !!noUpdateTTL
- rforEach (fn, thisp) {
- thisp = thisp || this
- for (let walker = this[LRU_LIST].tail; walker !== null;) {
- const prev = walker.prev
- forEachStep(this, fn, walker, thisp)
- walker = prev
+ if (this.maxSize) {
+ if (!isPosInt(this.maxSize)) {
+ throw new TypeError('maxSize must be a positive integer if specified')
+ }
+ this.initializeSizeTracking()
}
- }
- forEach (fn, thisp) {
- thisp = thisp || this
- for (let walker = this[LRU_LIST].head; walker !== null;) {
- const next = walker.next
- forEachStep(this, fn, walker, thisp)
- walker = next
+ this.allowStale = !!allowStale || !!stale
+ this.updateAgeOnGet = !!updateAgeOnGet
+ this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0
+ ? ttlResolution : 1
+ this.ttlAutopurge = !!ttlAutopurge
+ this.ttl = ttl || maxAge || 0
+ if (this.ttl) {
+ if (!isPosInt(this.ttl)) {
+ throw new TypeError('ttl must be a positive integer if specified')
+ }
+ this.initializeTTLTracking()
}
- }
- keys () {
- return this[LRU_LIST].toArray().map(k => k.key)
+ if (stale) {
+ deprecatedOption('stale', 'allowStale')
+ }
+ if (maxAge) {
+ deprecatedOption('maxAge', 'ttl')
+ }
+ if (length) {
+ deprecatedOption('length', 'sizeCalculation')
+ }
}
- values () {
- return this[LRU_LIST].toArray().map(k => k.value)
+ initializeTTLTracking () {
+ this.ttls = new ZeroArray(this.max)
+ this.starts = new ZeroArray(this.max)
+ this.setItemTTL = (index, ttl) => {
+ this.starts[index] = ttl !== 0 ? perf.now() : 0
+ this.ttls[index] = ttl
+ if (ttl !== 0 && this.ttlAutopurge) {
+ const t = setTimeout(() => {
+ if (this.isStale(index)) {
+ this.delete(this.keyList[index])
+ }
+ }, ttl + 1)
+ /* istanbul ignore else - unref() not supported on all platforms */
+ if (t.unref) {
+ t.unref()
+ }
+ }
+ }
+ this.updateItemAge = (index) => {
+ this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0
+ }
+ // debounce calls to perf.now() to 1s so we're not hitting
+ // that costly call repeatedly.
+ let cachedNow = 0
+ const getNow = () => {
+ const n = perf.now()
+ if (this.ttlResolution > 0) {
+ cachedNow = n
+ const t = setTimeout(() => cachedNow = 0, this.ttlResolution)
+ /* istanbul ignore else - not available on all platforms */
+ if (t.unref) {
+ t.unref()
+ }
+ }
+ return n
+ }
+ this.isStale = (index) => {
+ return this.ttls[index] !== 0 && this.starts[index] !== 0 &&
+ ((cachedNow || getNow()) - this.starts[index] > this.ttls[index])
+ }
}
-
- reset () {
- if (this[DISPOSE] &&
- this[LRU_LIST] &&
- this[LRU_LIST].length) {
- this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
+ updateItemAge (index) {}
+ setItemTTL (index, ttl) {}
+ isStale (index) { return false }
+
+ initializeSizeTracking () {
+ this.calculatedSize = 0
+ this.sizes = new ZeroArray(this.max)
+ this.removeItemSize = index => this.calculatedSize -= this.sizes[index]
+ this.addItemSize = (index, v, k, size, sizeCalculation) => {
+ const s = size || (sizeCalculation ? sizeCalculation(v, k) : 0)
+ this.sizes[index] = isPosInt(s) ? s : 0
+ const maxSize = this.maxSize - this.sizes[index]
+ while (this.calculatedSize > maxSize) {
+ this.evict()
+ }
+ 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)
}
-
- this[CACHE] = new Map() // hash of items by key
- this[LRU_LIST] = new Yallist() // list of items in order of use recency
- this[LENGTH] = 0 // length of items in the list
}
-
- dump () {
- return this[LRU_LIST].map(hit =>
- isStale(this, hit) ? false : {
- k: hit.key,
- v: hit.value,
- e: hit.now + (hit.maxAge || 0)
- }).toArray().filter(h => h)
+ removeItemSize (index) {}
+ addItemSize (index, v, k, size, sizeCalculation) {}
+
+ *indexes ({ allowStale = this.allowStale } = {}) {
+ if (this.size) {
+ for (let i = this.tail, j; true; ) {
+ if (!this.isValidIndex(i)) {
+ break
+ }
+ j = i === this.head
+ if (allowStale || !this.isStale(i)) {
+ yield i
+ }
+ if (i === this.head) {
+ break
+ } else {
+ i = this.prev[i]
+ }
+ }
+ }
}
- dumpLru () {
- return this[LRU_LIST]
+ *rindexes ({ allowStale = this.allowStale } = {}) {
+ if (this.size) {
+ for (let i = this.head, j; true; ) {
+ if (!this.isValidIndex(i)) {
+ break
+ }
+ if (allowStale || !this.isStale(i)) {
+ yield i
+ }
+ // either the tail now, or WAS the tail, and deleted
+ if (i === this.tail) {
+ break
+ } else {
+ i = this.next[i]
+ }
+ }
+ }
}
- set (key, value, maxAge) {
- maxAge = maxAge || this[MAX_AGE]
+ isValidIndex (index) {
+ return this.keyMap.get(this.keyList[index]) === index
+ }
- if (maxAge && typeof maxAge !== 'number')
- throw new TypeError('maxAge must be a number')
+ *entries () {
+ for (const i of this.indexes()) {
+ yield [this.keyList[i], this.valList[i]]
+ }
+ }
+ *rentries () {
+ for (const i of this.rindexes()) {
+ yield [this.keyList[i], this.valList[i]]
+ }
+ }
- const now = maxAge ? Date.now() : 0
- const len = this[LENGTH_CALCULATOR](value, key)
+ *keys () {
+ for (const i of this.indexes()) {
+ yield this.keyList[i]
+ }
+ }
+ *rkeys () {
+ for (const i of this.rindexes()) {
+ yield this.keyList[i]
+ }
+ }
- if (this[CACHE].has(key)) {
- if (len > this[MAX]) {
- del(this, this[CACHE].get(key))
- return false
- }
+ *values () {
+ for (const i of this.indexes()) {
+ yield this.valList[i]
+ }
+ }
+ *rvalues () {
+ for (const i of this.rindexes()) {
+ yield this.valList[i]
+ }
+ }
- const node = this[CACHE].get(key)
- const item = node.value
+ [Symbol.iterator] () {
+ return this.entries()
+ }
- // dispose of the old one before overwriting
- // split out into 2 ifs for better coverage tracking
- if (this[DISPOSE]) {
- if (!this[NO_DISPOSE_ON_SET])
- this[DISPOSE](key, item.value)
+ find (fn, getOptions = {}) {
+ for (const i of this.indexes()) {
+ if (fn(this.valList[i], this.keyList[i], this)) {
+ return this.get(this.keyList[i], getOptions)
}
+ }
+ }
- item.now = now
- item.maxAge = maxAge
- item.value = value
- this[LENGTH] += len - item.length
- item.length = len
- this.get(key)
- trim(this)
- return true
+ forEach (fn, thisp = this) {
+ for (const i of this.indexes()) {
+ fn.call(thisp, this.valList[i], this.keyList[i], this)
}
+ }
- const hit = new Entry(key, value, len, now, maxAge)
+ rforEach (fn, thisp = this) {
+ for (const i of this.rindexes()) {
+ fn.call(thisp, this.valList[i], this.keyList[i], this)
+ }
+ }
- // oversized objects fall out of cache automatically.
- if (hit.length > this[MAX]) {
- if (this[DISPOSE])
- this[DISPOSE](key, value)
+ get prune () {
+ deprecatedMethod('prune', 'purgeStale')
+ return this.purgeStale
+ }
- return false
+ purgeStale () {
+ let deleted = false
+ for (const i of this.rindexes({ allowStale: true })) {
+ if (this.isStale(i)) {
+ this.delete(this.keyList[i])
+ deleted = true
+ }
}
+ return deleted
+ }
- this[LENGTH] += hit.length
- this[LRU_LIST].unshift(hit)
- this[CACHE].set(key, this[LRU_LIST].head)
- trim(this)
- return true
+ dump () {
+ const arr = []
+ for (const i of this.indexes()) {
+ const key = this.keyList[i]
+ const value = this.valList[i]
+ const entry = { value }
+ if (this.ttls) {
+ entry.ttl = this.ttls[i]
+ }
+ if (this.sizes) {
+ entry.size = this.sizes[i]
+ }
+ arr.unshift([key, entry])
+ }
+ return arr
}
- has (key) {
- if (!this[CACHE].has(key)) return false
- const hit = this[CACHE].get(key).value
- return !isStale(this, hit)
+ load (arr) {
+ this.clear()
+ for (const [key, entry] of arr) {
+ this.set(key, entry.value, entry)
+ }
}
- get (key) {
- return get(this, key, true)
+ dispose (v, k, reason) {}
+
+ set (k, v, {
+ ttl = this.ttl,
+ noDisposeOnSet = this.noDisposeOnSet,
+ size = 0,
+ sizeCalculation = this.sizeCalculation,
+ noUpdateTTL = this.noUpdateTTL,
+ } = {}) {
+ let index = this.size === 0 ? undefined : this.keyMap.get(k)
+ if (index === undefined) {
+ // addition
+ index = this.newIndex()
+ this.keyList[index] = k
+ this.valList[index] = v
+ this.keyMap.set(k, index)
+ this.next[this.tail] = index
+ this.prev[index] = this.tail
+ this.tail = index
+ this.size ++
+ this.addItemSize(index, v, k, size, sizeCalculation)
+ noUpdateTTL = false
+ } else {
+ // update
+ const oldVal = this.valList[index]
+ if (v !== oldVal) {
+ if (!noDisposeOnSet) {
+ this.dispose(oldVal, k, 'set')
+ if (this.disposeAfter) {
+ this.disposed.push([oldVal, k, 'set'])
+ }
+ }
+ this.removeItemSize(index)
+ this.valList[index] = v
+ this.addItemSize(index, v, k, size, sizeCalculation)
+ }
+ this.moveToTail(index)
+ }
+ if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
+ this.initializeTTLTracking()
+ }
+ if (!noUpdateTTL) {
+ this.setItemTTL(index, ttl)
+ }
+ if (this.disposeAfter) {
+ while (this.disposed.length) {
+ this.disposeAfter(...this.disposed.shift())
+ }
+ }
+ return this
}
- peek (key) {
- return get(this, key, false)
+ newIndex () {
+ if (this.size === 0) {
+ return this.tail
+ }
+ if (this.size === this.max) {
+ return this.evict()
+ }
+ if (this.free.length !== 0) {
+ return this.free.pop()
+ }
+ // initial fill, just keep writing down the list
+ return this.initialFill++
}
pop () {
- const node = this[LRU_LIST].tail
- if (!node)
- return null
+ if (this.size) {
+ const val = this.valList[this.head]
+ this.evict()
+ return val
+ }
+ }
+
+ evict () {
+ const head = this.head
+ const k = this.keyList[head]
+ const v = this.valList[head]
+ this.dispose(v, k, 'evict')
+ if (this.disposeAfter) {
+ this.disposed.push([v, k, 'evict'])
+ }
+ this.removeItemSize(head)
+ this.head = this.next[head]
+ this.keyMap.delete(k)
+ this.size --
+ return head
+ }
- del(this, node)
- return node.value
+ has (k) {
+ return this.keyMap.has(k) && !this.isStale(this.keyMap.get(k))
}
- del (key) {
- del(this, this[CACHE].get(key))
+ // like get(), but without any LRU updating or TTL expiration
+ peek (k, { allowStale = this.allowStale } = {}) {
+ const index = this.keyMap.get(k)
+ if (index !== undefined && (allowStale || !this.isStale(index))) {
+ return this.valList[index]
+ }
}
- load (arr) {
- // reset the cache
- this.reset()
-
- const now = Date.now()
- // A previous serialized cache has the most recent items first
- for (let l = arr.length - 1; l >= 0; l--) {
- const hit = arr[l]
- const expiresAt = hit.e || 0
- if (expiresAt === 0)
- // the item was created without expiration in a non aged cache
- this.set(hit.k, hit.v)
- else {
- const maxAge = expiresAt - now
- // dont add already expired items
- if (maxAge > 0) {
- this.set(hit.k, hit.v, maxAge)
+ get (k, {
+ allowStale = this.allowStale,
+ updateAgeOnGet = this.updateAgeOnGet,
+ } = {}) {
+ const index = this.keyMap.get(k)
+ if (index !== undefined) {
+ if (this.isStale(index)) {
+ const value = allowStale ? this.valList[index] : undefined
+ this.delete(k)
+ return value
+ } else {
+ this.moveToTail(index)
+ if (updateAgeOnGet) {
+ this.updateItemAge(index)
}
+ return this.valList[index]
}
}
}
- prune () {
- this[CACHE].forEach((value, key) => get(this, key, false))
+ connect (p, n) {
+ this.prev[n] = p
+ this.next[p] = n
}
-}
-const get = (self, key, doUse) => {
- const node = self[CACHE].get(key)
- if (node) {
- const hit = node.value
- if (isStale(self, hit)) {
- del(self, node)
- if (!self[ALLOW_STALE])
- return undefined
- } else {
- if (doUse) {
- if (self[UPDATE_AGE_ON_GET])
- node.value.now = Date.now()
- self[LRU_LIST].unshiftNode(node)
+ moveToTail (index) {
+ // if tail already, nothing to do
+ // if head, move head to next[index]
+ // else
+ // move next[prev[index]] to next[index] (head has no prev)
+ // move prev[next[index]] to prev[index]
+ // prev[index] = tail
+ // next[tail] = index
+ // tail = index
+ if (index !== this.tail) {
+ if (index === this.head) {
+ this.head = this.next[index]
+ } else {
+ this.connect(this.prev[index], this.next[index])
}
+ this.connect(this.tail, index)
+ this.tail = index
}
- return hit.value
}
-}
-
-const isStale = (self, hit) => {
- if (!hit || (!hit.maxAge && !self[MAX_AGE]))
- return false
- const diff = Date.now() - hit.now
- return hit.maxAge ? diff > hit.maxAge
- : self[MAX_AGE] && (diff > self[MAX_AGE])
-}
-
-const trim = self => {
- if (self[LENGTH] > self[MAX]) {
- for (let walker = self[LRU_LIST].tail;
- self[LENGTH] > self[MAX] && walker !== null;) {
- // We know that we're about to delete this one, and also
- // what the next least recently used key will be, so just
- // go ahead and set it now.
- const prev = walker.prev
- del(self, walker)
- walker = prev
+ get del () {
+ deprecatedMethod('del', 'delete')
+ return this.delete
+ }
+ delete (k) {
+ let deleted = false
+ if (this.size !== 0) {
+ const index = this.keyMap.get(k)
+ if (index !== undefined) {
+ deleted = true
+ if (this.size === 1) {
+ this.clear()
+ } else {
+ this.removeItemSize(index)
+ this.dispose(this.valList[index], k, 'delete')
+ if (this.disposeAfter) {
+ this.disposed.push([this.valList[index], k, 'delete'])
+ }
+ this.keyMap.delete(k)
+ this.keyList[index] = null
+ this.valList[index] = null
+ if (index === this.tail) {
+ this.tail = this.prev[index]
+ } else if (index === this.head) {
+ this.head = this.next[index]
+ } else {
+ this.next[this.prev[index]] = this.next[index]
+ this.prev[this.next[index]] = this.prev[index]
+ }
+ this.size --
+ this.free.push(index)
+ }
+ }
+ }
+ if (this.disposed) {
+ while (this.disposed.length) {
+ this.disposeAfter(...this.disposed.shift())
+ }
}
+ return deleted
}
-}
-const del = (self, node) => {
- if (node) {
- const hit = node.value
- if (self[DISPOSE])
- self[DISPOSE](hit.key, hit.value)
-
- self[LENGTH] -= hit.length
- self[CACHE].delete(hit.key)
- self[LRU_LIST].removeNode(node)
+ clear () {
+ if (this.dispose !== LRUCache.prototype.dispose) {
+ for (const index of this.rindexes({ allowStale: true })) {
+ this.dispose(this.valList[index], this.keyList[index], 'delete')
+ }
+ }
+ if (this.disposeAfter) {
+ for (const index of this.rindexes({ allowStale: true })) {
+ this.disposed.push([this.valList[index], this.keyList[index], 'delete'])
+ }
+ }
+ this.keyMap.clear()
+ this.valList.fill(null)
+ this.keyList.fill(null)
+ if (this.ttls) {
+ this.ttls.fill(0)
+ this.starts.fill(0)
+ }
+ if (this.sizes) {
+ this.sizes.fill(0)
+ }
+ this.head = 0
+ this.tail = 0
+ this.initialFill = 1
+ this.free.length = 0
+ this.calculatedSize = 0
+ this.size = 0
+ if (this.disposed) {
+ while (this.disposed.length) {
+ this.disposeAfter(...this.disposed.shift())
+ }
+ }
}
-}
-
-class Entry {
- constructor (key, value, length, now, maxAge) {
- this.key = key
- this.value = value
- this.length = length
- this.now = now
- this.maxAge = maxAge || 0
+ get reset () {
+ deprecatedMethod('reset', 'clear')
+ return this.clear
}
-}
-const forEachStep = (self, fn, node, thisp) => {
- let hit = node.value
- if (isStale(self, hit)) {
- del(self, node)
- if (!self[ALLOW_STALE])
- hit = undefined
+ get length () {
+ deprecatedProperty('length', 'size')
+ return this.size
}
- if (hit)
- fn.call(thisp, hit.value, hit.key, self)
}
module.exports = LRUCache
diff --git a/node_modules/lru-cache/package.json b/node_modules/lru-cache/package.json
index 43b7502c3..a62f74c2b 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": "6.0.0",
+ "version": "7.5.1",
"author": "Isaac Z. Schlueter <i@izs.me>",
"keywords": [
"mru",
@@ -9,8 +9,10 @@
"cache"
],
"scripts": {
+ "build": "",
"test": "tap",
"snap": "tap",
+ "size": "size-limit",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags"
@@ -18,17 +20,24 @@
"main": "index.js",
"repository": "git://github.com/isaacs/node-lru-cache.git",
"devDependencies": {
+ "@size-limit/preset-small-lib": "^7.0.8",
"benchmark": "^2.1.4",
- "tap": "^14.10.7"
+ "size-limit": "^7.0.8",
+ "tap": "^15.1.6"
},
"license": "ISC",
- "dependencies": {
- "yallist": "^4.0.0"
- },
"files": [
"index.js"
],
"engines": {
- "node": ">=10"
- }
+ "node": ">=12"
+ },
+ "tap": {
+ "coverage-map": "map.js"
+ },
+ "size-limit": [
+ {
+ "path": "./index.js"
+ }
+ ]
}
diff --git a/node_modules/make-fetch-happen/node_modules/lru-cache/LICENSE b/node_modules/make-fetch-happen/node_modules/lru-cache/LICENSE
deleted file mode 100644
index 9b58a3e03..000000000
--- a/node_modules/make-fetch-happen/node_modules/lru-cache/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/make-fetch-happen/node_modules/lru-cache/index.js b/node_modules/make-fetch-happen/node_modules/lru-cache/index.js
deleted file mode 100644
index e37f51616..000000000
--- a/node_modules/make-fetch-happen/node_modules/lru-cache/index.js
+++ /dev/null
@@ -1,615 +0,0 @@
-const perf = typeof performance === 'object' && performance &&
- typeof performance.now === 'function' ? performance : Date
-
-const warned = new Set()
-const deprecatedOption = (opt, instead) => {
- const code = `LRU_CACHE_OPTION_${opt}`
- if (shouldWarn(code)) {
- warn(code, `${opt} option`, `options.${instead}`, LRUCache)
- }
-}
-const deprecatedMethod = (method, instead) => {
- const code = `LRU_CACHE_METHOD_${method}`
- if (shouldWarn(code)) {
- const { prototype } = LRUCache
- const { get } = Object.getOwnPropertyDescriptor(prototype, method)
- warn(code, `${method} method`, `cache.${instead}()`, get)
- }
-}
-const deprecatedProperty = (field, instead) => {
- const code = `LRU_CACHE_PROPERTY_${field}`
- if (shouldWarn(code)) {
- const { prototype } = LRUCache
- const { get } = Object.getOwnPropertyDescriptor(prototype, field)
- warn(code, `${field} property`, `cache.${instead}`, get)
- }
-}
-const shouldWarn = (code) => typeof process === 'object' &&
- process &&
- !(process.noDeprecation || warned.has(code))
-const warn = (code, what, instead, fn) => {
- warned.add(code)
- process.emitWarning(`The ${what} is deprecated. Please use ${instead} instead.`, 'DeprecationWarning', code, fn)
-}
-
-const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n)
-
-/* istanbul ignore next - This is a little bit ridiculous, tbh.
- * The maximum array length is 2^32-1 or thereabouts on most JS impls.
- * And well before that point, you're caching the entire world, I mean,
- * that's ~32GB of just integers for the next/prev links, plus whatever
- * else to hold that many keys and values. Just filling the memory with
- * zeroes at init time is brutal when you get that big.
- * But why not be complete?
- * Maybe in the future, these limits will have expanded. */
-const getUintArray = max => !isPosInt(max) ? null
-: max <= Math.pow(2, 8) ? Uint8Array
-: max <= Math.pow(2, 16) ? Uint16Array
-: max <= Math.pow(2, 32) ? Uint32Array
-: max <= Number.MAX_SAFE_INTEGER ? ZeroArray
-: null
-
-class ZeroArray extends Array {
- constructor (size) {
- super(size)
- this.fill(0)
- }
-}
-
-class Stack {
- constructor (max) {
- const UintArray = getUintArray(max)
- this.heap = new UintArray(max)
- this.length = 0
- }
- push (n) {
- this.heap[this.length++] = n
- }
- pop () {
- return this.heap[--this.length]
- }
-}
-
-class LRUCache {
- constructor (options = {}) {
- const {
- max,
- ttl,
- ttlResolution = 1,
- ttlAutopurge,
- updateAgeOnGet,
- allowStale,
- dispose,
- disposeAfter,
- noDisposeOnSet,
- noUpdateTTL,
- maxSize,
- sizeCalculation,
- } = options
-
- // deprecated options, don't trigger a warning for getting them if
- // the thing being passed in is another LRUCache we're copying.
- const {
- length,
- maxAge,
- stale,
- } = options instanceof LRUCache ? {} : options
-
- if (!isPosInt(max)) {
- throw new TypeError('max option must be an integer')
- }
-
- const UintArray = getUintArray(max)
- if (!UintArray) {
- throw new Error('invalid max value: ' + max)
- }
-
- this.max = max
- this.maxSize = maxSize || 0
- this.sizeCalculation = sizeCalculation || length
- if (this.sizeCalculation) {
- if (!this.maxSize) {
- throw new TypeError('cannot set sizeCalculation without setting maxSize')
- }
- if (typeof this.sizeCalculation !== 'function') {
- throw new TypeError('sizeCalculating set to non-function')
- }
- }
- this.keyMap = new Map()
- this.keyList = new Array(max).fill(null)
- this.valList = new Array(max).fill(null)
- this.next = new UintArray(max)
- this.prev = new UintArray(max)
- this.head = 0
- this.tail = 0
- this.free = new Stack(max)
- this.initialFill = 1
- this.size = 0
-
- if (typeof dispose === 'function') {
- this.dispose = dispose
- }
- if (typeof disposeAfter === 'function') {
- this.disposeAfter = disposeAfter
- this.disposed = []
- } else {
- this.disposeAfter = null
- this.disposed = null
- }
- this.noDisposeOnSet = !!noDisposeOnSet
- this.noUpdateTTL = !!noUpdateTTL
-
- if (this.maxSize) {
- if (!isPosInt(this.maxSize)) {
- throw new TypeError('maxSize must be a positive integer if specified')
- }
- this.initializeSizeTracking()
- }
-
- this.allowStale = !!allowStale || !!stale
- this.updateAgeOnGet = !!updateAgeOnGet
- this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0
- ? ttlResolution : 1
- this.ttlAutopurge = !!ttlAutopurge
- this.ttl = ttl || maxAge || 0
- if (this.ttl) {
- if (!isPosInt(this.ttl)) {
- throw new TypeError('ttl must be a positive integer if specified')
- }
- this.initializeTTLTracking()
- }
-
- if (stale) {
- deprecatedOption('stale', 'allowStale')
- }
- if (maxAge) {
- deprecatedOption('maxAge', 'ttl')
- }
- if (length) {
- deprecatedOption('length', 'sizeCalculation')
- }
- }
-
- initializeTTLTracking () {
- this.ttls = new ZeroArray(this.max)
- this.starts = new ZeroArray(this.max)
- this.setItemTTL = (index, ttl) => {
- this.starts[index] = ttl !== 0 ? perf.now() : 0
- this.ttls[index] = ttl
- if (ttl !== 0 && this.ttlAutopurge) {
- const t = setTimeout(() => {
- if (this.isStale(index)) {
- this.delete(this.keyList[index])
- }
- }, ttl + 1)
- /* istanbul ignore else - unref() not supported on all platforms */
- if (t.unref) {
- t.unref()
- }
- }
- }
- this.updateItemAge = (index) => {
- this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0
- }
- // debounce calls to perf.now() to 1s so we're not hitting
- // that costly call repeatedly.
- let cachedNow = 0
- const getNow = () => {
- const n = perf.now()
- if (this.ttlResolution > 0) {
- cachedNow = n
- const t = setTimeout(() => cachedNow = 0, this.ttlResolution)
- /* istanbul ignore else - not available on all platforms */
- if (t.unref) {
- t.unref()
- }
- }
- return n
- }
- this.isStale = (index) => {
- return this.ttls[index] !== 0 && this.starts[index] !== 0 &&
- ((cachedNow || getNow()) - this.starts[index] > this.ttls[index])
- }
- }
- updateItemAge (index) {}
- setItemTTL (index, ttl) {}
- isStale (index) { return false }
-
- initializeSizeTracking () {
- this.calculatedSize = 0
- this.sizes = new ZeroArray(this.max)
- this.removeItemSize = index => this.calculatedSize -= this.sizes[index]
- this.addItemSize = (index, v, k, size, sizeCalculation) => {
- const s = size || (sizeCalculation ? sizeCalculation(v, k) : 0)
- this.sizes[index] = isPosInt(s) ? s : 0
- const maxSize = this.maxSize - this.sizes[index]
- while (this.calculatedSize > maxSize) {
- this.evict()
- }
- 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, sizeCalculation) {}
-
- *indexes ({ allowStale = this.allowStale } = {}) {
- if (this.size) {
- for (let i = this.tail, j; true; ) {
- if (!this.isValidIndex(i)) {
- break
- }
- j = i === this.head
- if (allowStale || !this.isStale(i)) {
- yield i
- }
- if (i === this.head) {
- break
- } else {
- i = this.prev[i]
- }
- }
- }
- }
-
- *rindexes ({ allowStale = this.allowStale } = {}) {
- if (this.size) {
- for (let i = this.head, j; true; ) {
- if (!this.isValidIndex(i)) {
- break
- }
- if (allowStale || !this.isStale(i)) {
- yield i
- }
- // either the tail now, or WAS the tail, and deleted
- if (i === this.tail) {
- break
- } else {
- i = this.next[i]
- }
- }
- }
- }
-
- isValidIndex (index) {
- return this.keyMap.get(this.keyList[index]) === index
- }
-
- *entries () {
- for (const i of this.indexes()) {
- yield [this.keyList[i], this.valList[i]]
- }
- }
- *rentries () {
- for (const i of this.rindexes()) {
- yield [this.keyList[i], this.valList[i]]
- }
- }
-
- *keys () {
- for (const i of this.indexes()) {
- yield this.keyList[i]
- }
- }
- *rkeys () {
- for (const i of this.rindexes()) {
- yield this.keyList[i]
- }
- }
-
- *values () {
- for (const i of this.indexes()) {
- yield this.valList[i]
- }
- }
- *rvalues () {
- for (const i of this.rindexes()) {
- yield this.valList[i]
- }
- }
-
- [Symbol.iterator] () {
- return this.entries()
- }
-
- find (fn, getOptions = {}) {
- for (const i of this.indexes()) {
- if (fn(this.valList[i], this.keyList[i], this)) {
- return this.get(this.keyList[i], getOptions)
- }
- }
- }
-
- forEach (fn, thisp = this) {
- for (const i of this.indexes()) {
- fn.call(thisp, this.valList[i], this.keyList[i], this)
- }
- }
-
- rforEach (fn, thisp = this) {
- for (const i of this.rindexes()) {
- fn.call(thisp, this.valList[i], this.keyList[i], this)
- }
- }
-
- get prune () {
- deprecatedMethod('prune', 'purgeStale')
- return this.purgeStale
- }
-
- purgeStale () {
- let deleted = false
- for (const i of this.rindexes({ allowStale: true })) {
- if (this.isStale(i)) {
- this.delete(this.keyList[i])
- deleted = true
- }
- }
- return deleted
- }
-
- dump () {
- const arr = []
- for (const i of this.indexes()) {
- const key = this.keyList[i]
- const value = this.valList[i]
- const entry = { value }
- if (this.ttls) {
- entry.ttl = this.ttls[i]
- }
- if (this.sizes) {
- entry.size = this.sizes[i]
- }
- arr.unshift([key, entry])
- }
- return arr
- }
-
- load (arr) {
- this.clear()
- for (const [key, entry] of arr) {
- this.set(key, entry.value, entry)
- }
- }
-
- dispose (v, k, reason) {}
-
- set (k, v, {
- ttl = this.ttl,
- noDisposeOnSet = this.noDisposeOnSet,
- size = 0,
- sizeCalculation = this.sizeCalculation,
- noUpdateTTL = this.noUpdateTTL,
- } = {}) {
- let index = this.size === 0 ? undefined : this.keyMap.get(k)
- if (index === undefined) {
- // addition
- index = this.newIndex()
- this.keyList[index] = k
- this.valList[index] = v
- this.keyMap.set(k, index)
- this.next[this.tail] = index
- this.prev[index] = this.tail
- this.tail = index
- this.size ++
- this.addItemSize(index, v, k, size, sizeCalculation)
- noUpdateTTL = false
- } else {
- // update
- const oldVal = this.valList[index]
- if (v !== oldVal) {
- if (!noDisposeOnSet) {
- this.dispose(oldVal, k, 'set')
- if (this.disposeAfter) {
- this.disposed.push([oldVal, k, 'set'])
- }
- }
- this.removeItemSize(index)
- this.valList[index] = v
- this.addItemSize(index, v, k, size, sizeCalculation)
- }
- this.moveToTail(index)
- }
- if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
- this.initializeTTLTracking()
- }
- if (!noUpdateTTL) {
- this.setItemTTL(index, ttl)
- }
- if (this.disposeAfter) {
- while (this.disposed.length) {
- this.disposeAfter(...this.disposed.shift())
- }
- }
- return this
- }
-
- newIndex () {
- if (this.size === 0) {
- return this.tail
- }
- if (this.size === this.max) {
- return this.evict()
- }
- if (this.free.length !== 0) {
- return this.free.pop()
- }
- // initial fill, just keep writing down the list
- return this.initialFill++
- }
-
- pop () {
- if (this.size) {
- const val = this.valList[this.head]
- this.evict()
- return val
- }
- }
-
- evict () {
- const head = this.head
- const k = this.keyList[head]
- const v = this.valList[head]
- this.dispose(v, k, 'evict')
- if (this.disposeAfter) {
- this.disposed.push([v, k, 'evict'])
- }
- this.removeItemSize(head)
- this.head = this.next[head]
- this.keyMap.delete(k)
- this.size --
- return head
- }
-
- has (k) {
- return this.keyMap.has(k) && !this.isStale(this.keyMap.get(k))
- }
-
- // like get(), but without any LRU updating or TTL expiration
- peek (k, { allowStale = this.allowStale } = {}) {
- const index = this.keyMap.get(k)
- if (index !== undefined && (allowStale || !this.isStale(index))) {
- return this.valList[index]
- }
- }
-
- get (k, {
- allowStale = this.allowStale,
- updateAgeOnGet = this.updateAgeOnGet,
- } = {}) {
- const index = this.keyMap.get(k)
- if (index !== undefined) {
- if (this.isStale(index)) {
- const value = allowStale ? this.valList[index] : undefined
- this.delete(k)
- return value
- } else {
- this.moveToTail(index)
- if (updateAgeOnGet) {
- this.updateItemAge(index)
- }
- return this.valList[index]
- }
- }
- }
-
- connect (p, n) {
- this.prev[n] = p
- this.next[p] = n
- }
-
- moveToTail (index) {
- // if tail already, nothing to do
- // if head, move head to next[index]
- // else
- // move next[prev[index]] to next[index] (head has no prev)
- // move prev[next[index]] to prev[index]
- // prev[index] = tail
- // next[tail] = index
- // tail = index
- if (index !== this.tail) {
- if (index === this.head) {
- this.head = this.next[index]
- } else {
- this.connect(this.prev[index], this.next[index])
- }
- this.connect(this.tail, index)
- this.tail = index
- }
- }
-
- get del () {
- deprecatedMethod('del', 'delete')
- return this.delete
- }
- delete (k) {
- let deleted = false
- if (this.size !== 0) {
- const index = this.keyMap.get(k)
- if (index !== undefined) {
- deleted = true
- if (this.size === 1) {
- this.clear()
- } else {
- this.removeItemSize(index)
- this.dispose(this.valList[index], k, 'delete')
- if (this.disposeAfter) {
- this.disposed.push([this.valList[index], k, 'delete'])
- }
- this.keyMap.delete(k)
- this.keyList[index] = null
- this.valList[index] = null
- if (index === this.tail) {
- this.tail = this.prev[index]
- } else if (index === this.head) {
- this.head = this.next[index]
- } else {
- this.next[this.prev[index]] = this.next[index]
- this.prev[this.next[index]] = this.prev[index]
- }
- this.size --
- this.free.push(index)
- }
- }
- }
- if (this.disposed) {
- while (this.disposed.length) {
- this.disposeAfter(...this.disposed.shift())
- }
- }
- return deleted
- }
-
- clear () {
- if (this.dispose !== LRUCache.prototype.dispose) {
- for (const index of this.rindexes({ allowStale: true })) {
- this.dispose(this.valList[index], this.keyList[index], 'delete')
- }
- }
- if (this.disposeAfter) {
- for (const index of this.rindexes({ allowStale: true })) {
- this.disposed.push([this.valList[index], this.keyList[index], 'delete'])
- }
- }
- this.keyMap.clear()
- this.valList.fill(null)
- this.keyList.fill(null)
- if (this.ttls) {
- this.ttls.fill(0)
- this.starts.fill(0)
- }
- if (this.sizes) {
- this.sizes.fill(0)
- }
- this.head = 0
- this.tail = 0
- this.initialFill = 1
- this.free.length = 0
- this.calculatedSize = 0
- this.size = 0
- if (this.disposed) {
- while (this.disposed.length) {
- this.disposeAfter(...this.disposed.shift())
- }
- }
- }
- get reset () {
- deprecatedMethod('reset', 'clear')
- return this.clear
- }
-
- get length () {
- deprecatedProperty('length', 'size')
- return this.size
- }
-}
-
-module.exports = LRUCache
diff --git a/node_modules/make-fetch-happen/node_modules/lru-cache/package.json b/node_modules/make-fetch-happen/node_modules/lru-cache/package.json
deleted file mode 100644
index a62f74c2b..000000000
--- a/node_modules/make-fetch-happen/node_modules/lru-cache/package.json
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "name": "lru-cache",
- "description": "A cache object that deletes the least-recently-used items.",
- "version": "7.5.1",
- "author": "Isaac Z. Schlueter <i@izs.me>",
- "keywords": [
- "mru",
- "lru",
- "cache"
- ],
- "scripts": {
- "build": "",
- "test": "tap",
- "snap": "tap",
- "size": "size-limit",
- "preversion": "npm test",
- "postversion": "npm publish",
- "prepublishOnly": "git push origin --follow-tags"
- },
- "main": "index.js",
- "repository": "git://github.com/isaacs/node-lru-cache.git",
- "devDependencies": {
- "@size-limit/preset-small-lib": "^7.0.8",
- "benchmark": "^2.1.4",
- "size-limit": "^7.0.8",
- "tap": "^15.1.6"
- },
- "license": "ISC",
- "files": [
- "index.js"
- ],
- "engines": {
- "node": ">=12"
- },
- "tap": {
- "coverage-map": "map.js"
- },
- "size-limit": [
- {
- "path": "./index.js"
- }
- ]
-}
diff --git a/node_modules/@npmcli/git/node_modules/lru-cache/LICENSE b/node_modules/semver/node_modules/lru-cache/LICENSE
index 9b58a3e03..19129e315 100644
--- a/node_modules/@npmcli/git/node_modules/lru-cache/LICENSE
+++ b/node_modules/semver/node_modules/lru-cache/LICENSE
@@ -1,6 +1,6 @@
The ISC License
-Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors
+Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/node_modules/semver/node_modules/lru-cache/index.js b/node_modules/semver/node_modules/lru-cache/index.js
new file mode 100644
index 000000000..573b6b85b
--- /dev/null
+++ b/node_modules/semver/node_modules/lru-cache/index.js
@@ -0,0 +1,334 @@
+'use strict'
+
+// A linked list to keep track of recently-used-ness
+const Yallist = require('yallist')
+
+const MAX = Symbol('max')
+const LENGTH = Symbol('length')
+const LENGTH_CALCULATOR = Symbol('lengthCalculator')
+const ALLOW_STALE = Symbol('allowStale')
+const MAX_AGE = Symbol('maxAge')
+const DISPOSE = Symbol('dispose')
+const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
+const LRU_LIST = Symbol('lruList')
+const CACHE = Symbol('cache')
+const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
+
+const naiveLength = () => 1
+
+// lruList is a yallist where the head is the youngest
+// item, and the tail is the oldest. the list contains the Hit
+// objects as the entries.
+// Each Hit object has a reference to its Yallist.Node. This
+// never changes.
+//
+// cache is a Map (or PseudoMap) that matches the keys to
+// the Yallist.Node object.
+class LRUCache {
+ constructor (options) {
+ if (typeof options === 'number')
+ options = { max: options }
+
+ if (!options)
+ options = {}
+
+ if (options.max && (typeof options.max !== 'number' || options.max < 0))
+ throw new TypeError('max must be a non-negative number')
+ // Kind of weird to have a default max of Infinity, but oh well.
+ const max = this[MAX] = options.max || Infinity
+
+ const lc = options.length || naiveLength
+ this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
+ this[ALLOW_STALE] = options.stale || false
+ if (options.maxAge && typeof options.maxAge !== 'number')
+ throw new TypeError('maxAge must be a number')
+ this[MAX_AGE] = options.maxAge || 0
+ this[DISPOSE] = options.dispose
+ this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
+ this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
+ this.reset()
+ }
+
+ // resize the cache when the max changes.
+ set max (mL) {
+ if (typeof mL !== 'number' || mL < 0)
+ throw new TypeError('max must be a non-negative number')
+
+ this[MAX] = mL || Infinity
+ trim(this)
+ }
+ get max () {
+ return this[MAX]
+ }
+
+ set allowStale (allowStale) {
+ this[ALLOW_STALE] = !!allowStale
+ }
+ get allowStale () {
+ return this[ALLOW_STALE]
+ }
+
+ set maxAge (mA) {
+ if (typeof mA !== 'number')
+ throw new TypeError('maxAge must be a non-negative number')
+
+ this[MAX_AGE] = mA
+ trim(this)
+ }
+ get maxAge () {
+ return this[MAX_AGE]
+ }
+
+ // resize the cache when the lengthCalculator changes.
+ set lengthCalculator (lC) {
+ if (typeof lC !== 'function')
+ lC = naiveLength
+
+ if (lC !== this[LENGTH_CALCULATOR]) {
+ this[LENGTH_CALCULATOR] = lC
+ this[LENGTH] = 0
+ this[LRU_LIST].forEach(hit => {
+ hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
+ this[LENGTH] += hit.length
+ })
+ }
+ trim(this)
+ }
+ get lengthCalculator () { return this[LENGTH_CALCULATOR] }
+
+ get length () { return this[LENGTH] }
+ get itemCount () { return this[LRU_LIST].length }
+
+ rforEach (fn, thisp) {
+ thisp = thisp || this
+ for (let walker = this[LRU_LIST].tail; walker !== null;) {
+ const prev = walker.prev
+ forEachStep(this, fn, walker, thisp)
+ walker = prev
+ }
+ }
+
+ forEach (fn, thisp) {
+ thisp = thisp || this
+ for (let walker = this[LRU_LIST].head; walker !== null;) {
+ const next = walker.next
+ forEachStep(this, fn, walker, thisp)
+ walker = next
+ }
+ }
+
+ keys () {
+ return this[LRU_LIST].toArray().map(k => k.key)
+ }
+
+ values () {
+ return this[LRU_LIST].toArray().map(k => k.value)
+ }
+
+ reset () {
+ if (this[DISPOSE] &&
+ this[LRU_LIST] &&
+ this[LRU_LIST].length) {
+ this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
+ }
+
+ this[CACHE] = new Map() // hash of items by key
+ this[LRU_LIST] = new Yallist() // list of items in order of use recency
+ this[LENGTH] = 0 // length of items in the list
+ }
+
+ dump () {
+ return this[LRU_LIST].map(hit =>
+ isStale(this, hit) ? false : {
+ k: hit.key,
+ v: hit.value,
+ e: hit.now + (hit.maxAge || 0)
+ }).toArray().filter(h => h)
+ }
+
+ dumpLru () {
+ return this[LRU_LIST]
+ }
+
+ set (key, value, maxAge) {
+ maxAge = maxAge || this[MAX_AGE]
+
+ if (maxAge && typeof maxAge !== 'number')
+ throw new TypeError('maxAge must be a number')
+
+ const now = maxAge ? Date.now() : 0
+ const len = this[LENGTH_CALCULATOR](value, key)
+
+ if (this[CACHE].has(key)) {
+ if (len > this[MAX]) {
+ del(this, this[CACHE].get(key))
+ return false
+ }
+
+ const node = this[CACHE].get(key)
+ const item = node.value
+
+ // dispose of the old one before overwriting
+ // split out into 2 ifs for better coverage tracking
+ if (this[DISPOSE]) {
+ if (!this[NO_DISPOSE_ON_SET])
+ this[DISPOSE](key, item.value)
+ }
+
+ item.now = now
+ item.maxAge = maxAge
+ item.value = value
+ this[LENGTH] += len - item.length
+ item.length = len
+ this.get(key)
+ trim(this)
+ return true
+ }
+
+ const hit = new Entry(key, value, len, now, maxAge)
+
+ // oversized objects fall out of cache automatically.
+ if (hit.length > this[MAX]) {
+ if (this[DISPOSE])
+ this[DISPOSE](key, value)
+
+ return false
+ }
+
+ this[LENGTH] += hit.length
+ this[LRU_LIST].unshift(hit)
+ this[CACHE].set(key, this[LRU_LIST].head)
+ trim(this)
+ return true
+ }
+
+ has (key) {
+ if (!this[CACHE].has(key)) return false
+ const hit = this[CACHE].get(key).value
+ return !isStale(this, hit)
+ }
+
+ get (key) {
+ return get(this, key, true)
+ }
+
+ peek (key) {
+ return get(this, key, false)
+ }
+
+ pop () {
+ const node = this[LRU_LIST].tail
+ if (!node)
+ return null
+
+ del(this, node)
+ return node.value
+ }
+
+ del (key) {
+ del(this, this[CACHE].get(key))
+ }
+
+ load (arr) {
+ // reset the cache
+ this.reset()
+
+ const now = Date.now()
+ // A previous serialized cache has the most recent items first
+ for (let l = arr.length - 1; l >= 0; l--) {
+ const hit = arr[l]
+ const expiresAt = hit.e || 0
+ if (expiresAt === 0)
+ // the item was created without expiration in a non aged cache
+ this.set(hit.k, hit.v)
+ else {
+ const maxAge = expiresAt - now
+ // dont add already expired items
+ if (maxAge > 0) {
+ this.set(hit.k, hit.v, maxAge)
+ }
+ }
+ }
+ }
+
+ prune () {
+ this[CACHE].forEach((value, key) => get(this, key, false))
+ }
+}
+
+const get = (self, key, doUse) => {
+ const node = self[CACHE].get(key)
+ if (node) {
+ const hit = node.value
+ if (isStale(self, hit)) {
+ del(self, node)
+ if (!self[ALLOW_STALE])
+ return undefined
+ } else {
+ if (doUse) {
+ if (self[UPDATE_AGE_ON_GET])
+ node.value.now = Date.now()
+ self[LRU_LIST].unshiftNode(node)
+ }
+ }
+ return hit.value
+ }
+}
+
+const isStale = (self, hit) => {
+ if (!hit || (!hit.maxAge && !self[MAX_AGE]))
+ return false
+
+ const diff = Date.now() - hit.now
+ return hit.maxAge ? diff > hit.maxAge
+ : self[MAX_AGE] && (diff > self[MAX_AGE])
+}
+
+const trim = self => {
+ if (self[LENGTH] > self[MAX]) {
+ for (let walker = self[LRU_LIST].tail;
+ self[LENGTH] > self[MAX] && walker !== null;) {
+ // We know that we're about to delete this one, and also
+ // what the next least recently used key will be, so just
+ // go ahead and set it now.
+ const prev = walker.prev
+ del(self, walker)
+ walker = prev
+ }
+ }
+}
+
+const del = (self, node) => {
+ if (node) {
+ const hit = node.value
+ if (self[DISPOSE])
+ self[DISPOSE](hit.key, hit.value)
+
+ self[LENGTH] -= hit.length
+ self[CACHE].delete(hit.key)
+ self[LRU_LIST].removeNode(node)
+ }
+}
+
+class Entry {
+ constructor (key, value, length, now, maxAge) {
+ this.key = key
+ this.value = value
+ this.length = length
+ this.now = now
+ this.maxAge = maxAge || 0
+ }
+}
+
+const forEachStep = (self, fn, node, thisp) => {
+ let hit = node.value
+ if (isStale(self, hit)) {
+ del(self, node)
+ if (!self[ALLOW_STALE])
+ hit = undefined
+ }
+ if (hit)
+ fn.call(thisp, hit.value, hit.key, self)
+}
+
+module.exports = LRUCache
diff --git a/node_modules/hosted-git-info/node_modules/lru-cache/package.json b/node_modules/semver/node_modules/lru-cache/package.json
index a62f74c2b..43b7502c3 100644
--- a/node_modules/hosted-git-info/node_modules/lru-cache/package.json
+++ b/node_modules/semver/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.5.1",
+ "version": "6.0.0",
"author": "Isaac Z. Schlueter <i@izs.me>",
"keywords": [
"mru",
@@ -9,10 +9,8 @@
"cache"
],
"scripts": {
- "build": "",
"test": "tap",
"snap": "tap",
- "size": "size-limit",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags"
@@ -20,24 +18,17 @@
"main": "index.js",
"repository": "git://github.com/isaacs/node-lru-cache.git",
"devDependencies": {
- "@size-limit/preset-small-lib": "^7.0.8",
"benchmark": "^2.1.4",
- "size-limit": "^7.0.8",
- "tap": "^15.1.6"
+ "tap": "^14.10.7"
},
"license": "ISC",
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
"files": [
"index.js"
],
"engines": {
- "node": ">=12"
- },
- "tap": {
- "coverage-map": "map.js"
- },
- "size-limit": [
- {
- "path": "./index.js"
- }
- ]
+ "node": ">=10"
+ }
}