Skip to content

Commit 38ed048

Browse files
committedApr 16, 2024·
deps: @npmcli/metavuln-calculator@7.1.0
1 parent 6512112 commit 38ed048

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed
 

‎DEPENDENCIES.md

+2
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ graph LR;
211211
npmcli-metavuln-calculator-->cacache;
212212
npmcli-metavuln-calculator-->json-parse-even-better-errors;
213213
npmcli-metavuln-calculator-->pacote;
214+
npmcli-metavuln-calculator-->proc-log;
214215
npmcli-metavuln-calculator-->semver;
215216
npmcli-mock-globals-->npmcli-eslint-config["@npmcli/eslint-config"];
216217
npmcli-mock-globals-->npmcli-template-oss["@npmcli/template-oss"];
@@ -676,6 +677,7 @@ graph LR;
676677
npmcli-metavuln-calculator-->cacache;
677678
npmcli-metavuln-calculator-->json-parse-even-better-errors;
678679
npmcli-metavuln-calculator-->pacote;
680+
npmcli-metavuln-calculator-->proc-log;
679681
npmcli-metavuln-calculator-->semver;
680682
npmcli-mock-globals-->npmcli-eslint-config["@npmcli/eslint-config"];
681683
npmcli-mock-globals-->npmcli-template-oss["@npmcli/template-oss"];

‎node_modules/@npmcli/metavuln-calculator/lib/index.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// class handles all the IO with the registry and cache.
44
const pacote = require('pacote')
55
const cacache = require('cacache')
6+
const { time } = require('proc-log')
67
const Advisory = require('./advisory.js')
78
const { homedir } = require('os')
89
const jsonParse = require('json-parse-even-better-errors')
@@ -48,34 +49,33 @@ class Calculator {
4849

4950
async [_calculate] (name, source) {
5051
const k = `security-advisory:${name}:${source.id}`
51-
const t = `metavuln:calculate:${k}`
52-
process.emit('time', t)
52+
const timeEnd = time.start(`metavuln:calculate:${k}`)
5353
const advisory = new Advisory(name, source, this[_options])
5454
// load packument and cached advisory
5555
const [cached, packument] = await Promise.all([
5656
this[_cacheGet](advisory),
5757
this[_packument](name),
5858
])
59-
process.emit('time', `metavuln:load:${k}`)
59+
const timeEndLoad = time.start(`metavuln:load:${k}`)
6060
advisory.load(cached, packument)
61-
process.emit('timeEnd', `metavuln:load:${k}`)
61+
timeEndLoad()
6262
if (advisory.updated) {
6363
await this[_cachePut](advisory)
6464
}
6565
this[_advisories].set(k, advisory)
66-
process.emit('timeEnd', t)
66+
timeEnd()
6767
return advisory
6868
}
6969

7070
async [_cachePut] (advisory) {
7171
const { name, id } = advisory
7272
const key = `security-advisory:${name}:${id}`
73-
process.emit('time', `metavuln:cache:put:${key}`)
73+
const timeEnd = time.start(`metavuln:cache:put:${key}`)
7474
const data = JSON.stringify(advisory)
7575
const options = { ...this[_options] }
7676
this[_cacheData].set(key, jsonParse(data))
7777
await cacache.put(this[_cache], key, data, options).catch(() => {})
78-
process.emit('timeEnd', `metavuln:cache:put:${key}`)
78+
timeEnd()
7979
}
8080

8181
async [_cacheGet] (advisory) {
@@ -87,12 +87,12 @@ class Calculator {
8787
return this[_cacheData].get(key)
8888
}
8989

90-
process.emit('time', `metavuln:cache:get:${key}`)
90+
const timeEnd = time.start(`metavuln:cache:get:${key}`)
9191
const p = cacache.get(this[_cache], key, { ...this[_options] })
9292
.catch(() => ({ data: '{}' }))
9393
.then(({ data }) => {
9494
data = jsonParse(data)
95-
process.emit('timeEnd', `metavuln:cache:get:${key}`)
95+
timeEnd()
9696
this[_cacheData].set(key, data)
9797
return data
9898
})
@@ -105,7 +105,7 @@ class Calculator {
105105
return this[_packuments].get(name)
106106
}
107107

108-
process.emit('time', `metavuln:packument:${name}`)
108+
const timeEnd = time.start(`metavuln:packument:${name}`)
109109
const p = pacote.packument(name, { ...this[_options] })
110110
.catch((er) => {
111111
// presumably not something from the registry.
@@ -116,7 +116,7 @@ class Calculator {
116116
}
117117
})
118118
.then(paku => {
119-
process.emit('timeEnd', `metavuln:packument:${name}`)
119+
timeEnd()
120120
this[_packuments].set(name, paku)
121121
return paku
122122
})

‎node_modules/@npmcli/metavuln-calculator/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@npmcli/metavuln-calculator",
3-
"version": "7.0.1",
3+
"version": "7.1.0",
44
"main": "lib/index.js",
55
"files": [
66
"bin/",
@@ -42,6 +42,7 @@
4242
"cacache": "^18.0.0",
4343
"json-parse-even-better-errors": "^3.0.0",
4444
"pacote": "^18.0.0",
45+
"proc-log": "^4.1.0",
4546
"semver": "^7.3.5"
4647
},
4748
"engines": {

‎package-lock.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1751,13 +1751,14 @@
17511751
}
17521752
},
17531753
"node_modules/@npmcli/metavuln-calculator": {
1754-
"version": "7.0.1",
1755-
"resolved": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-7.0.1.tgz",
1756-
"integrity": "sha512-665lHkHWufnWA3i6H1dJ/EDvK0s0JHrECuBLv/SdLsB53e4v70twsK1baDxatn1pZp7g11HhH80upkfgsBAFFg==",
1754+
"version": "7.1.0",
1755+
"resolved": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-7.1.0.tgz",
1756+
"integrity": "sha512-D4VZzVLZ4Mw+oUCWyQ6qzlm5SGlrLnhKtZscDwQXFFc1FUPvw69Ibo2E5ZpJAmjFSYkA5UlCievWmREW0JLC3w==",
17571757
"dependencies": {
17581758
"cacache": "^18.0.0",
17591759
"json-parse-even-better-errors": "^3.0.0",
17601760
"pacote": "^18.0.0",
1761+
"proc-log": "^4.1.0",
17611762
"semver": "^7.3.5"
17621763
},
17631764
"engines": {
@@ -16161,7 +16162,7 @@
1616116162
"@npmcli/fs": "^3.1.0",
1616216163
"@npmcli/installed-package-contents": "^2.0.2",
1616316164
"@npmcli/map-workspaces": "^3.0.2",
16164-
"@npmcli/metavuln-calculator": "^7.0.1",
16165+
"@npmcli/metavuln-calculator": "^7.1.0",
1616516166
"@npmcli/name-from-folder": "^2.0.0",
1616616167
"@npmcli/node-gyp": "^3.0.0",
1616716168
"@npmcli/package-json": "^5.0.3",

‎workspaces/arborist/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"@npmcli/fs": "^3.1.0",
88
"@npmcli/installed-package-contents": "^2.0.2",
99
"@npmcli/map-workspaces": "^3.0.2",
10-
"@npmcli/metavuln-calculator": "^7.0.1",
10+
"@npmcli/metavuln-calculator": "^7.1.0",
1111
"@npmcli/name-from-folder": "^2.0.0",
1212
"@npmcli/node-gyp": "^3.0.0",
1313
"@npmcli/package-json": "^5.0.3",

0 commit comments

Comments
 (0)
Please sign in to comment.