registry-sync
Advanced tools
Comparing version 5.0.2 to 6.0.0
{ | ||
"name": "registry-sync", | ||
"version": "5.0.2", | ||
"version": "6.0.0", | ||
"description": "synchronize a remote npm registry for private use", | ||
@@ -23,15 +23,16 @@ "repository": "https://github.com/heikkipora/registry-sync", | ||
"@yarnpkg/lockfile": "1.1.0", | ||
"axios": "1.6.5", | ||
"commander": "11.1.0", | ||
"semver": "7.5.4", | ||
"ssri": "10.0.5", | ||
"tar-fs": "3.0.4" | ||
"axios": "1.7.2", | ||
"commander": "12.1.0", | ||
"lru-cache": "10.2.2", | ||
"semver": "7.6.2", | ||
"ssri": "10.0.6", | ||
"tar-fs": "3.0.6" | ||
}, | ||
"devDependencies": { | ||
"@arkweid/lefthook": "0.7.7", | ||
"@types/chai": "4.3.11", | ||
"@types/lodash": "4.14.202", | ||
"@types/chai": "4.3.16", | ||
"@types/lodash": "4.17.4", | ||
"@types/mocha": "10.0.6", | ||
"@types/node": "20.11.5", | ||
"@types/semver": "7.5.6", | ||
"@types/node": "20.12.12", | ||
"@types/semver": "7.5.8", | ||
"@types/ssri": "7.1.5", | ||
@@ -46,9 +47,9 @@ "@types/tar-fs": "2.0.4", | ||
"eslint-formatter-codeframe": "7.32.1", | ||
"eslint-plugin-mocha": "10.2.0", | ||
"express": "4.18.2", | ||
"lint-staged": "14.0.1", | ||
"mocha": "10.2.0", | ||
"prettier": "3.2.4", | ||
"eslint-plugin-mocha": "10.4.3", | ||
"express": "4.19.2", | ||
"lint-staged": "15.2.5", | ||
"mocha": "10.4.0", | ||
"prettier": "3.2.5", | ||
"ts-node": "10.9.2", | ||
"typescript": "5.3.3" | ||
"typescript": "5.4.5" | ||
}, | ||
@@ -63,4 +64,4 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=16.14.0" | ||
"node": ">=18.20.0" | ||
} | ||
} |
@@ -6,3 +6,4 @@ "use strict"; | ||
const axios_1 = require("axios"); | ||
const metadataCache = {}; | ||
const lru_cache_1 = require("lru-cache"); | ||
const metadataCache = new lru_cache_1.LRUCache({ max: 100 }); | ||
const client = axios_1.default.create({ | ||
@@ -13,12 +14,10 @@ httpsAgent: new https.Agent({ keepAlive: true }), | ||
async function fetchJsonWithCacheCloned(url, token) { | ||
if (!metadataCache[url]) { | ||
// eslint-disable-next-line require-atomic-updates | ||
metadataCache[url] = await fetch(url, 'json', token); | ||
if (metadataCache.has(url)) { | ||
return structuredClone(metadataCache.get(url)); | ||
} | ||
return cloneDeep(metadataCache[url]); | ||
const value = await fetch(url, 'json', token); | ||
metadataCache.set(url, value); | ||
return structuredClone(value); | ||
} | ||
exports.fetchJsonWithCacheCloned = fetchJsonWithCacheCloned; | ||
function cloneDeep(metadata) { | ||
return JSON.parse(JSON.stringify(metadata)); | ||
} | ||
function fetchBinaryData(url, token) { | ||
@@ -25,0 +24,0 @@ return fetch(url, 'arraybuffer', token); |
38840
7
617
+ Addedlru-cache@10.2.2
+ Addedaxios@1.7.2(transitive)
+ Addedbare-fs@2.3.5(transitive)
+ Addedbare-os@2.4.4(transitive)
+ Addedbare-path@2.1.3(transitive)
+ Addedbare-stream@2.6.4(transitive)
+ Addedcommander@12.1.0(transitive)
+ Addedlru-cache@10.2.2(transitive)
+ Addedsemver@7.6.2(transitive)
+ Addedssri@10.0.6(transitive)
+ Addedtar-fs@3.0.6(transitive)
- Removedaxios@1.6.5(transitive)
- Removedcommander@11.1.0(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedmkdirp-classic@0.5.3(transitive)
- Removedsemver@7.5.4(transitive)
- Removedssri@10.0.5(transitive)
- Removedtar-fs@3.0.4(transitive)
- Removedyallist@4.0.0(transitive)
Updatedaxios@1.7.2
Updatedcommander@12.1.0
Updatedsemver@7.6.2
Updatedssri@10.0.6
Updatedtar-fs@3.0.6