Skip to content

Commit 6f0d7ce

Browse files
committedJun 27, 2024
deps: @npmcli/redact@2.0.1
1 parent 29204c8 commit 6f0d7ce

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed
 

‎node_modules/@npmcli/redact/lib/deep-map.js

+24-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1+
function filterError (input) {
2+
return {
3+
errorType: input.name,
4+
message: input.message,
5+
stack: input.stack,
6+
...(input.code ? { code: input.code } : {}),
7+
...(input.statusCode ? { statusCode: input.statusCode } : {}),
8+
}
9+
}
10+
111
const deepMap = (input, handler = v => v, path = ['$'], seen = new Set([input])) => {
12+
// this is in an effort to maintain bole's error logging behavior
13+
if (path.join('.') === '$' && input instanceof Error) {
14+
return deepMap({ err: filterError(input) }, handler, path, seen)
15+
}
16+
if (input instanceof Error) {
17+
return deepMap(filterError(input), handler, path, seen)
18+
}
19+
if (input instanceof Buffer) {
20+
return `[unable to log instanceof buffer]`
21+
}
22+
if (input instanceof Uint8Array) {
23+
return `[unable to log instanceof Uint8Array]`
24+
}
25+
226
if (Array.isArray(input)) {
327
const result = []
428
for (let i = 0; i < input.length; i++) {
@@ -21,11 +45,6 @@ const deepMap = (input, handler = v => v, path = ['$'], seen = new Set([input]))
2145
} else if (typeof input === 'object' || typeof input === 'function') {
2246
const result = {}
2347

24-
if (input instanceof Error) {
25-
// `name` property is not included in `Object.getOwnPropertyNames(error)`
26-
result.errorType = input.name
27-
}
28-
2948
for (const propertyName of Object.getOwnPropertyNames(input)) {
3049
// skip logging internal properties
3150
if (propertyName.startsWith('_')) {

‎node_modules/@npmcli/redact/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@npmcli/redact",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Redact sensitive npm information from output",
55
"main": "lib/index.js",
66
"exports": {

‎package-lock.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"@npmcli/map-workspaces": "^3.0.6",
9494
"@npmcli/package-json": "^5.2.0",
9595
"@npmcli/promise-spawn": "^7.0.2",
96-
"@npmcli/redact": "^2.0.0",
96+
"@npmcli/redact": "^2.0.1",
9797
"@npmcli/run-script": "^8.1.0",
9898
"@sigstore/tuf": "^2.3.4",
9999
"abbrev": "^2.0.0",
@@ -1760,9 +1760,9 @@
17601760
}
17611761
},
17621762
"node_modules/@npmcli/redact": {
1763-
"version": "2.0.0",
1764-
"resolved": "https://registry.npmjs.org/@npmcli/redact/-/redact-2.0.0.tgz",
1765-
"integrity": "sha512-SEjCPAVHWYUIQR+Yn03kJmrJjZDtJLYpj300m3HV9OTRZNpC5YpbMsM3eTkECyT4aWj8lDr9WeY6TWefpubtYQ==",
1763+
"version": "2.0.1",
1764+
"resolved": "https://registry.npmjs.org/@npmcli/redact/-/redact-2.0.1.tgz",
1765+
"integrity": "sha512-YgsR5jCQZhVmTJvjduTOIHph0L73pK8xwMVaDY0PatySqVM9AZj93jpoXYSJqfHFxFkN9dmqTw6OiqExsS3LPw==",
17661766
"inBundle": true,
17671767
"license": "ISC",
17681768
"engines": {

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"@npmcli/map-workspaces": "^3.0.6",
5959
"@npmcli/package-json": "^5.2.0",
6060
"@npmcli/promise-spawn": "^7.0.2",
61-
"@npmcli/redact": "^2.0.0",
61+
"@npmcli/redact": "^2.0.1",
6262
"@npmcli/run-script": "^8.1.0",
6363
"@sigstore/tuf": "^2.3.4",
6464
"abbrev": "^2.0.0",

0 commit comments

Comments
 (0)
Please sign in to comment.