@flun/mailer 2.1.5 → 2.1.6

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/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
1
  # 变更日志
2
- ## [2.1.5] - 2026-04-30 15:58
2
+ ## [2.1.6] - 2026-04-30 16:33
3
3
  ### 修复:
4
- - 修复了拷贝示例文件路径错误的问题;
4
+ - 修复了shard.js文件中dns报未定义的错误;
package/lib/shared.js CHANGED
@@ -1,4 +1,4 @@
1
- import { lookup as dnsLookup, resolve as dnsResolve } from 'dns';
1
+ import dns from 'dns';
2
2
  import { format } from 'util';
3
3
  import { isIP, connect as netConnect } from 'net';
4
4
  import { createReadStream as fsReadStream } from 'fs';
@@ -13,7 +13,11 @@ import pkg from '../package.json' with { type: 'json' };
13
13
  * >查看定义:@see {@link PK}、{@link dnsLookup}、{@link dnsResolve}
14
14
  */
15
15
  const PK = (({ name, version, homepage }) => ({ name, version, homepage }))(pkg),
16
- DNS_TTL = 5 * 60 * 1000, DNS_MAP = new Map(),
16
+ DNS_TTL = 5 * 60 * 1000, DNS_MAP = new Map();
17
+ /** @type {Function} DNS 查找函数 */
18
+ const dnsLookup = dns.lookup;
19
+ /** @type {Function} DNS 解析函数 */
20
+ const dnsResolve = dns.resolve,
17
21
  /**
18
22
  * @param {number} family - IP地址族(4=IPv4, 6=IPv6)
19
23
  * @param {boolean} allowInternal - 是否允许内部网络接口
@@ -206,7 +210,7 @@ const resolveHostname = (options = {}, callback) => {
206
210
  if (err) return handleError(err);
207
211
  if (addrV6?.length) return handleSuccess(addrV6); // 如果IPv6解析成功,同理...
208
212
 
209
- // 如果DNS解析都失败,尝试使用dns.lookup
213
+ // 如果DNS解析都失败,尝试使用dnsLookup
210
214
  try {
211
215
  dnsLookup(newHost, { all: true }, (err, lookupAddr) => {
212
216
  if (err) return handleError(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flun/mailer",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "A powerful and flexible email sending library for Node.js with multiple transport support (SMTP, SMTP Pool, Sendmail, Stream, JSON, SES)",
5
5
  "type": "module",
6
6
  "exports": {