mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-10-23 06:55:45 +07:00
node_modules: update (#352)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
1 parent
4026a70a6b
commit
47af4a10b5
53 files changed
+630
-217
No files matched your search
+34
-1
@@ -58,6 +58,13 @@ export interface MimeNodePreparedHeaderValue {
|
||||
* objects (for the address headers), a prepared value object, or a list of these
|
||||
*/
|
||||
export type MimeNodeHeaderValue = string | number | boolean | Date | MimeNodeAddress | MimeNodePreparedHeaderValue | MimeNodeHeaderValue[] | null | undefined;
|
||||
/**
|
||||
* Options for the static MimeNode.encodeHeaderValue
|
||||
*/
|
||||
export interface MimeNodeHeaderEncodingOptions {
|
||||
/** Either 'Q' (the default) or 'B' */
|
||||
textEncoding?: string | undefined;
|
||||
}
|
||||
/**
|
||||
* A single header, the shape the headers are stored in and one of the list forms
|
||||
* setHeader and addHeader accept
|
||||
@@ -319,6 +326,31 @@ declare class MimeNode {
|
||||
* @param raw Raw MIME contents
|
||||
*/
|
||||
setRaw(raw: MimeNodeContent): this;
|
||||
/**
|
||||
* Encodes a header value the way this node encodes it in the generated message:
|
||||
* address headers are punycoded and mime encoded, message id headers get their
|
||||
* angle brackets, a Date object is formatted and any other value is mime encoded
|
||||
* when it holds non-ascii or control characters (using the node's `textEncoding`).
|
||||
*
|
||||
* The result is a single unfolded line without the key. Fold it before writing it
|
||||
* into a message, `key + ': ' + value` folded at 76 characters is what the node does.
|
||||
*
|
||||
* @param key Header key, case insensitive
|
||||
* @param value Header value
|
||||
* @returns Encoded header value
|
||||
*/
|
||||
encodeHeaderValue(key: string, value: MimeNodeHeaderValue): string;
|
||||
/**
|
||||
* Encodes a header value without a node at hand. Same as the instance method of a
|
||||
* node created with the given options.
|
||||
*
|
||||
* @param key Header key, case insensitive
|
||||
* @param value Header value
|
||||
* @param [options] Encoding options
|
||||
* @param [options.textEncoding] either 'Q' (the default) or 'B'
|
||||
* @returns Encoded header value
|
||||
*/
|
||||
static encodeHeaderValue(key: string, value: MimeNodeHeaderValue, options?: MimeNodeHeaderEncodingOptions): string;
|
||||
}
|
||||
/**
|
||||
* Type aliases in the layout of @types/nodemailer, so `MimeNode.Options` style references keep working
|
||||
@@ -327,7 +359,8 @@ declare namespace MimeNode {
|
||||
type Options = MimeNodeOptions;
|
||||
type Addresses = MimeNodeAddresses;
|
||||
type Envelope = MimeNodeEnvelope;
|
||||
type HeaderEncodingOptions = MimeNodeHeaderEncodingOptions;
|
||||
}
|
||||
/** The same aliases as module level exports, for `import * as MimeNode` and `import MimeNode = require()` */
|
||||
export type { MimeNodeOptions as Options, MimeNodeAddresses as Addresses, MimeNodeEnvelope as Envelope };
|
||||
export type { MimeNodeOptions as Options, MimeNodeAddresses as Addresses, MimeNodeEnvelope as Envelope, MimeNodeHeaderEncodingOptions as HeaderEncodingOptions };
|
||||
export default MimeNode;
|
||||
+35
-13
@@ -117,9 +117,7 @@ function exceedsDomainLimits(domain) {
|
||||
*/
|
||||
function normalizeDomain(domain, toUnicode) {
|
||||
// domainToASCII and domainToUnicode landed in Node 7, the bundled codec covers Node 6
|
||||
if (typeof urlModule.domainToASCII === 'function' &&
|
||||
typeof urlModule.domainToUnicode === 'function' &&
|
||||
!URL_PARSER_UNSAFE.test(domain)) {
|
||||
if (typeof urlModule.domainToASCII === 'function' && typeof urlModule.domainToUnicode === 'function' && !URL_PARSER_UNSAFE.test(domain)) {
|
||||
// The U-label form is decoded from the A-label form rather than from the input:
|
||||
// Deno's domainToASCII returns an empty string for a label it cannot decode, while
|
||||
// its domainToUnicode returns the label with U+FFFD in place of the bad part
|
||||
@@ -632,9 +630,7 @@ class MimeNode {
|
||||
// the checks miss and the header ends up claiming a type it is not set up for
|
||||
structured.value = (structured.value || '').toString().replace(/[\x00-\x1f\x7f]/g, '');
|
||||
this._handleContentType(structured);
|
||||
if (structured.value.match(/^text\/plain\b/) &&
|
||||
typeof this.content === 'string' &&
|
||||
/[\u0080-\uFFFF]/.test(this.content)) {
|
||||
if (structured.value.match(/^text\/plain\b/) && typeof this.content === 'string' && /[\u0080-\uFFFF]/.test(this.content)) {
|
||||
structured.params.charset = 'utf-8';
|
||||
}
|
||||
if (this.filename) {
|
||||
@@ -675,7 +671,7 @@ class MimeNode {
|
||||
}
|
||||
break;
|
||||
}
|
||||
value = this._encodeHeaderValue(key, value);
|
||||
value = this.encodeHeaderValue(key, value);
|
||||
// skip empty lines
|
||||
if (!(value || '').toString().trim()) {
|
||||
return;
|
||||
@@ -1293,8 +1289,7 @@ class MimeNode {
|
||||
// where it came from. MimeNode is exported and subclassable, so the generator is
|
||||
// not necessarily the one below. Stripping twice costs nothing, it is idempotent.
|
||||
const declared = _stripBoundaryControls(structured.params.boundary || this.boundary || '');
|
||||
this.boundary = structured.params.boundary =
|
||||
declared || _stripBoundaryControls(this._generateBoundary());
|
||||
this.boundary = structured.params.boundary = declared || _stripBoundaryControls(this._generateBoundary());
|
||||
}
|
||||
else {
|
||||
this.boundary = false;
|
||||
@@ -1312,13 +1307,19 @@ class MimeNode {
|
||||
return _stripBoundaryControls(this.rootNode.boundaryPrefix + '-' + this.rootNode.baseBoundary) + '-Part_' + this._nodeId;
|
||||
}
|
||||
/**
|
||||
* Encodes a header value for use in the generated rfc2822 email.
|
||||
* Encodes a header value the way this node encodes it in the generated message:
|
||||
* address headers are punycoded and mime encoded, message id headers get their
|
||||
* angle brackets, a Date object is formatted and any other value is mime encoded
|
||||
* when it holds non-ascii or control characters (using the node's `textEncoding`).
|
||||
*
|
||||
* @param key Header key
|
||||
* The result is a single unfolded line without the key. Fold it before writing it
|
||||
* into a message, `key + ': ' + value` folded at 76 characters is what the node does.
|
||||
*
|
||||
* @param key Header key, case insensitive
|
||||
* @param value Header value
|
||||
* @internal
|
||||
* @returns Encoded header value
|
||||
*/
|
||||
_encodeHeaderValue(key, value) {
|
||||
encodeHeaderValue(key, value) {
|
||||
key = this._normalizeHeaderKey(key);
|
||||
switch (key) {
|
||||
// Structured headers
|
||||
@@ -1383,6 +1384,27 @@ class MimeNode {
|
||||
return this._encodeHeaderText(value);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Encodes a header value without a node at hand. Same as the instance method of a
|
||||
* node created with the given options.
|
||||
*
|
||||
* @param key Header key, case insensitive
|
||||
* @param value Header value
|
||||
* @param [options] Encoding options
|
||||
* @param [options.textEncoding] either 'Q' (the default) or 'B'
|
||||
* @returns Encoded header value
|
||||
*/
|
||||
static encodeHeaderValue(key, value, options) {
|
||||
return new MimeNode(false, { textEncoding: options?.textEncoding }).encodeHeaderValue(key, value);
|
||||
}
|
||||
/**
|
||||
* Alias of encodeHeaderValue, kept for callers that used the method before it was public
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
_encodeHeaderValue(key, value) {
|
||||
return this.encodeHeaderValue(key, value);
|
||||
}
|
||||
/**
|
||||
* Rebuilds address object using punycode and other adjustments
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user