From 409468f25e783d0941e76c7a9a64a751a574176b Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Wed, 17 Aug 2022 12:34:15 -0700 Subject: [PATCH] deps: minipass-fetch@2.1.1 --- node_modules/minipass-fetch/lib/body.js | 24 +++++++++++++----------- node_modules/minipass-fetch/package.json | 7 ++++--- package-lock.json | 5 +++-- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/node_modules/minipass-fetch/lib/body.js b/node_modules/minipass-fetch/lib/body.js index c7ffa5babcbc..58893309e63f 100644 --- a/node_modules/minipass-fetch/lib/body.js +++ b/node_modules/minipass-fetch/lib/body.js @@ -10,7 +10,9 @@ const FetchError = require('./fetch-error.js') let convert try { convert = require('encoding').convert -} catch (e) {} +} catch (e) { + // defer error until textConverted is called +} const INTERNALS = Symbol('Body internals') const CONSUME_BODY = Symbol('consumeBody') @@ -69,16 +71,16 @@ class Body { )) } - json () { - return this[CONSUME_BODY]().then(buf => { - try { - return JSON.parse(buf.toString()) - } catch (er) { - return Promise.reject(new FetchError( - `invalid json response body at ${ - this.url} reason: ${er.message}`, 'invalid-json')) - } - }) + async json () { + try { + const buf = await this[CONSUME_BODY]() + return JSON.parse(buf.toString()) + } catch (er) { + throw new FetchError( + `invalid json response body at ${this.url} reason: ${er.message}`, + 'invalid-json' + ) + } } text () { diff --git a/node_modules/minipass-fetch/package.json b/node_modules/minipass-fetch/package.json index 1f663b9245de..b47077adc111 100644 --- a/node_modules/minipass-fetch/package.json +++ b/node_modules/minipass-fetch/package.json @@ -1,6 +1,6 @@ { "name": "minipass-fetch", - "version": "2.1.0", + "version": "2.1.1", "description": "An implementation of window.fetch in Node.js using Minipass streams", "license": "MIT", "main": "lib/index.js", @@ -23,10 +23,11 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.1.2", + "@npmcli/template-oss": "3.5.0", "@ungap/url-search-params": "^0.2.2", "abort-controller": "^3.0.0", "abortcontroller-polyfill": "~1.7.3", + "encoding": "^0.1.13", "form-data": "^4.0.0", "nock": "^13.2.4", "parted": "^0.1.1", @@ -61,6 +62,6 @@ "author": "GitHub Inc.", "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.1.2" + "version": "3.5.0" } } diff --git a/package-lock.json b/package-lock.json index 299e955141fe..ba7a51e0a872 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4819,9 +4819,10 @@ } }, "node_modules/minipass-fetch": { - "version": "2.1.0", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.1.tgz", + "integrity": "sha512-/kgtXVGS10PTFET6dAbOBWQtgH+iDiI4NhRqAftojRlsOJhk0y45sVVxqCaRQC+AMFH7JkHiWpuKJKQ+mojKiA==", "inBundle": true, - "license": "MIT", "dependencies": { "minipass": "^3.1.6", "minipass-sized": "^1.0.3",