node_modules: update (#344)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurlaanddawidd6 authored and GitHub committed 2026-10-10 17:27:57 +02:00
1 parent b099186883
commit 6e88c72525
63 files changed
+2863 -1227

No files matched your search

+45 -31
View File
@@ -37,51 +37,67 @@ class DKIMSigner {
this.output = output;
this.output.usingCache = false;
this.hasErrored = false;
this.input.on('error', err => {
this.input.on('error', err => this.fail(err));
// A consumer that goes away before the signed message was read in full destroys the
// output. Stop reading the input and drop the cache file instead of leaving them open
this.output.once('close', () => {
if (this.output.writableFinished) {
return;
}
this.hasErrored = true;
this.input.unpipe();
this.input.destroy();
this.cleanup();
output.emit('error', err);
});
}
/**
* Ends the output with an error and releases the cache file
*/
fail(err) {
this.hasErrored = true;
this.cleanup();
this.output.destroy(err);
}
cleanup() {
if (!this.cache || !this.cachePath) {
return;
}
const cache = this.cache;
this.cache = false;
cache.destroy();
node_fs_1.default.unlink(this.cachePath, () => false);
}
createReadCache() {
// pipe remainings to cache file
this.cache = node_fs_1.default.createReadStream(this.cachePath);
this.cache.once('error', err => {
this.cleanup();
this.output.emit('error', err);
});
this.cache.once('error', err => this.fail(err));
this.cache.once('close', () => {
this.cleanup();
});
this.cache.pipe(this.output);
}
sendNextChunk() {
while (!this.hasErrored) {
if (this.readPos >= this.chunks.length) {
if (!this.cache) {
this.output.end();
return;
}
return this.createReadCache();
}
const chunk = this.chunks[this.readPos++];
if (this.output.write(chunk) === false) {
this.output.once('drain', () => {
this.sendNextChunk();
});
return;
}
}
}
sendSignedOutput() {
if (this.hasErrored) {
return;
}
if (this.readPos >= this.chunks.length) {
if (!this.cache) {
this.output.end();
return;
}
return this.createReadCache();
}
const chunk = this.chunks[this.readPos++];
if (this.output.write(chunk) === false) {
this.output.once('drain', () => {
this.sendNextChunk();
});
return;
}
setImmediate(() => this.sendNextChunk());
}
sendSignedOutput() {
let keyPos = 0;
const signNextKey = () => {
if (keyPos >= this.keys.length) {
@@ -101,9 +117,7 @@ class DKIMSigner {
});
}
catch (err) {
this.hasErrored = true;
this.cleanup();
this.output.emit('error', err);
this.fail(err);
return;
}
if (dkimField) {
@@ -122,7 +136,6 @@ class DKIMSigner {
// pipe remainings to cache file
this.cache = node_fs_1.default.createWriteStream(this.cachePath);
this.cache.once('error', err => {
this.cleanup();
// drain input
this.relaxedBody.unpipe(this.cache);
this.relaxedBody.on('readable', () => {
@@ -130,11 +143,12 @@ class DKIMSigner {
// do nothing
}
});
this.hasErrored = true;
// emit error
this.output.emit('error', err);
this.fail(err);
});
this.cache.once('close', () => {
if (this.hasErrored) {
return;
}
this.sendSignedOutput();
});
this.relaxedBody.removeAllListeners('readable');
@@ -211,7 +225,7 @@ class DKIM {
catch (_E) {
// the body hash is created here, an unknown hashAlgo throws inside this timer
// where nothing else could catch it
output.emit('error', sign_js_1.default.unsupportedHashAlgoError(signer.hashAlgo));
signer.fail(sign_js_1.default.unsupportedHashAlgoError(signer.hashAlgo));
return;
}
if (writeValue) {
+2 -2
View File
@@ -107,7 +107,7 @@ class MessageParser extends node_stream_1.Transform {
const chunk = data.slice(headerPos);
this.bodySize += chunk.length;
// this would be the first chunk of data sent downstream
setImmediate(() => this.push(chunk));
this.push(chunk);
}
return false;
}
@@ -136,7 +136,7 @@ class MessageParser extends node_stream_1.Transform {
this.bodySize += chunk.length;
this.push(chunk);
}
setImmediate(callback);
callback();
}
/** @internal */
_flush(callback) {