@mavogel/awscdk-rootmail 0.1.25 → 0.1.26

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.
Files changed (170) hide show
  1. package/.jsii +9 -9
  2. package/lib/rootmail.js +1 -1
  3. package/lib/ses-receive.js +1 -1
  4. package/lib/ses-receive.ops-santa-handler.js +2 -2
  5. package/node_modules/@aws-sdk/checksums/package.json +3 -3
  6. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +9 -7
  7. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/schemas/schemas_0.js +11 -6
  8. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DescribeDeliveriesCommand.d.ts +3 -0
  9. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DescribeDeliveryDestinationsCommand.d.ts +3 -0
  10. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DescribeDeliverySourcesCommand.d.ts +3 -0
  11. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/PutResourcePolicyCommand.d.ts +1 -1
  12. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/models/models_0.d.ts +27 -1
  13. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/models/models_0.d.ts +3 -0
  14. package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +4 -4
  15. package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
  16. package/node_modules/@aws-sdk/client-route-53/package.json +4 -4
  17. package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +1 -1
  18. package/node_modules/@aws-sdk/client-s3/package.json +7 -7
  19. package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
  20. package/node_modules/@aws-sdk/client-ses/package.json +4 -4
  21. package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +1 -1
  22. package/node_modules/@aws-sdk/client-ssm/package.json +4 -4
  23. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +94 -1589
  24. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +1 -7
  25. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -3
  26. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +1 -3
  27. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +2 -8
  28. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
  29. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
  30. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
  31. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
  32. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +10 -10
  33. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
  34. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
  35. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
  36. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
  37. package/node_modules/@aws-sdk/core/package.json +2 -2
  38. package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
  39. package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -3
  40. package/node_modules/@aws-sdk/credential-provider-ini/package.json +10 -10
  41. package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
  42. package/node_modules/@aws-sdk/credential-provider-node/package.json +8 -8
  43. package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
  44. package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
  45. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
  46. package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +3 -3
  47. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  48. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  49. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  50. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  51. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  52. package/node_modules/@aws-sdk/nested-clients/package.json +3 -3
  53. package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +37 -19
  54. package/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +37 -19
  55. package/node_modules/@aws-sdk/token-providers/package.json +4 -4
  56. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +1695 -3
  57. package/node_modules/@smithy/core/dist-es/submodules/protocols/ConfigurableSerdeContext.js +6 -0
  58. package/node_modules/@smithy/core/dist-es/submodules/protocols/UnionSerde.js +26 -0
  59. package/node_modules/@smithy/core/dist-es/submodules/protocols/common.js +3 -0
  60. package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +8 -0
  61. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +102 -0
  62. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +8 -1
  63. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +8 -1
  64. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +13 -2
  65. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +11 -1
  66. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/parseJsonBody.js +16 -1
  67. package/node_modules/@smithy/core/dist-es/submodules/protocols/writeKey.js +3 -0
  68. package/node_modules/@smithy/core/dist-types/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
  69. package/node_modules/@smithy/core/dist-types/submodules/protocols/UnionSerde.d.ts +24 -0
  70. package/node_modules/@smithy/core/dist-types/submodules/protocols/common.d.ts +2 -0
  71. package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +9 -0
  72. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/JsonSettings.d.ts +13 -0
  73. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +28 -0
  74. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/parseJsonBody.d.ts +16 -0
  75. package/node_modules/@smithy/core/dist-types/submodules/protocols/writeKey.d.ts +4 -0
  76. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
  77. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/UnionSerde.d.ts +24 -0
  78. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/common.d.ts +2 -0
  79. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +9 -0
  80. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/JsonSettings.d.ts +13 -0
  81. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +28 -0
  82. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonCodec.d.ts +15 -11
  83. package/node_modules/{@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json → @smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1}/JsonSettings.d.ts +7 -4
  84. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +14 -0
  85. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +29 -0
  86. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +51 -0
  87. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +13 -9
  88. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +30 -0
  89. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +60 -0
  90. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +1 -1
  91. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +21 -0
  92. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +15 -0
  93. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +11 -0
  94. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +38 -0
  95. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/writeKey.d.ts +4 -0
  96. package/node_modules/@smithy/core/package.json +2 -1
  97. package/node_modules/@zone-eu/mailsplit/README.md +43 -54
  98. package/node_modules/@zone-eu/mailsplit/lib/mime-node.js +7 -3
  99. package/node_modules/@zone-eu/mailsplit/package.json +20 -15
  100. package/node_modules/libmime/CHANGELOG.md +7 -0
  101. package/node_modules/libmime/dist/cjs/libmime.js +24 -10
  102. package/node_modules/libmime/dist/esm/libmime.js +24 -10
  103. package/node_modules/libmime/package.json +3 -1
  104. package/node_modules/mailparser/CHANGELOG.md +14 -0
  105. package/node_modules/mailparser/README.md +6 -0
  106. package/node_modules/mailparser/dist/cjs/index.d.ts +10 -0
  107. package/node_modules/mailparser/dist/cjs/index.js +12 -0
  108. package/node_modules/mailparser/dist/cjs/mail-parser.d.ts +98 -0
  109. package/node_modules/mailparser/dist/cjs/mail-parser.js +1419 -0
  110. package/node_modules/mailparser/dist/cjs/package.json +3 -0
  111. package/node_modules/mailparser/dist/cjs/simple-parser.d.ts +17 -0
  112. package/node_modules/mailparser/dist/cjs/simple-parser.js +133 -0
  113. package/node_modules/mailparser/dist/cjs/stream-hash.d.ts +24 -0
  114. package/node_modules/mailparser/dist/cjs/stream-hash.js +33 -0
  115. package/node_modules/mailparser/dist/cjs/tlds.cjs +8 -0
  116. package/node_modules/mailparser/dist/cjs/types.d.ts +309 -0
  117. package/node_modules/mailparser/dist/cjs/types.js +2 -0
  118. package/node_modules/mailparser/dist/esm/index.d.ts +10 -0
  119. package/node_modules/mailparser/dist/esm/index.js +4 -0
  120. package/node_modules/mailparser/dist/esm/mail-parser.d.ts +98 -0
  121. package/node_modules/mailparser/{lib → dist/esm}/mail-parser.js +302 -368
  122. package/node_modules/mailparser/dist/esm/package.json +3 -0
  123. package/node_modules/mailparser/dist/esm/simple-parser.d.ts +17 -0
  124. package/node_modules/mailparser/{lib → dist/esm}/simple-parser.js +45 -68
  125. package/node_modules/mailparser/dist/esm/stream-hash.d.ts +24 -0
  126. package/node_modules/mailparser/{lib → dist/esm}/stream-hash.js +7 -9
  127. package/node_modules/mailparser/dist/esm/tlds.cjs +8 -0
  128. package/node_modules/mailparser/dist/esm/types.d.ts +309 -0
  129. package/node_modules/mailparser/dist/esm/types.js +1 -0
  130. package/node_modules/mailparser/package.json +86 -15
  131. package/package.json +9 -9
  132. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -7
  133. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -4
  134. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -13
  135. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -18
  136. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -27
  137. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -15
  138. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -39
  139. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +0 -7
  140. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +0 -7
  141. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +0 -2
  142. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +0 -14
  143. package/node_modules/mailparser/.gitattributes +0 -1
  144. package/node_modules/mailparser/.prettierignore +0 -3
  145. package/node_modules/mailparser/.prettierrc.js +0 -10
  146. package/node_modules/mailparser/.release-please-manifest.json +0 -3
  147. package/node_modules/mailparser/eslint.config.js +0 -33
  148. package/node_modules/mailparser/index.js +0 -9
  149. package/node_modules/mailparser/release-please-config.json +0 -10
  150. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/JsonSettings.js +0 -0
  151. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js +0 -0
  152. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +0 -0
  153. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +0 -0
  154. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +0 -0
  155. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/detectBufferParsing.js +0 -0
  156. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/jsonReplacer.js +0 -0
  157. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/jsonReviver.js +0 -0
  158. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/needsReviver.js +0 -0
  159. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonCodec.d.ts +0 -0
  160. /package/node_modules/{@aws-sdk/core/dist-types/submodules/protocols/json → @smithy/core/dist-types/submodules/protocols/json/codec-v1}/JsonSettings.d.ts +0 -0
  161. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -0
  162. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -0
  163. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -0
  164. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +0 -0
  165. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -0
  166. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -0
  167. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/detectBufferParsing.d.ts +0 -0
  168. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/jsonReplacer.d.ts +0 -0
  169. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/jsonReviver.d.ts +0 -0
  170. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/needsReviver.d.ts +0 -0
@@ -121,7 +121,9 @@ class Libmime {
121
121
  // The current paragraph is kept as a list of non-empty pieces and joined once when it
122
122
  // ends. Appending to one string and testing it with a regex on every line re-scans (and
123
123
  // flattens) the whole paragraph each time, which is quadratic on long soft-wrapped bodies.
124
- let parts = [], partsLength = 0;
124
+ let parts = [], partsLength = 0,
125
+ // quote depth and the original quote prefix ("> ", ">>" ...) of the current paragraph
126
+ depth = 0, prefix = '';
125
127
  let pushPart = (part) => {
126
128
  if (part) {
127
129
  parts.push(part);
@@ -132,11 +134,20 @@ class Libmime {
132
134
  // soft linebreaks are added after space symbols
133
135
  for (let i = 0; i < lines.length; i++) {
134
136
  let line = lines[i];
137
+ // RFC 3676 section 4.5: a quoted line starts with one or more ">" characters and the one
138
+ // space directly after them is space-stuffing. The quote marker is not content, so a soft
139
+ // line break only joins lines of the same quote depth and drops the continuation's marker.
140
+ let lineDepth = 0;
141
+ while (line.charCodeAt(lineDepth) === 0x3e /* > */) {
142
+ lineDepth++;
143
+ }
144
+ let prefixLength = lineDepth && line.charCodeAt(lineDepth) === 0x20 /* space */ ? lineDepth + 1 : lineDepth;
145
+ let content = line.slice(prefixLength);
135
146
  // the last piece is never empty, so it holds the last character of the paragraph
136
147
  let last = parts.length ? parts[parts.length - 1] : '';
137
148
  // Lines never contain a line break, so a signature separator can only be the whole
138
- // paragraph being exactly "-- "
139
- let isSoftBreak = last.endsWith(' ') && !(partsLength === 3 && parts.join('') === '-- ');
149
+ // paragraph (without its quote marker) being exactly "-- "
150
+ let isSoftBreak = lineDepth === depth && last.endsWith(' ') && !(partsLength === 3 && parts.join('') === '-- ');
140
151
  if (isSoftBreak) {
141
152
  if (delSp) {
142
153
  // delsp adds space to text to be able to fold it
@@ -144,26 +155,29 @@ class Libmime {
144
155
  parts.pop();
145
156
  partsLength -= last.length;
146
157
  pushPart(last.slice(0, -1));
147
- pushPart(line);
158
+ pushPart(content);
148
159
  }
149
160
  else {
150
161
  // remove space stuffing of the continuation line, the stuffing of a paragraph's first
151
162
  // line is removed below. Without delsp the text is only wrapped after spaces, so a
152
- // leading space can only be stuffing (http://tools.ietf.org/html/rfc3676#section-4.4)
153
- pushPart(line.replace(/^ /, ''));
163
+ // leading space can only be stuffing (http://tools.ietf.org/html/rfc3676#section-4.4).
164
+ // The stuffing of a quoted line is already part of its prefix.
165
+ pushPart(lineDepth ? content : content.replace(/^ /, ''));
154
166
  }
155
167
  }
156
168
  else {
157
169
  if (i > 0) {
158
- result.push(parts.join(''));
170
+ result.push(prefix + parts.join(''));
159
171
  }
160
172
  parts = [];
161
173
  partsLength = 0;
162
- pushPart(line);
174
+ depth = lineDepth;
175
+ prefix = line.slice(0, prefixLength);
176
+ pushPart(content);
163
177
  }
164
178
  }
165
- if (partsLength) {
166
- result.push(parts.join(''));
179
+ if (partsLength || prefix) {
180
+ result.push(prefix + parts.join(''));
167
181
  }
168
182
  // remove whitespace stuffing
169
183
  // http://tools.ietf.org/html/rfc3676#section-4.4
@@ -82,7 +82,9 @@ export class Libmime {
82
82
  // The current paragraph is kept as a list of non-empty pieces and joined once when it
83
83
  // ends. Appending to one string and testing it with a regex on every line re-scans (and
84
84
  // flattens) the whole paragraph each time, which is quadratic on long soft-wrapped bodies.
85
- let parts = [], partsLength = 0;
85
+ let parts = [], partsLength = 0,
86
+ // quote depth and the original quote prefix ("> ", ">>" ...) of the current paragraph
87
+ depth = 0, prefix = '';
86
88
  let pushPart = (part) => {
87
89
  if (part) {
88
90
  parts.push(part);
@@ -93,11 +95,20 @@ export class Libmime {
93
95
  // soft linebreaks are added after space symbols
94
96
  for (let i = 0; i < lines.length; i++) {
95
97
  let line = lines[i];
98
+ // RFC 3676 section 4.5: a quoted line starts with one or more ">" characters and the one
99
+ // space directly after them is space-stuffing. The quote marker is not content, so a soft
100
+ // line break only joins lines of the same quote depth and drops the continuation's marker.
101
+ let lineDepth = 0;
102
+ while (line.charCodeAt(lineDepth) === 0x3e /* > */) {
103
+ lineDepth++;
104
+ }
105
+ let prefixLength = lineDepth && line.charCodeAt(lineDepth) === 0x20 /* space */ ? lineDepth + 1 : lineDepth;
106
+ let content = line.slice(prefixLength);
96
107
  // the last piece is never empty, so it holds the last character of the paragraph
97
108
  let last = parts.length ? parts[parts.length - 1] : '';
98
109
  // Lines never contain a line break, so a signature separator can only be the whole
99
- // paragraph being exactly "-- "
100
- let isSoftBreak = last.endsWith(' ') && !(partsLength === 3 && parts.join('') === '-- ');
110
+ // paragraph (without its quote marker) being exactly "-- "
111
+ let isSoftBreak = lineDepth === depth && last.endsWith(' ') && !(partsLength === 3 && parts.join('') === '-- ');
101
112
  if (isSoftBreak) {
102
113
  if (delSp) {
103
114
  // delsp adds space to text to be able to fold it
@@ -105,26 +116,29 @@ export class Libmime {
105
116
  parts.pop();
106
117
  partsLength -= last.length;
107
118
  pushPart(last.slice(0, -1));
108
- pushPart(line);
119
+ pushPart(content);
109
120
  }
110
121
  else {
111
122
  // remove space stuffing of the continuation line, the stuffing of a paragraph's first
112
123
  // line is removed below. Without delsp the text is only wrapped after spaces, so a
113
- // leading space can only be stuffing (http://tools.ietf.org/html/rfc3676#section-4.4)
114
- pushPart(line.replace(/^ /, ''));
124
+ // leading space can only be stuffing (http://tools.ietf.org/html/rfc3676#section-4.4).
125
+ // The stuffing of a quoted line is already part of its prefix.
126
+ pushPart(lineDepth ? content : content.replace(/^ /, ''));
115
127
  }
116
128
  }
117
129
  else {
118
130
  if (i > 0) {
119
- result.push(parts.join(''));
131
+ result.push(prefix + parts.join(''));
120
132
  }
121
133
  parts = [];
122
134
  partsLength = 0;
123
- pushPart(line);
135
+ depth = lineDepth;
136
+ prefix = line.slice(0, prefixLength);
137
+ pushPart(content);
124
138
  }
125
139
  }
126
- if (partsLength) {
127
- result.push(parts.join(''));
140
+ if (partsLength || prefix) {
141
+ result.push(prefix + parts.join(''));
128
142
  }
129
143
  // remove whitespace stuffing
130
144
  // http://tools.ietf.org/html/rfc3676#section-4.4
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "libmime",
3
3
  "description": "Encode and decode quoted printable and base64 strings",
4
- "version": "5.5.1",
4
+ "version": "5.5.2",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/libmime.js",
7
7
  "types": "./dist/cjs/libmime.d.ts",
@@ -51,6 +51,8 @@
51
51
  "test": "node --import tsx --test --test-concurrency=1 $(find test -name \"*-test.ts\")",
52
52
  "pretest:coverage": "npm run build",
53
53
  "test:coverage": "c8 node --import tsx --test --test-concurrency=1 $(find test -name \"*-test.ts\")",
54
+ "pretest:cjs": "npm run build",
55
+ "test:cjs": "NODE_OPTIONS=--no-experimental-require-module node test/cjs-smoke.cjs",
54
56
  "format": "prettier --write \"**/*.{js,cjs,ts,json,md,yml,yaml}\"",
55
57
  "format:check": "prettier --check \"**/*.{js,cjs,ts,json,md,yml,yaml}\"",
56
58
  "lint": "npm run typecheck && eslint .",
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.10.0](https://github.com/nodemailer/mailparser/compare/v3.9.47...v3.10.0) (2026-10-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * migrate to TypeScript with ES module and CommonJS builds ([1d9b23c](https://github.com/nodemailer/mailparser/commit/1d9b23c9fb4d760f4036a5416e4178cdfac07a0a))
9
+
10
+ ## [3.9.47](https://github.com/nodemailer/mailparser/compare/v3.9.46...v3.9.47) (2026-10-19)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * bump libmime to 5.5.2 ([7df8fed](https://github.com/nodemailer/mailparser/commit/7df8fedfd28efd23f76b5efb3d23d46b43c65ea9))
16
+
3
17
  ## [3.9.46](https://github.com/nodemailer/mailparser/compare/v3.9.45...v3.9.46) (2026-10-18)
4
18
 
5
19
 
@@ -21,6 +21,12 @@ next import the `mailparser` object into your script:
21
21
  const mailparser = require('mailparser');
22
22
  ```
23
23
 
24
+ or, from an ES module or TypeScript (type declarations are included):
25
+
26
+ ```js
27
+ import { simpleParser, MailParser } from 'mailparser';
28
+ ```
29
+
24
30
  ## Usage
25
31
 
26
32
  See [mailparser homepage](https://nodemailer.com/extras/mailparser/) for documentation and terms.
@@ -0,0 +1,10 @@
1
+ import MailParser from './mail-parser.js';
2
+ import simpleParser from './simple-parser.js';
3
+ export { MailParser, simpleParser };
4
+ export type { SimpleParserCallback } from './simple-parser.js';
5
+ export type * from './types.js';
6
+ declare const _default: {
7
+ MailParser: typeof MailParser;
8
+ simpleParser: typeof simpleParser;
9
+ };
10
+ export default _default;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.simpleParser = exports.MailParser = void 0;
7
+ const mail_parser_js_1 = __importDefault(require("./mail-parser.js"));
8
+ exports.MailParser = mail_parser_js_1.default;
9
+ const simple_parser_js_1 = __importDefault(require("./simple-parser.js"));
10
+ exports.simpleParser = simple_parser_js_1.default;
11
+ exports.default = { MailParser: mail_parser_js_1.default, simpleParser: simple_parser_js_1.default };
12
+ Object.defineProperty(exports, 'default', { value: exports, enumerable: false, writable: true, configurable: true });
@@ -0,0 +1,98 @@
1
+ import { Transform } from 'node:stream';
2
+ import type { TransformCallback } from 'node:stream';
3
+ import type { AddressObject, AttachmentStream, EmailAddress, HeaderLines, Headers, MailParserOptions, MessageText } from './types.js';
4
+ /**
5
+ * A lower level, streaming e-mail parser. It is a Transform stream: write the raw message in and
6
+ * read the parsed content out. It emits:
7
+ *
8
+ * - a `headers` event with the parsed headers of the message (see {@link Headers}),
9
+ * - a `headerLines` event with the raw header lines,
10
+ * - an {@link AttachmentStream} object for every attachment, whose content stream has to be read
11
+ * and `release()` called before the parser continues,
12
+ * - one {@link MessageText} object with the text content at the end.
13
+ *
14
+ * For one-shot parsing into a single object, use `simpleParser` instead.
15
+ */
16
+ declare class MailParser extends Transform {
17
+ /** The options the parser was created with. */
18
+ options: MailParserOptions;
19
+ /** The parsed headers of the message, `false` until they have been parsed. */
20
+ headers: Headers | false;
21
+ /** The raw header lines of the message, `false` until they have been parsed. */
22
+ headerLines: HeaderLines | false;
23
+ /** The plain text content, `false` until the message has been parsed or when there is none. */
24
+ text: string | false;
25
+ /** The HTML content, `false` until the message has been parsed or when there is none. */
26
+ html: string | false;
27
+ /** The plain text content as HTML, `false` until the message has been parsed or when there is none. */
28
+ textAsHtml: string | false;
29
+ /** The `Subject` header, set once the headers have been parsed. */
30
+ subject?: string;
31
+ /** The `References` header, set once the headers have been parsed. */
32
+ references?: string | string[];
33
+ /** The `Date` header, set once the headers have been parsed. */
34
+ date?: Date;
35
+ /** The `To` header, set once the headers have been parsed. */
36
+ to?: AddressObject | AddressObject[];
37
+ /** The `From` header, set once the headers have been parsed. */
38
+ from?: AddressObject;
39
+ /** The `Cc` header, set once the headers have been parsed. */
40
+ cc?: AddressObject | AddressObject[];
41
+ /** The `Bcc` header, set once the headers have been parsed. */
42
+ bcc?: AddressObject | AddressObject[];
43
+ /** The `Message-ID` header, set once the headers have been parsed. */
44
+ messageId?: string;
45
+ /** The `In-Reply-To` header, set once the headers have been parsed. */
46
+ inReplyTo?: string;
47
+ /** The `Reply-To` header, set once the headers have been parsed. */
48
+ replyTo?: AddressObject;
49
+ constructor(config?: MailParserOptions);
50
+ _transform(chunk: Buffer, encoding: BufferEncoding, done: TransformCallback): void;
51
+ _flush(done: TransformCallback): void;
52
+ /**
53
+ * Turns a `Priority`, `X-Priority`, `X-MSMail-Priority` or `Importance` header value into
54
+ * `'high'`, `'normal'` or `'low'`.
55
+ */
56
+ parsePriority(value: string): 'high' | 'normal' | 'low';
57
+ /**
58
+ * Wraps a Message-ID in angle brackets where they are missing. Returns `false` for an empty value.
59
+ */
60
+ ensureMessageIDFormat(value: string): string | false;
61
+ /**
62
+ * Formats parsed addresses for an HTML context, every value HTML-escaped.
63
+ */
64
+ getAddressesHTML(value: EmailAddress | EmailAddress[]): string;
65
+ /**
66
+ * Formats parsed addresses as plain text, display names quoted.
67
+ */
68
+ getAddressesText(value: EmailAddress | EmailAddress[]): string;
69
+ /**
70
+ * Replaces `cid:` links to image attachments in the HTML content. Call it once the parser has
71
+ * ended. `replaceCallback` is called once for every referenced image attachment and answers with
72
+ * the URL to use instead; `done` gets the updated HTML, or `false` when the message has no HTML.
73
+ * The total length of the URLs written is bounded by `maxInlinedImagesSize`.
74
+ */
75
+ updateImageLinks(replaceCallback: (attachment: AttachmentStream, callback: (err: Error | null | false | undefined, url?: string) => void) => void, done: (err: Error | null, html?: string | false) => void): void;
76
+ /**
77
+ * Converts plain text to HTML the way `textAsHtml` is built: HTML-escaped, paragraphs and line
78
+ * breaks kept, and links turned into anchors unless `skipTextLinks` is set. Returns an empty
79
+ * string when `skipTextToHtml` is set.
80
+ */
81
+ textToHtml(str: string): string;
82
+ }
83
+ interface MailParser {
84
+ /** Emitted once with the parsed headers of the message. */
85
+ on(event: 'headers', listener: (headers: Headers) => void): this;
86
+ /** Emitted once with the raw header lines of the message. */
87
+ on(event: 'headerLines', listener: (headerLines: HeaderLines) => void): this;
88
+ /** Emitted for every attachment and, at the end, once for the text content. */
89
+ on(event: 'data', listener: (data: AttachmentStream | MessageText) => void): this;
90
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
91
+ once(event: 'headers', listener: (headers: Headers) => void): this;
92
+ once(event: 'headerLines', listener: (headerLines: HeaderLines) => void): this;
93
+ once(event: 'data', listener: (data: AttachmentStream | MessageText) => void): this;
94
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
95
+ /** Returns the next attachment or text content object, or `null` when none is buffered. */
96
+ read(size?: number): AttachmentStream | MessageText | null;
97
+ }
98
+ export default MailParser;