avancement planning

This commit is contained in:
2026-05-26 11:58:39 +02:00
parent 619a2b240a
commit 150b97cd2e
4892 changed files with 99214 additions and 429382 deletions
+25 -15
View File
@@ -1,15 +1,15 @@
'use strict'
const { Minipass } = require('minipass')
const MinipassSized = require('minipass-sized')
const { MinipassSized } = require('minipass-sized')
const Blob = require('./blob.js')
const { BUFFER } = Blob
const FetchError = require('./fetch-error.js')
// optional dependency on 'encoding'
let convert
// optional dependency on 'iconv-lite'
let decode
try {
convert = require('encoding').convert
decode = require('iconv-lite').decode
} catch (e) {
// defer error until textConverted is called
}
@@ -92,6 +92,10 @@ class Body {
}
textConverted () {
/* istanbul ignore if */
if (typeof decode !== 'function') {
throw new Error('The package `iconv-lite` must be installed to use the textConverted() function')
}
return this[CONSUME_BODY]().then(buf => convertBody(buf, this.headers))
}
@@ -285,11 +289,6 @@ const isBlob = obj =>
/^(Blob|File)$/.test(obj[Symbol.toStringTag])
const convertBody = (buffer, headers) => {
/* istanbul ignore if */
if (typeof convert !== 'function') {
throw new Error('The package `encoding` must be installed to use the textConverted() function')
}
const ct = headers && headers.get('content-type')
let charset = 'utf-8'
let res
@@ -339,12 +338,23 @@ const convertBody = (buffer, headers) => {
}
}
// turn raw buffers into a single utf-8 buffer
return convert(
buffer,
'UTF-8',
charset
).toString()
if (charset === 'UTF-8') {
return buffer.toString('UTF-8')
}
charset = charset.toString().trim()
.replace(/^latin[-_]?(\d+)$/i, 'ISO-8859-$1')
.replace(/^win(?:dows)?[-_]?(\d+)$/i, 'WINDOWS-$1')
.replace(/^utf[-_]?(\d+)$/i, 'UTF-$1')
.replace(/^ks_c_5601-1987$/i, 'CP949')
.replace(/^us[-_]?ascii$/i, 'ASCII')
.toUpperCase()
try {
return decode(buffer, charset).toString()
} catch {
/* istanbul ignore next */
return buffer.toString('UTF-8')
}
}
module.exports = Body
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "minipass-fetch",
"version": "4.0.1",
"version": "5.0.2",
"description": "An implementation of window.fetch in Node.js using Minipass streams",
"license": "MIT",
"main": "lib/index.js",
@@ -25,12 +25,12 @@
},
"devDependencies": {
"@npmcli/eslint-config": "^5.0.0",
"@npmcli/template-oss": "4.23.3",
"@npmcli/template-oss": "4.27.1",
"@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",
"iconv-lite": "^0.7.2",
"nock": "^13.2.4",
"parted": "^0.1.1",
"string-to-arraybuffer": "^1.0.2",
@@ -38,11 +38,11 @@
},
"dependencies": {
"minipass": "^7.0.3",
"minipass-sized": "^1.0.3",
"minipass-sized": "^2.0.0",
"minizlib": "^3.0.1"
},
"optionalDependencies": {
"encoding": "^0.1.13"
"iconv-lite": "^0.7.2"
},
"repository": {
"type": "git",
@@ -59,12 +59,12 @@
"lib/"
],
"engines": {
"node": "^18.17.0 || >=20.5.0"
"node": "^20.17.0 || >=22.9.0"
},
"author": "GitHub Inc.",
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.23.3",
"version": "4.27.1",
"publish": "true"
}
}