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

@@ -1,6 +1,6 @@
'use strict';
const spawn = require('child_process').spawn;
const { spawn } = require('child_process');
const packageData = require('../../package.json');
const shared = require('../shared');
const errors = require('../errors');
@@ -24,30 +24,26 @@ class SendmailTransport {
// use a reference to spawn for mocking purposes
this._spawn = spawn;
this.options = options || {};
this.options = options;
this.name = 'Sendmail';
this.version = packageData.version;
this.path = 'sendmail';
this.args = false;
this.winbreak = false;
this.logger = shared.getLogger(this.options, {
component: this.options.component || 'sendmail'
});
if (options) {
if (typeof options === 'string') {
this.path = options;
} else if (typeof options === 'object') {
if (options.path) {
this.path = options.path;
}
if (Array.isArray(options.args)) {
this.args = options.args;
}
this.winbreak = ['win', 'windows', 'dos', '\r\n'].includes((options.newline || '').toString().toLowerCase());
if (typeof options === 'string') {
this.path = options;
} else if (typeof options === 'object') {
if (options.path) {
this.path = options.path;
}
if (Array.isArray(options.args)) {
this.args = options.args;
}
}
}
@@ -62,10 +58,8 @@ class SendmailTransport {
// Sendmail strips this header line by itself
mail.message.keepBcc = true;
let envelope = mail.data.envelope || mail.message.getEnvelope();
let messageId = mail.message.messageId();
let args;
let sendmail;
const envelope = mail.data.envelope || mail.message.getEnvelope();
const messageId = mail.message.messageId();
let returned;
const hasInvalidAddresses = []
@@ -73,19 +67,17 @@ class SendmailTransport {
.concat(envelope.to || [])
.some(addr => /^-/.test(addr));
if (hasInvalidAddresses) {
let err = new Error('Can not send mail. Invalid envelope addresses.');
const err = new Error('Can not send mail. Invalid envelope addresses.');
err.code = errors.ESENDMAIL;
return done(err);
}
if (this.args) {
// force -i to keep single dots
args = ['-i'].concat(this.args).concat(envelope.to);
} else {
args = ['-i'].concat(envelope.from ? ['-f', envelope.from] : []).concat(envelope.to);
}
// force -i to keep single dots
const args = this.args
? ['-i'].concat(this.args).concat(envelope.to)
: ['-i'].concat(envelope.from ? ['-f', envelope.from] : []).concat(envelope.to);
let callback = err => {
const callback = err => {
if (returned) {
// ignore any additional responses, already done
return;
@@ -94,16 +86,16 @@ class SendmailTransport {
if (typeof done === 'function') {
if (err) {
return done(err);
} else {
return done(null, {
envelope: mail.data.envelope || mail.message.getEnvelope(),
messageId,
response: 'Messages queued for delivery'
});
}
return done(null, {
envelope,
messageId,
response: 'Messages queued for delivery'
});
}
};
let sendmail;
try {
sendmail = this._spawn(this.path, args);
} catch (E) {
@@ -138,12 +130,9 @@ class SendmailTransport {
if (!code) {
return callback();
}
let err;
if (code === 127) {
err = new Error('Sendmail command not found, process exited with code ' + code);
} else {
err = new Error('Sendmail exited with code ' + code);
}
const err = new Error(
code === 127 ? 'Sendmail command not found, process exited with code ' + code : 'Sendmail exited with code ' + code
);
err.code = errors.ESENDMAIL;
this.logger.error(
@@ -174,7 +163,7 @@ class SendmailTransport {
callback(err);
});
let recipients = [].concat(envelope.to || []);
const recipients = [].concat(envelope.to || []);
if (recipients.length > 3) {
recipients.push('...and ' + recipients.splice(2).length + ' more');
}
@@ -188,7 +177,7 @@ class SendmailTransport {
recipients.join(', ')
);
let sourceStream = mail.message.createReadStream();
const sourceStream = mail.message.createReadStream();
sourceStream.once('error', err => {
this.logger.error(
{
@@ -206,7 +195,7 @@ class SendmailTransport {
sourceStream.pipe(sendmail.stdin);
} else {
let err = new Error('sendmail was not found');
const err = new Error('sendmail was not found');
err.code = errors.ESENDMAIL;
return callback(err);
}