registry-sync 5.0.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +18 -17
- package/src/client.js +7 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "registry-sync",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "synchronize a remote npm registry for private use",
|
|
5
5
|
"repository": "https://github.com/heikkipora/registry-sync",
|
|
6
6
|
"bin": {
|
|
@@ -20,19 +20,20 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@yarnpkg/lockfile": "1.1.0",
|
|
23
|
-
"axios": "1.
|
|
24
|
-
"commander": "
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
23
|
+
"axios": "1.7.2",
|
|
24
|
+
"commander": "12.1.0",
|
|
25
|
+
"lru-cache": "10.2.2",
|
|
26
|
+
"semver": "7.6.2",
|
|
27
|
+
"ssri": "10.0.6",
|
|
28
|
+
"tar-fs": "3.0.6"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@arkweid/lefthook": "0.7.7",
|
|
31
|
-
"@types/chai": "4.3.
|
|
32
|
-
"@types/lodash": "4.
|
|
32
|
+
"@types/chai": "4.3.16",
|
|
33
|
+
"@types/lodash": "4.17.4",
|
|
33
34
|
"@types/mocha": "10.0.6",
|
|
34
|
-
"@types/node": "20.
|
|
35
|
-
"@types/semver": "7.5.
|
|
35
|
+
"@types/node": "20.12.12",
|
|
36
|
+
"@types/semver": "7.5.8",
|
|
36
37
|
"@types/ssri": "7.1.5",
|
|
37
38
|
"@types/tar-fs": "2.0.4",
|
|
38
39
|
"@types/yarnpkg__lockfile": "1.1.9",
|
|
@@ -42,13 +43,13 @@
|
|
|
42
43
|
"eslint": "8.56.0",
|
|
43
44
|
"eslint-config-prettier": "9.1.0",
|
|
44
45
|
"eslint-formatter-codeframe": "7.32.1",
|
|
45
|
-
"eslint-plugin-mocha": "10.
|
|
46
|
-
"express": "4.
|
|
47
|
-
"lint-staged": "
|
|
48
|
-
"mocha": "10.
|
|
49
|
-
"prettier": "3.2.
|
|
46
|
+
"eslint-plugin-mocha": "10.4.3",
|
|
47
|
+
"express": "4.19.2",
|
|
48
|
+
"lint-staged": "15.2.5",
|
|
49
|
+
"mocha": "10.4.0",
|
|
50
|
+
"prettier": "3.2.5",
|
|
50
51
|
"ts-node": "10.9.2",
|
|
51
|
-
"typescript": "5.
|
|
52
|
+
"typescript": "5.4.5"
|
|
52
53
|
},
|
|
53
54
|
"keywords": [
|
|
54
55
|
"registry",
|
|
@@ -58,6 +59,6 @@
|
|
|
58
59
|
"offline"
|
|
59
60
|
],
|
|
60
61
|
"engines": {
|
|
61
|
-
"node": ">=
|
|
62
|
+
"node": ">=18.20.0"
|
|
62
63
|
}
|
|
63
64
|
}
|
package/src/client.js
CHANGED
|
@@ -3,22 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fetchBinaryData = exports.fetchJsonWithCacheCloned = void 0;
|
|
4
4
|
const https = require("https");
|
|
5
5
|
const axios_1 = require("axios");
|
|
6
|
-
const
|
|
6
|
+
const lru_cache_1 = require("lru-cache");
|
|
7
|
+
const metadataCache = new lru_cache_1.LRUCache({ max: 100 });
|
|
7
8
|
const client = axios_1.default.create({
|
|
8
9
|
httpsAgent: new https.Agent({ keepAlive: true }),
|
|
9
10
|
timeout: 30 * 1000
|
|
10
11
|
});
|
|
11
12
|
async function fetchJsonWithCacheCloned(url, token) {
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
metadataCache[url] = await fetch(url, 'json', token);
|
|
13
|
+
if (metadataCache.has(url)) {
|
|
14
|
+
return structuredClone(metadataCache.get(url));
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const value = await fetch(url, 'json', token);
|
|
17
|
+
metadataCache.set(url, value);
|
|
18
|
+
return structuredClone(value);
|
|
17
19
|
}
|
|
18
20
|
exports.fetchJsonWithCacheCloned = fetchJsonWithCacheCloned;
|
|
19
|
-
function cloneDeep(metadata) {
|
|
20
|
-
return JSON.parse(JSON.stringify(metadata));
|
|
21
|
-
}
|
|
22
21
|
function fetchBinaryData(url, token) {
|
|
23
22
|
return fetch(url, 'arraybuffer', token);
|
|
24
23
|
}
|