node_modules: update (#290)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurla
2026-04-28 12:50:45 +02:00
committed by GitHub
parent 63e1562580
commit 42942bc2f8
1077 changed files with 12540 additions and 33773 deletions

View File

@@ -15,11 +15,7 @@ module.exports = {
*/
isPlainText(value, isParam) {
const re = isParam ? /[\x00-\x08\x0b\x0c\x0e-\x1f"\u0080-\uFFFF]/ : /[\x00-\x08\x0b\x0c\x0e-\x1f\u0080-\uFFFF]/;
if (typeof value !== 'string' || re.test(value)) {
return false;
} else {
return true;
}
return typeof value === 'string' && !re.test(value);
},
/**
@@ -54,7 +50,7 @@ module.exports = {
maxLength = maxLength || 0;
let encodedStr;
let toCharset = 'UTF-8';
const toCharset = 'UTF-8';
if (maxLength && maxLength > 7 + toCharset.length) {
maxLength -= 7 + toCharset.length;
@@ -63,12 +59,11 @@ module.exports = {
if (mimeWordEncoding === 'Q') {
// https://tools.ietf.org/html/rfc2047#section-5 rule (3)
encodedStr = qp.encode(data).replace(/[^a-z0-9!*+\-/=]/gi, chr => {
let ord = chr.charCodeAt(0).toString(16).toUpperCase();
const ord = chr.charCodeAt(0).toString(16).toUpperCase();
if (chr === ' ') {
return '_';
} else {
return '=' + (ord.length === 1 ? '0' + ord : ord);
}
return '=' + (ord.length === 1 ? '0' + ord : ord);
});
} else if (mimeWordEncoding === 'B') {
encodedStr = typeof data === 'string' ? data : base64.encode(data);
@@ -80,7 +75,7 @@ module.exports = {
encodedStr = this.splitMimeEncodedString(encodedStr, maxLength).join('?= =?' + toCharset + '?' + mimeWordEncoding + '?');
} else {
// RFC2047 6.3 (2) states that encoded-word must include an integral number of characters, so no chopping unicode sequences
let parts = [];
const parts = [];
let lpart = '';
for (let i = 0, len = encodedStr.length; i < len; i++) {
let chr = encodedStr.charAt(i);
@@ -129,42 +124,38 @@ module.exports = {
encodeWords(value, mimeWordEncoding, maxLength, encodeAll) {
maxLength = maxLength || 0;
let encodedValue;
// find first word with a non-printable ascii or special symbol in it
let firstMatch = value.match(/(?:^|\s)([^\s]*["\u0080-\uFFFF])/);
const firstMatch = value.match(/(?:^|\s)([^\s]*["\u0080-\uFFFF])/);
if (!firstMatch) {
return value;
}
if (encodeAll) {
// if it is requested to encode everything or the string contains something that resebles encoded word, then encode everything
return this.encodeWord(value, mimeWordEncoding, maxLength);
}
// find the last word with a non-printable ascii in it
let lastMatch = value.match(/(["\u0080-\uFFFF][^\s]*)[^"\u0080-\uFFFF]*$/);
const lastMatch = value.match(/(["\u0080-\uFFFF][^\s]*)[^"\u0080-\uFFFF]*$/);
if (!lastMatch) {
// should not happen
return value;
}
let startIndex =
const startIndex =
firstMatch.index +
(
firstMatch[0].match(/[^\s]/) || {
index: 0
}
).index;
let endIndex = lastMatch.index + (lastMatch[1] || '').length;
const endIndex = lastMatch.index + (lastMatch[1] || '').length;
encodedValue =
return (
(startIndex ? value.substr(0, startIndex) : '') +
this.encodeWord(value.substring(startIndex, endIndex), mimeWordEncoding || 'Q', maxLength) +
(endIndex < value.length ? value.substr(endIndex) : '');
return encodedValue;
(endIndex < value.length ? value.substr(endIndex) : '')
);
},
/**
@@ -175,12 +166,12 @@ module.exports = {
* @return {String} joined header value
*/
buildHeaderValue(structured) {
let paramsArray = [];
const paramsArray = [];
Object.keys(structured.params || {}).forEach(param => {
// filename might include unicode characters so it is a special case
// other values probably do not
let value = structured.params[param];
const value = structured.params[param];
if (!this.isPlainText(value, true) || value.length >= 75) {
this.buildHeaderParam(param, value, 50).forEach(encodedParam => {
if (!/[\s"\\;:/=(),<>@[\]?]|^[-']|'$/.test(encodedParam.value) || encodedParam.key.substr(-1) === '*') {
@@ -215,9 +206,8 @@ module.exports = {
* @return {Array} A list of encoded keys and headers
*/
buildHeaderParam(key, data, maxLength) {
let list = [];
const list = [];
let encodedStr = typeof data === 'string' ? data : (data || '').toString();
let encodedStrArr;
let chr, ord;
let line;
let startPos = 0;
@@ -252,7 +242,7 @@ module.exports = {
} else {
if (/[\uD800-\uDBFF]/.test(encodedStr)) {
// string containts surrogate pairs, so normalize it to an array of bytes
encodedStrArr = [];
const encodedStrArr = [];
for (i = 0, len = encodedStr.length; i < len; i++) {
chr = encodedStr.charAt(i);
ord = chr.charCodeAt(0);
@@ -356,7 +346,7 @@ module.exports = {
* @return {Object} Header value as a parsed structure
*/
parseHeaderValue(str) {
let response = {
const response = {
value: false,
params: {}
};
@@ -458,12 +448,11 @@ module.exports = {
value
// fix invalidly encoded chars
.replace(/[=?_\s]/g, s => {
let c = s.charCodeAt(0).toString(16);
const c = s.charCodeAt(0).toString(16);
if (s === ' ') {
return '_';
} else {
return '%' + (c.length < 2 ? '0' : '') + c;
}
return '%' + (c.length < 2 ? '0' : '') + c;
})
// change from urlencoding to percent encoding
.replace(/%/g, '=') +
@@ -508,11 +497,10 @@ module.exports = {
str = (str || '').toString();
lineLength = lineLength || 76;
let pos = 0,
len = str.length,
result = '',
line,
match;
let pos = 0;
const len = str.length;
let result = '';
let line, match;
while (pos < len) {
line = str.substr(pos, lineLength);
@@ -549,11 +537,8 @@ module.exports = {
* @return {Array} Split string
*/
splitMimeEncodedString: (str, maxlen) => {
let curLine,
match,
chr,
done,
lines = [];
const lines = [];
let curLine, match, chr, done;
// require at least 12 symbols to fit possible 4 octet UTF-8 sequences
maxlen = Math.max(maxlen || 0, 12);