@mavogel/awscdk-rootmail 0.1.23 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +4 -4
- package/lib/rootmail.js +1 -1
- package/lib/ses-receive.js +1 -1
- package/node_modules/@zone-eu/mailsplit/README.md +1 -1
- package/node_modules/@zone-eu/mailsplit/lib/headers.js +10 -4
- package/node_modules/@zone-eu/mailsplit/lib/message-splitter.js +5 -4
- package/node_modules/@zone-eu/mailsplit/lib/mime-node.d.ts +4 -1
- package/node_modules/@zone-eu/mailsplit/lib/mime-node.js +23 -2
- package/node_modules/@zone-eu/mailsplit/lib/types.d.ts +3 -1
- package/node_modules/@zone-eu/mailsplit/package.json +4 -4
- package/node_modules/libbase64/CHANGELOG.md +20 -0
- package/node_modules/libbase64/README.md +40 -13
- package/node_modules/libbase64/dist/cjs/libbase64.d.ts +80 -0
- package/node_modules/libbase64/dist/cjs/libbase64.js +310 -0
- package/node_modules/libbase64/dist/cjs/package.json +3 -0
- package/node_modules/libbase64/dist/esm/libbase64.d.ts +80 -0
- package/node_modules/libbase64/{lib → dist/esm}/libbase64.js +74 -117
- package/node_modules/libbase64/dist/esm/package.json +3 -0
- package/node_modules/libbase64/package.json +59 -13
- package/node_modules/libmime/CHANGELOG.md +31 -0
- package/node_modules/libmime/README.md +55 -26
- package/node_modules/libmime/SECURITY.md +152 -0
- package/node_modules/libmime/dist/cjs/charset.d.ts +43 -0
- package/node_modules/libmime/dist/cjs/charset.js +135 -0
- package/node_modules/libmime/dist/cjs/charsets.d.ts +2 -0
- package/node_modules/libmime/dist/cjs/charsets.js +213 -0
- package/node_modules/libmime/dist/cjs/get-charset-name.d.ts +1 -0
- package/node_modules/libmime/dist/cjs/get-charset-name.js +224 -0
- package/node_modules/libmime/dist/cjs/libmime.d.ts +218 -0
- package/node_modules/libmime/dist/cjs/libmime.js +1013 -0
- package/node_modules/libmime/dist/cjs/mimetypes.d.ts +7 -0
- package/node_modules/libmime/dist/cjs/mimetypes.js +2072 -0
- package/node_modules/libmime/dist/cjs/package.json +3 -0
- package/node_modules/libmime/dist/cjs/types.d.ts +59 -0
- package/node_modules/libmime/dist/cjs/types.js +4 -0
- package/node_modules/libmime/dist/esm/charset.d.ts +43 -0
- package/node_modules/libmime/dist/esm/charset.js +125 -0
- package/node_modules/libmime/dist/esm/charsets.d.ts +2 -0
- package/node_modules/libmime/{lib → dist/esm}/charsets.js +3 -5
- package/node_modules/libmime/dist/esm/get-charset-name.d.ts +1 -0
- package/node_modules/libmime/{lib → dist/esm}/get-charset-name.js +1 -8
- package/node_modules/libmime/dist/esm/libmime.d.ts +219 -0
- package/node_modules/libmime/{lib → dist/esm}/libmime.js +256 -329
- package/node_modules/libmime/dist/esm/mimetypes.d.ts +7 -0
- package/node_modules/libmime/dist/esm/mimetypes.js +2068 -0
- package/node_modules/libmime/dist/esm/package.json +3 -0
- package/node_modules/libmime/dist/esm/types.d.ts +59 -0
- package/node_modules/libmime/dist/esm/types.js +3 -0
- package/node_modules/libmime/package.json +58 -15
- package/node_modules/libqp/CHANGELOG.md +18 -0
- package/node_modules/libqp/README.md +50 -19
- package/node_modules/libqp/dist/cjs/libqp.d.ts +74 -0
- package/node_modules/libqp/dist/cjs/libqp.js +378 -0
- package/node_modules/libqp/dist/cjs/package.json +3 -0
- package/node_modules/libqp/dist/esm/libqp.d.ts +74 -0
- package/node_modules/libqp/dist/esm/libqp.js +369 -0
- package/node_modules/libqp/dist/esm/package.json +3 -0
- package/node_modules/libqp/lib/libqp.js +4 -383
- package/node_modules/libqp/lib/package.json +3 -0
- package/node_modules/libqp/package.json +62 -6
- package/node_modules/mailparser/.release-please-manifest.json +1 -1
- package/node_modules/mailparser/CHANGELOG.md +42 -0
- package/node_modules/mailparser/package.json +5 -5
- package/node_modules/nodemailer/CHANGELOG.md +44 -0
- package/node_modules/nodemailer/dist/cjs/addressparser/index.js +695 -267
- package/node_modules/nodemailer/dist/cjs/mailer/mail-message.js +4 -1
- package/node_modules/nodemailer/dist/cjs/mime-funcs/index.js +8 -2
- package/node_modules/nodemailer/dist/cjs/mime-node/index.js +48 -16
- package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
- package/node_modules/nodemailer/dist/cjs/shared/url.js +22 -5
- package/node_modules/nodemailer/dist/esm/addressparser/index.js +695 -267
- package/node_modules/nodemailer/dist/esm/mailer/mail-message.js +4 -1
- package/node_modules/nodemailer/dist/esm/mime-funcs/index.js +8 -2
- package/node_modules/nodemailer/dist/esm/mime-node/index.js +48 -16
- package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
- package/node_modules/nodemailer/dist/esm/shared/url.js +22 -5
- package/node_modules/nodemailer/package.json +1 -1
- package/package.json +3 -3
- package/node_modules/libbase64/.eslintrc +0 -11
- package/node_modules/libbase64/.github/FUNDING.yml +0 -4
- package/node_modules/libbase64/.github/VULNERABILITY_REPORT.yml +0 -75
- package/node_modules/libbase64/.github/workflows/release.yaml +0 -39
- package/node_modules/libbase64/.github/workflows/test.yml +0 -21
- package/node_modules/libbase64/.ncurc.js +0 -13
- package/node_modules/libbase64/.prettierrc.js +0 -8
- package/node_modules/libmime/lib/charset.js +0 -131
- package/node_modules/libmime/lib/mimetypes.js +0 -2049
- package/node_modules/libqp/.eslintrc +0 -15
- package/node_modules/libqp/.github/FUNDING.yml +0 -4
- package/node_modules/libqp/.github/VULNERABILITY_REPORT.yml +0 -75
- package/node_modules/libqp/.github/workflows/release.yaml +0 -39
- package/node_modules/libqp/.github/workflows/test.yml +0 -21
- package/node_modules/libqp/.prettierrc.js +0 -8
- package/node_modules/libqp/test/libqp-test.js +0 -366
|
@@ -1,385 +1,6 @@
|
|
|
1
|
-
/* eslint no-useless-escape: 0 */
|
|
2
|
-
|
|
3
1
|
'use strict';
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Encodes a Buffer into a Quoted-Printable encoded string
|
|
11
|
-
*
|
|
12
|
-
* @param {Buffer} buffer Buffer to convert
|
|
13
|
-
* @returns {String} Quoted-Printable encoded string
|
|
14
|
-
*/
|
|
15
|
-
function encode(buffer) {
|
|
16
|
-
if (typeof buffer === 'string') {
|
|
17
|
-
buffer = Buffer.from(buffer, 'utf-8');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return encodeBytes(buffer, true);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Encodes the bytes of a Buffer. The Encoder stream feeds it one chunk at a time, so it has
|
|
25
|
-
* to be told whether the first byte starts an output line, which a plain encode() call always does
|
|
26
|
-
*
|
|
27
|
-
* @param {Buffer} buffer Buffer to convert
|
|
28
|
-
* @param {Boolean} lineStart True if the first byte starts a line
|
|
29
|
-
* @returns {String} Quoted-Printable encoded string
|
|
30
|
-
*/
|
|
31
|
-
function encodeBytes(buffer, lineStart) {
|
|
32
|
-
// usable characters that do not need encoding
|
|
33
|
-
let ranges = [
|
|
34
|
-
// https://tools.ietf.org/html/rfc2045#section-6.7
|
|
35
|
-
[0x09], // <TAB>
|
|
36
|
-
[0x0a], // <LF>
|
|
37
|
-
[0x0d], // <CR>
|
|
38
|
-
[0x20, 0x3c], // <SP>!"#$%&'()*+,-./0123456789:;
|
|
39
|
-
[0x3e, 0x7e] // >?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}
|
|
40
|
-
];
|
|
41
|
-
let result = '';
|
|
42
|
-
let ord;
|
|
43
|
-
|
|
44
|
-
for (let i = 0, len = buffer.length; i < len; i++) {
|
|
45
|
-
ord = buffer[i];
|
|
46
|
-
// if the char is in allowed range, then keep as is, unless it is a ws in the end of a line
|
|
47
|
-
// or a hyphen in the start of a line. A line starting with two hyphens reads as a MIME
|
|
48
|
-
// boundary delimiter, so a decoded body that gets encoded again could inject a part
|
|
49
|
-
if (
|
|
50
|
-
checkRanges(ord, ranges) &&
|
|
51
|
-
!((ord === 0x20 || ord === 0x09) && (i === len - 1 || buffer[i + 1] === 0x0a || buffer[i + 1] === 0x0d)) &&
|
|
52
|
-
!(ord === 0x2d && (i === 0 ? lineStart : buffer[i - 1] === 0x0a))
|
|
53
|
-
) {
|
|
54
|
-
result += String.fromCharCode(ord);
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
result += '=' + (ord < 0x10 ? '0' : '') + ord.toString(16).toUpperCase();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Decodes a Quoted-Printable encoded string to a Buffer object
|
|
65
|
-
*
|
|
66
|
-
* @param {String|Buffer} str Quoted-Printable encoded string. A Buffer is read byte for byte,
|
|
67
|
-
* so raw 8-bit bytes in the input are copied to the output unchanged
|
|
68
|
-
* @returns {Buffer} Decoded value
|
|
69
|
-
*/
|
|
70
|
-
function decode(str) {
|
|
71
|
-
// 'binary' maps every byte to one char code 0-255. A UTF-8 read would collapse raw
|
|
72
|
-
// multi-byte chars into one byte below and turn raw latin1 bytes into U+FFFD
|
|
73
|
-
str = (Buffer.isBuffer(str) ? str.toString('binary') : (str || '').toString())
|
|
74
|
-
// remove invalid whitespace from the end of lines. The leading group keeps this linear,
|
|
75
|
-
// a plain /[\t ]+$/gm rescans the rest of a whitespace run from every position inside it,
|
|
76
|
-
// which is quadratic. The lookahead lists the line terminators multiline $ matches before
|
|
77
|
-
.replace(/(^|[^ \t])[ \t]+(?=[\n\r\u2028\u2029]|$)/g, '$1')
|
|
78
|
-
// remove soft line breaks
|
|
79
|
-
.replace(/\=(?:\r?\n|$)/g, '');
|
|
80
|
-
|
|
81
|
-
// every =XX escape decodes into one byte, so count them to size the output.
|
|
82
|
-
// Counted with a loop, a match() would build an array with a string for every escape
|
|
83
|
-
let len = str.length;
|
|
84
|
-
let encodedBytesCount = 0;
|
|
85
|
-
for (let i = str.indexOf('='); i >= 0 && i < len - 2; i = str.indexOf('=', i + 1)) {
|
|
86
|
-
if (hexValue(str.charCodeAt(i + 1)) >= 0 && hexValue(str.charCodeAt(i + 2)) >= 0) {
|
|
87
|
-
encodedBytesCount++;
|
|
88
|
-
i += 2;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
let buffer = Buffer.alloc(len - encodedBytesCount * 2);
|
|
93
|
-
let bufferPos = 0;
|
|
94
|
-
|
|
95
|
-
for (let i = 0; i < len; i++) {
|
|
96
|
-
let code = str.charCodeAt(i);
|
|
97
|
-
if (code === 0x3d /* = */ && i < len - 2) {
|
|
98
|
-
let hi = hexValue(str.charCodeAt(i + 1));
|
|
99
|
-
let lo = hexValue(str.charCodeAt(i + 2));
|
|
100
|
-
if (hi >= 0 && lo >= 0) {
|
|
101
|
-
buffer[bufferPos++] = hi * 16 + lo;
|
|
102
|
-
i += 2;
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
buffer[bufferPos++] = code;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return buffer;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Helper function to read the value of a hex digit
|
|
114
|
-
*
|
|
115
|
-
* @param {Number} code Char code
|
|
116
|
-
* @returns {Number} 0-15, or -1 if the char is not a hex digit
|
|
117
|
-
*/
|
|
118
|
-
function hexValue(code) {
|
|
119
|
-
if (code >= 0x30 && code <= 0x39) {
|
|
120
|
-
return code - 0x30; // 0-9
|
|
121
|
-
}
|
|
122
|
-
if (code >= 0x41 && code <= 0x46) {
|
|
123
|
-
return code - 0x41 + 10; // A-F
|
|
124
|
-
}
|
|
125
|
-
if (code >= 0x61 && code <= 0x66) {
|
|
126
|
-
return code - 0x61 + 10; // a-f
|
|
127
|
-
}
|
|
128
|
-
return -1;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Adds soft line breaks to a Quoted-Printable string
|
|
133
|
-
*
|
|
134
|
-
* @param {String} str Quoted-Printable encoded string that might need line wrapping
|
|
135
|
-
* @param {Number} [lineLength=76] Maximum allowed length for a line
|
|
136
|
-
* @returns {String} Soft-wrapped Quoted-Printable encoded string
|
|
137
|
-
*/
|
|
138
|
-
function wrap(str, lineLength) {
|
|
139
|
-
str = (str || '').toString();
|
|
140
|
-
lineLength = lineLength || 76;
|
|
141
|
-
|
|
142
|
-
if (str.length <= lineLength) {
|
|
143
|
-
return str;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
let pos = 0,
|
|
147
|
-
len = str.length,
|
|
148
|
-
match,
|
|
149
|
-
code,
|
|
150
|
-
line,
|
|
151
|
-
maxLength,
|
|
152
|
-
afterSoftBreak = false,
|
|
153
|
-
lineMargin = Math.floor(lineLength / 3),
|
|
154
|
-
result = '';
|
|
155
|
-
|
|
156
|
-
// insert soft linebreaks where needed
|
|
157
|
-
while (pos < len) {
|
|
158
|
-
maxLength = lineLength;
|
|
159
|
-
|
|
160
|
-
if (afterSoftBreak) {
|
|
161
|
-
afterSoftBreak = false;
|
|
162
|
-
// a line started by a soft break must not begin with a hyphen either, see encode().
|
|
163
|
-
// The escape takes the room of three characters off this line
|
|
164
|
-
if (str.charAt(pos) === '-') {
|
|
165
|
-
result += '=2D';
|
|
166
|
-
pos++;
|
|
167
|
-
maxLength -= 3;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
line = str.substr(pos, maxLength);
|
|
172
|
-
if ((match = line.match(/\r\n/))) {
|
|
173
|
-
line = line.substr(0, match.index + match[0].length);
|
|
174
|
-
result += line;
|
|
175
|
-
pos += line.length;
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (line.substr(-1) === '\n') {
|
|
180
|
-
// nothing to change here
|
|
181
|
-
result += line;
|
|
182
|
-
pos += line.length;
|
|
183
|
-
continue;
|
|
184
|
-
} else if ((match = line.substr(-lineMargin).match(/\n.*?$/))) {
|
|
185
|
-
// truncate to nearest line break
|
|
186
|
-
line = line.substr(0, line.length - (match[0].length - 1));
|
|
187
|
-
result += line;
|
|
188
|
-
pos += line.length;
|
|
189
|
-
continue;
|
|
190
|
-
} else if (line.length > maxLength - lineMargin && (match = line.substr(-lineMargin).match(/[ \t\.,!\?][^ \t\.,!\?]*$/))) {
|
|
191
|
-
// truncate to nearest space
|
|
192
|
-
line = line.substr(0, line.length - (match[0].length - 1));
|
|
193
|
-
} else if (line.match(/\=[\da-f]{0,2}$/i)) {
|
|
194
|
-
// push incomplete encoding sequences to the next line
|
|
195
|
-
if ((match = line.match(/\=[\da-f]{0,1}$/i))) {
|
|
196
|
-
line = line.substr(0, line.length - match[0].length);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// ensure that utf-8 sequences are not split
|
|
200
|
-
while (line.length > 3 && line.length < len - pos && !line.match(/^(?:=[\da-f]{2}){1,4}$/i) && (match = line.match(/\=[\da-f]{2}$/gi))) {
|
|
201
|
-
code = parseInt(match[0].substr(1, 2), 16);
|
|
202
|
-
if (code < 128) {
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
line = line.substr(0, line.length - 3);
|
|
207
|
-
|
|
208
|
-
if (code >= 0xc0) {
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (pos + line.length < len && line.substr(-1) !== '\n') {
|
|
215
|
-
if (line.length === maxLength && line.match(/\=[\da-f]{2}$/i)) {
|
|
216
|
-
line = line.substr(0, line.length - 3);
|
|
217
|
-
} else if (line.length === maxLength) {
|
|
218
|
-
line = line.substr(0, line.length - 1);
|
|
219
|
-
}
|
|
220
|
-
pos += line.length;
|
|
221
|
-
line += '=\r\n';
|
|
222
|
-
afterSoftBreak = true;
|
|
223
|
-
} else {
|
|
224
|
-
pos += line.length;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
result += line;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return result;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Helper function to check if a number is inside provided ranges
|
|
235
|
-
*
|
|
236
|
-
* @param {Number} nr Number to check for
|
|
237
|
-
* @param {Array} ranges An Array of allowed values
|
|
238
|
-
* @returns {Boolean} True if the value was found inside allowed ranges, false otherwise
|
|
239
|
-
*/
|
|
240
|
-
function checkRanges(nr, ranges) {
|
|
241
|
-
for (let i = ranges.length - 1; i >= 0; i--) {
|
|
242
|
-
if (!ranges[i].length) {
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
245
|
-
if (ranges[i].length === 1 && nr === ranges[i][0]) {
|
|
246
|
-
return true;
|
|
247
|
-
}
|
|
248
|
-
if (ranges[i].length === 2 && nr >= ranges[i][0] && nr <= ranges[i][1]) {
|
|
249
|
-
return true;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Creates a transform stream for encoding data to Quoted-Printable encoding
|
|
257
|
-
*
|
|
258
|
-
* @constructor
|
|
259
|
-
* @param {Object} options Stream options
|
|
260
|
-
* @param {Number} [options.lineLength=76] Maximum lenght for lines, set to false to disable wrapping
|
|
261
|
-
*/
|
|
262
|
-
class Encoder extends Transform {
|
|
263
|
-
constructor(options) {
|
|
264
|
-
super();
|
|
265
|
-
|
|
266
|
-
// init Transform
|
|
267
|
-
this.options = options || {};
|
|
268
|
-
|
|
269
|
-
if (this.options.lineLength !== false) {
|
|
270
|
-
this.options.lineLength = this.options.lineLength || 76;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
this._curLine = '';
|
|
274
|
-
// true until a chunk that does not end with a line break has been encoded
|
|
275
|
-
this._lineStart = true;
|
|
276
|
-
|
|
277
|
-
this.inputBytes = 0;
|
|
278
|
-
this.outputBytes = 0;
|
|
279
|
-
|
|
280
|
-
Transform.call(this, this.options);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
_transform(chunk, encoding, done) {
|
|
284
|
-
let qp;
|
|
285
|
-
|
|
286
|
-
if (encoding !== 'buffer') {
|
|
287
|
-
chunk = Buffer.from(chunk, encoding);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
if (!chunk || !chunk.length) {
|
|
291
|
-
return done();
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
this.inputBytes += chunk.length;
|
|
295
|
-
|
|
296
|
-
let lineStart = this._lineStart;
|
|
297
|
-
this._lineStart = chunk[chunk.length - 1] === 0x0a;
|
|
298
|
-
|
|
299
|
-
if (this.options.lineLength) {
|
|
300
|
-
qp = this._curLine + encodeBytes(chunk, lineStart);
|
|
301
|
-
qp = wrap(qp, this.options.lineLength);
|
|
302
|
-
qp = qp.replace(/(^|\n)([^\n]*)$/, (match, lineBreak, lastLine) => {
|
|
303
|
-
this._curLine = lastLine;
|
|
304
|
-
return lineBreak;
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
if (qp) {
|
|
308
|
-
this.outputBytes += qp.length;
|
|
309
|
-
this.push(qp);
|
|
310
|
-
}
|
|
311
|
-
} else {
|
|
312
|
-
qp = encodeBytes(chunk, lineStart);
|
|
313
|
-
this.outputBytes += qp.length;
|
|
314
|
-
this.push(qp, 'ascii');
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
done();
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
_flush(done) {
|
|
321
|
-
if (this._curLine) {
|
|
322
|
-
this.outputBytes += this._curLine.length;
|
|
323
|
-
this.push(this._curLine, 'ascii');
|
|
324
|
-
}
|
|
325
|
-
done();
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Creates a transform stream for decoding Quoted-Printable encoded strings
|
|
331
|
-
* The input is not actually processed as a stream but concatted and processed as a single input
|
|
332
|
-
*
|
|
333
|
-
* @constructor
|
|
334
|
-
* @param {Object} options Stream options
|
|
335
|
-
*/
|
|
336
|
-
class Decoder extends Transform {
|
|
337
|
-
constructor(options) {
|
|
338
|
-
options = options || {};
|
|
339
|
-
super(options);
|
|
340
|
-
|
|
341
|
-
// init Transform
|
|
342
|
-
this.options = options;
|
|
343
|
-
this._curLine = '';
|
|
344
|
-
|
|
345
|
-
this.inputBytes = 0;
|
|
346
|
-
this.outputBytes = 0;
|
|
347
|
-
|
|
348
|
-
this.qpChunks = [];
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
_transform(chunk, encoding, done) {
|
|
352
|
-
if (!chunk || !chunk.length) {
|
|
353
|
-
return done();
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
if (typeof chunk === 'string') {
|
|
357
|
-
chunk = Buffer.from(chunk, encoding);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// kept as a binary string, so joining the chunks is the only copy made before decoding
|
|
361
|
-
this.qpChunks.push(chunk.toString('binary'));
|
|
362
|
-
this.inputBytes += chunk.length;
|
|
363
|
-
|
|
364
|
-
done();
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
_flush(done) {
|
|
368
|
-
if (this.inputBytes) {
|
|
369
|
-
let buf = decode(this.qpChunks.join(''));
|
|
370
|
-
this.outputBytes += buf.length;
|
|
371
|
-
this.push(buf);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
done();
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// expose to the world
|
|
379
|
-
module.exports = {
|
|
380
|
-
encode,
|
|
381
|
-
decode,
|
|
382
|
-
wrap,
|
|
383
|
-
Encoder,
|
|
384
|
-
Decoder
|
|
385
|
-
};
|
|
3
|
+
// The pre-TypeScript entry point. Node resolves `libqp/lib/libqp` through the exports map and
|
|
4
|
+
// never loads this file, but resolvers that look for the path on disk and ignore the exports map
|
|
5
|
+
// (webpack 4, browserify, and @yao/pkg, which warns about the import without it) still find it.
|
|
6
|
+
module.exports = require('../dist/cjs/libqp.js');
|
|
@@ -1,11 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libqp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Encode and decode quoted-printable strings according to rfc2045",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/cjs/libqp.js",
|
|
7
|
+
"types": "./dist/cjs/libqp.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
"*": {
|
|
10
|
+
"lib/*": [
|
|
11
|
+
"dist/cjs/*.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/esm/libqp.js",
|
|
18
|
+
"require": "./dist/cjs/libqp.js"
|
|
19
|
+
},
|
|
20
|
+
"./lib/libqp.js": {
|
|
21
|
+
"import": "./dist/esm/libqp.js",
|
|
22
|
+
"require": "./dist/cjs/libqp.js"
|
|
23
|
+
},
|
|
24
|
+
"./lib/libqp": {
|
|
25
|
+
"import": "./dist/esm/libqp.js",
|
|
26
|
+
"require": "./dist/cjs/libqp.js"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"lib",
|
|
33
|
+
"CHANGELOG.md",
|
|
34
|
+
"SECURITY.md"
|
|
35
|
+
],
|
|
6
36
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
37
|
+
"build": "node scripts/build.js",
|
|
38
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
39
|
+
"pretest": "npm run build",
|
|
40
|
+
"test": "node --import tsx --test $(find test -name '*-test.ts')",
|
|
41
|
+
"pretest:coverage": "npm run build",
|
|
42
|
+
"test:coverage": "c8 node --import tsx --test $(find test -name '*-test.ts')",
|
|
43
|
+
"pretest:bun": "npm run build",
|
|
44
|
+
"test:bun": "bun test --timeout 60000 $(find ./test -name '*-test.ts')",
|
|
45
|
+
"format": "prettier --write \"**/*.{js,cjs,ts,json,md,yml,yaml}\"",
|
|
46
|
+
"format:check": "prettier --check \"**/*.{js,cjs,ts,json,md,yml,yaml}\"",
|
|
47
|
+
"lint": "npm run typecheck && eslint .",
|
|
48
|
+
"lint:fix": "eslint . --fix",
|
|
49
|
+
"prepare": "npm run build",
|
|
50
|
+
"update": "rm -rf node_modules package-lock.json && ncu -u && npm install",
|
|
51
|
+
"test:mutation": "node scripts/mutation-test.js",
|
|
52
|
+
"test:fuzz": "FUZZ_ITERATIONS=${FUZZ_ITERATIONS:-20000} FUZZ_SEED=${FUZZ_SEED:-random} node --import tsx --test test/property-test.ts test/legacy-test.ts"
|
|
9
53
|
},
|
|
10
54
|
"repository": {
|
|
11
55
|
"type": "git",
|
|
@@ -22,7 +66,19 @@
|
|
|
22
66
|
},
|
|
23
67
|
"homepage": "https://github.com/nodemailer/libqp",
|
|
24
68
|
"devDependencies": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
69
|
+
"@types/node": "20.19.43",
|
|
70
|
+
"c8": "12.0.0",
|
|
71
|
+
"eslint": "10.13.0",
|
|
72
|
+
"eslint-config-prettier": "10.1.8",
|
|
73
|
+
"fast-check": "4.10.2",
|
|
74
|
+
"globals": "17.13.0",
|
|
75
|
+
"libqp-legacy": "npm:libqp@2.1.3",
|
|
76
|
+
"prettier": "3.9.10",
|
|
77
|
+
"tsx": "4.23.15",
|
|
78
|
+
"typescript": "6.0.3",
|
|
79
|
+
"typescript-eslint": "8.71.2"
|
|
80
|
+
},
|
|
81
|
+
"engines": {
|
|
82
|
+
"node": ">=20.0.0"
|
|
27
83
|
}
|
|
28
84
|
}
|
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.9.46](https://github.com/nodemailer/mailparser/compare/v3.9.45...v3.9.46) (2026-10-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* bump libmime to 5.5.1, @zone-eu/mailsplit to 5.4.26 and nodemailer to 10.1.7 ([7279da5](https://github.com/nodemailer/mailparser/commit/7279da5c906cc7c155bdee16e6f10327d8e054ff))
|
|
9
|
+
|
|
10
|
+
## [3.9.45](https://github.com/nodemailer/mailparser/compare/v3.9.44...v3.9.45) (2026-10-18)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* bump nodemailer to 10.1.6 ([2815d34](https://github.com/nodemailer/mailparser/commit/2815d34e689c4b78b2e2633ae5e4b97fa7e24ebf))
|
|
16
|
+
|
|
17
|
+
## [3.9.44](https://github.com/nodemailer/mailparser/compare/v3.9.43...v3.9.44) (2026-10-18)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* bump nodemailer to 10.1.5 ([218b801](https://github.com/nodemailer/mailparser/commit/218b8014016eb79969788b92b8981f49c799a05e))
|
|
23
|
+
|
|
24
|
+
## [3.9.43](https://github.com/nodemailer/mailparser/compare/v3.9.42...v3.9.43) (2026-10-18)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* bump nodemailer to 10.1.4 ([3c68409](https://github.com/nodemailer/mailparser/commit/3c68409192cc34299ddc2479a1429ec218c1a4b9))
|
|
30
|
+
|
|
31
|
+
## [3.9.42](https://github.com/nodemailer/mailparser/compare/v3.9.41...v3.9.42) (2026-10-18)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* bump @zone-eu/mailsplit to 5.4.25 ([e4500fb](https://github.com/nodemailer/mailparser/commit/e4500fbd7cc5e0e0b1f070332bf797a5e331e5c7))
|
|
37
|
+
|
|
38
|
+
## [3.9.41](https://github.com/nodemailer/mailparser/compare/v3.9.40...v3.9.41) (2026-10-18)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* bump @zone-eu/mailsplit to 5.4.24 ([eb4b34b](https://github.com/nodemailer/mailparser/commit/eb4b34b04b18de974a3bd61c295d2abca1eb0d69))
|
|
44
|
+
|
|
3
45
|
## [3.9.40](https://github.com/nodemailer/mailparser/compare/v3.9.39...v3.9.40) (2026-10-16)
|
|
4
46
|
|
|
5
47
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mailparser",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.46",
|
|
4
4
|
"description": "Parse e-mails",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
],
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@zone-eu/mailsplit": "5.4.
|
|
21
|
+
"@zone-eu/mailsplit": "5.4.26",
|
|
22
22
|
"encoding-japanese": "2.4.0",
|
|
23
23
|
"he": "1.2.0",
|
|
24
24
|
"html-to-text": "10.0.1",
|
|
25
25
|
"iconv-lite": "0.7.3",
|
|
26
|
-
"libmime": "5.
|
|
26
|
+
"libmime": "5.5.1",
|
|
27
27
|
"linkify-it": "5.0.2",
|
|
28
|
-
"nodemailer": "10.1.
|
|
28
|
+
"nodemailer": "10.1.7",
|
|
29
29
|
"punycode.js": "2.3.1",
|
|
30
30
|
"tlds": "1.261.0"
|
|
31
31
|
},
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@eslint/eslintrc": "3.3.7",
|
|
34
34
|
"@eslint/js": "10.0.1",
|
|
35
35
|
"ajv": "8.20.0",
|
|
36
|
-
"eslint": "10.
|
|
36
|
+
"eslint": "10.13.0",
|
|
37
37
|
"eslint-config-nodemailer": "1.2.0",
|
|
38
38
|
"eslint-config-prettier": "10.1.8",
|
|
39
39
|
"grunt": "1.6.3",
|
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## [10.1.7](https://github.com/nodemailer/nodemailer/compare/v10.1.6...v10.1.7) (2026-10-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **mime-funcs:** encode parameter values that look like encoded words ([651d79b](https://github.com/nodemailer/nodemailer/commit/651d79b0e1067b93b0ae8fc1afbdf383a46c214d))
|
|
9
|
+
|
|
10
|
+
## [10.1.6](https://github.com/nodemailer/nodemailer/compare/v10.1.5...v10.1.6) (2026-10-18)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **addressparser:** read groups in the same pass as the rest of the list ([ddf0de1](https://github.com/nodemailer/nodemailer/commit/ddf0de1e7615908101bf593c62edcadccc05c8d3))
|
|
16
|
+
|
|
17
|
+
## [10.1.5](https://github.com/nodemailer/nodemailer/compare/v10.1.4...v10.1.5) (2026-10-18)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **addressparser:** handle an address list without copying it per address ([6bd09b3](https://github.com/nodemailer/nodemailer/commit/6bd09b395cb7ffd1b0ae95f960f3985ba9c25afb))
|
|
23
|
+
* **addressparser:** tokenize into offsets instead of an object per token ([3fd3f50](https://github.com/nodemailer/nodemailer/commit/3fd3f50ce86671884896ef1eaddafff5e137f820))
|
|
24
|
+
|
|
25
|
+
## [10.1.4](https://github.com/nodemailer/nodemailer/compare/v10.1.3...v10.1.4) (2026-10-18)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **addressparser:** apply the unexpected "<" rule outside quotes and comments ([ee35f57](https://github.com/nodemailer/nodemailer/commit/ee35f5745658bf46952651fa53207255e9dc3406))
|
|
31
|
+
* **addressparser:** bound group nesting at ten levels ([ce63303](https://github.com/nodemailer/nodemailer/commit/ce633031d58f8d2e9c9b0f5b671944a1afe71f95))
|
|
32
|
+
* **addressparser:** drop the obsolete route from an angle-addr ([3dbc730](https://github.com/nodemailer/nodemailer/commit/3dbc7304b0cfa06551543fa2dc01222447c2b554))
|
|
33
|
+
* **addressparser:** end a comment only at the ")" that closes the outermost one ([0a87617](https://github.com/nodemailer/nodemailer/commit/0a8761762ac78f2db2ba37f712f2a52a404ce011))
|
|
34
|
+
* **addressparser:** honour quoted strings and comments inside an angle-addr and a group ([1cd57d2](https://github.com/nodemailer/nodemailer/commit/1cd57d2b8c49dff048c21cdbafdb54439a7f07e2))
|
|
35
|
+
* **addressparser:** never read a mailbox out of a comment ([a1538ea](https://github.com/nodemailer/nodemailer/commit/a1538ea39c76c48a4134806c41e31e59a258b1e5))
|
|
36
|
+
* **addressparser:** read CFWS beside the "@" of an addr-spec as nothing ([ba3c095](https://github.com/nodemailer/nodemailer/commit/ba3c0952542581f95cb20d9322cc9e27baa470a2))
|
|
37
|
+
* **addressparser:** read the first addr-spec of the display text ([038940a](https://github.com/nodemailer/nodemailer/commit/038940a069a2cecb64a70d0e81b17eb8ce200d3a))
|
|
38
|
+
* split a domain literal off at the "@" in front of it ([d5983b0](https://github.com/nodemailer/nodemailer/commit/d5983b0ae234cd22ab45be817fefd434e9a53d58))
|
|
39
|
+
|
|
40
|
+
## [10.1.3](https://github.com/nodemailer/nodemailer/compare/v10.1.2...v10.1.3) (2026-10-18)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
* format References and strip URLs in linear time, release any number of streams ([2f18641](https://github.com/nodemailer/nodemailer/commit/2f186418cf6c8fff18f235d4318892fd42f810fa))
|
|
46
|
+
|
|
3
47
|
## [10.1.2](https://github.com/nodemailer/nodemailer/compare/v10.1.1...v10.1.2) (2026-10-16)
|
|
4
48
|
|
|
5
49
|
|