@timshel_npm/maildev 3.2.14 → 3.2.15

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/README.md CHANGED
@@ -30,8 +30,8 @@ Or can be installed using [Github](https://docs.npmjs.com/cli/v10/configuring-np
30
30
  Ex:
31
31
  ```json
32
32
  "devDependencies": {
33
- "maildev": "github:timshel/maildev#3.2.14",
34
- "maildev": "npm:@timshel_npm/maildev@^3.2.14"
33
+ "maildev": "github:timshel/maildev#3.2.15",
34
+ "maildev": "npm:@timshel_npm/maildev@^3.2.15"
35
35
  }
36
36
  ```
37
37
 
@@ -441,14 +441,13 @@ function getDiskEmail(mailDir, id) {
441
441
  return __awaiter(this, void 0, void 0, function* () {
442
442
  const emlPath = path.join(mailDir, id + ".eml");
443
443
  const data = yield fs_1.promises.readFile(emlPath, "utf8");
444
+ const stat = yield fs_1.promises.stat(emlPath);
444
445
  const parsedMail = yield (0, mailparser_1.parse)(data);
445
- return buildMail(mailDir, id, parsedMail);
446
+ return buildMail(id, parsedMail, stat.size);
446
447
  });
447
448
  }
448
- function buildMail(mailDir, id, parsedMail) {
449
+ function buildMail(id, parsedMail, size) {
449
450
  return __awaiter(this, void 0, void 0, function* () {
450
- const emlPath = path.join(mailDir, id + ".eml");
451
- const stat = yield fs_1.promises.stat(emlPath);
452
451
  const envelope = {
453
452
  id: id,
454
453
  from: parsedMail.from,
@@ -458,7 +457,7 @@ function buildMail(mailDir, id, parsedMail) {
458
457
  hasAttachment: parsedMail.attachments.length > 0,
459
458
  isRead: false,
460
459
  };
461
- return Object.assign({ id: envelope.id, envelope, calculatedBcc: (0, bcc_1.calculateBcc)(envelope.to, parsedMail.to, parsedMail.cc), size: stat.size, sizeHuman: utils.formatBytes(stat.size) }, parsedMail);
460
+ return Object.assign({ id: envelope.id, envelope, calculatedBcc: (0, bcc_1.calculateBcc)(envelope.to, parsedMail.to, parsedMail.cc), size, sizeHuman: utils.formatBytes(size) }, parsedMail);
462
461
  });
463
462
  }
464
463
  /**
@@ -494,16 +493,22 @@ function handleDataStream(mailServer, stream, session, callback) {
494
493
  return __awaiter(this, void 0, void 0, function* () {
495
494
  const id = utils.makeId();
496
495
  const emlStream = fs.createWriteStream(path.join(mailServer.mailDir, id + ".eml"));
496
+ let size = 0;
497
497
  const pt = new PassThrough();
498
498
  pt.on("data", (data) => {
499
+ size += data.length;
499
500
  emlStream.write(data);
500
501
  });
501
- stream.on("end", () => {
502
- emlStream.end();
503
- callback(null, "Message queued as " + id);
502
+ let streamEnd = new Promise((resolve) => {
503
+ stream.on("end", () => {
504
+ emlStream.end();
505
+ callback(null, "Message queued as " + id);
506
+ resolve();
507
+ });
504
508
  });
505
509
  const parsed = yield (0, mailparser_1.parse)(stream.pipe(pt));
506
- const mail = yield buildMail(mailServer.mailDir, id, parsed);
510
+ yield streamEnd;
511
+ const mail = yield buildMail(id, parsed, size);
507
512
  return saveEmailToStore(mailServer, mail);
508
513
  });
509
514
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@timshel_npm/maildev",
3
3
  "description": "SMTP Server with async API and Web Interface for viewing and testing emails during development",
4
- "version": "3.2.14",
4
+ "version": "3.2.15",
5
5
  "keywords": [
6
6
  "email",
7
7
  "e-mail",
@@ -33,6 +33,7 @@
33
33
  "start": "npm run build && node ./bin/maildev",
34
34
  "test": "prettier . -c && npm run build && nyc _mocha --exit --timeout 5000",
35
35
  "test:debug": "npm run build && nyc _mocha --exit --timeout 5000",
36
+ "test:only": "nyc _mocha --exit --timeout 5000",
36
37
  "lint": "prettier . -c",
37
38
  "lint:fix": "prettier . -w",
38
39
  "dev": "npm run build && node ./scripts/dev.js && npm run css-watch",
@@ -73,8 +74,10 @@
73
74
  },
74
75
  "overrides": {
75
76
  "diff": "8.0.3",
77
+ "minimatch": "10.2.4",
76
78
  "socket.io-adapter": "2.5.5",
77
- "qs": "6.14.2"
79
+ "qs": "6.14.2",
80
+ "serialize-javascript": "7.0.3"
78
81
  },
79
82
  "devDependencies": {
80
83
  "@types/express": "5.0.6",
@@ -84,8 +87,8 @@
84
87
  "jest": "30.2.0",
85
88
  "jest-mock": "30.2.0",
86
89
  "mocha": "11.7.5",
87
- "nodemon": "3.1.11",
88
- "nyc": "17.1.0",
90
+ "nodemon": "3.1.14",
91
+ "nyc": "18.0.0",
89
92
  "prettier": "3.8.1",
90
93
  "sass": "1.97.3",
91
94
  "ts-node": "10.9.2",