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

@@ -25,8 +25,8 @@ class Cookies {
* @param {String} url Current URL
*/
set(cookieStr, url) {
let urlparts = urllib.parse(url || '');
let cookie = this.parse(cookieStr);
const urlparts = urllib.parse(url || '');
const cookie = this.parse(cookieStr);
let domain;
if (cookie.domain) {
@@ -76,15 +76,13 @@ class Cookies {
* @returns {Array} An array of cookie objects
*/
list(url) {
let result = [];
let i;
let cookie;
const result = [];
for (i = this.cookies.length - 1; i >= 0; i--) {
cookie = this.cookies[i];
for (let i = this.cookies.length - 1; i >= 0; i--) {
const cookie = this.cookies[i];
if (this.isExpired(cookie)) {
this.cookies.splice(i, i);
this.cookies.splice(i, 1);
continue;
}
@@ -103,14 +101,14 @@ class Cookies {
* @returns {Object} Cookie object
*/
parse(cookieStr) {
let cookie = {};
const cookie = {};
(cookieStr || '')
.toString()
.split(';')
.forEach(cookiePart => {
let valueParts = cookiePart.split('=');
let key = valueParts.shift().trim().toLowerCase();
const valueParts = cookiePart.split('=');
const key = valueParts.shift().trim().toLowerCase();
let value = valueParts.join('=').trim();
let domain;
@@ -171,7 +169,7 @@ class Cookies {
* @returns {Boolean} true if cookie is valid for specifiec URL
*/
match(cookie, url) {
let urlparts = urllib.parse(url || '');
const urlparts = urllib.parse(url || '');
// check if hostname matches
// .foo.com also matches subdomains, foo.com does not
@@ -183,7 +181,7 @@ class Cookies {
}
// check if path matches
let path = this.getPath(urlparts.pathname);
const path = this.getPath(urlparts.pathname);
if (path.substr(0, cookie.path.length) !== cookie.path) {
return false;
}
@@ -202,16 +200,13 @@ class Cookies {
* @param {Object} cookie Cookie value to be stored
*/
add(cookie) {
let i;
let len;
// nothing to do here
if (!cookie || !cookie.name) {
return false;
}
// overwrite if has same params
for (i = 0, len = this.cookies.length; i < len; i++) {
for (let i = 0, len = this.cookies.length; i < len; i++) {
if (this.compare(this.cookies[i], cookie)) {
// check if the cookie needs to be removed instead
if (this.isExpired(cookie)) {
@@ -240,7 +235,7 @@ class Cookies {
* @returns {Boolean} True, if the cookies are the same
*/
compare(a, b) {
return a.name === b.name && a.path === b.path && a.domain === b.domain && a.secure === b.secure && a.httponly === a.httponly;
return a.name === b.name && a.path === b.path && a.domain === b.domain && a.secure === b.secure && a.httponly === b.httponly;
}
/**

View File

@@ -4,7 +4,7 @@ const http = require('http');
const https = require('https');
const urllib = require('url');
const zlib = require('zlib');
const PassThrough = require('stream').PassThrough;
const { PassThrough } = require('stream');
const Cookies = require('./cookies');
const packageData = require('../../package.json');
const net = require('net');
@@ -33,16 +33,16 @@ function nmfetch(url, options) {
options.cookie = false;
}
let fetchRes = options.fetchRes;
let parsed = urllib.parse(url);
const fetchRes = options.fetchRes;
const parsed = urllib.parse(url);
let method = (options.method || '').toString().trim().toUpperCase() || 'GET';
let finished = false;
let cookies;
let body;
let handler = parsed.protocol === 'https:' ? https : http;
const handler = parsed.protocol === 'https:' ? https : http;
let headers = {
const headers = {
'accept-encoding': 'gzip,deflate',
'user-agent': 'nodemailer/' + packageData.version
};
@@ -90,7 +90,7 @@ function nmfetch(url, options) {
body = Buffer.from(
Object.keys(options.body)
.map(key => {
let value = options.body[key].toString().trim();
const value = options.body[key].toString().trim();
return encodeURIComponent(key) + '=' + encodeURIComponent(value);
})
.join('&')
@@ -117,7 +117,7 @@ function nmfetch(url, options) {
}
let req;
let reqOptions = {
const reqOptions = {
method,
host: parsed.hostname,
path: parsed.path,
@@ -128,9 +128,7 @@ function nmfetch(url, options) {
};
if (options.tls) {
Object.keys(options.tls).forEach(key => {
reqOptions[key] = options.tls[key];
});
Object.assign(reqOptions, options.tls);
}
if (
@@ -162,7 +160,7 @@ function nmfetch(url, options) {
}
finished = true;
req.abort();
let err = new Error('Request Timeout');
const err = new Error('Request Timeout');
err.code = errors.EFETCH;
err.sourceUrl = url;
fetchRes.emit('error', err);
@@ -204,7 +202,7 @@ function nmfetch(url, options) {
options.redirects++;
if (options.redirects > options.maxRedirects) {
finished = true;
let err = new Error('Maximum redirect count exceeded');
const err = new Error('Maximum redirect count exceeded');
err.code = errors.EFETCH;
err.sourceUrl = url;
fetchRes.emit('error', err);
@@ -222,7 +220,7 @@ function nmfetch(url, options) {
if (res.statusCode >= 300 && !options.allowErrorResponse) {
finished = true;
let err = new Error('Invalid status code ' + res.statusCode);
const err = new Error('Invalid status code ' + res.statusCode);
err.code = errors.EFETCH;
err.sourceUrl = url;
fetchRes.emit('error', err);
@@ -263,9 +261,8 @@ function nmfetch(url, options) {
try {
if (typeof body.pipe === 'function') {
return body.pipe(req);
} else {
req.write(body);
}
req.write(body);
} catch (err) {
finished = true;
err.code = errors.EFETCH;