@timshel_npm/maildev 3.2.12 → 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.12",
34
- "maildev": "npm:@timshel_npm/maildev@^3.2.12"
33
+ "maildev": "github:timshel/maildev#3.2.15",
34
+ "maildev": "npm:@timshel_npm/maildev@^3.2.15"
35
35
  }
36
36
  ```
37
37
 
@@ -36,6 +36,7 @@ const events = require("events");
36
36
  const fs = require("fs");
37
37
  const os = require("os");
38
38
  const path = require("path");
39
+ const { PassThrough } = require("stream");
39
40
  const createDOMPurify = require("dompurify");
40
41
  const { JSDOM } = require("jsdom");
41
42
  const defaultPort = 1025;
@@ -440,14 +441,13 @@ function getDiskEmail(mailDir, id) {
440
441
  return __awaiter(this, void 0, void 0, function* () {
441
442
  const emlPath = path.join(mailDir, id + ".eml");
442
443
  const data = yield fs_1.promises.readFile(emlPath, "utf8");
444
+ const stat = yield fs_1.promises.stat(emlPath);
443
445
  const parsedMail = yield (0, mailparser_1.parse)(data);
444
- return buildMail(mailDir, id, parsedMail);
446
+ return buildMail(id, parsedMail, stat.size);
445
447
  });
446
448
  }
447
- function buildMail(mailDir, id, parsedMail) {
449
+ function buildMail(id, parsedMail, size) {
448
450
  return __awaiter(this, void 0, void 0, function* () {
449
- const emlPath = path.join(mailDir, id + ".eml");
450
- const stat = yield fs_1.promises.stat(emlPath);
451
451
  const envelope = {
452
452
  id: id,
453
453
  from: parsedMail.from,
@@ -457,7 +457,7 @@ function buildMail(mailDir, id, parsedMail) {
457
457
  hasAttachment: parsedMail.attachments.length > 0,
458
458
  isRead: false,
459
459
  };
460
- 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);
461
461
  });
462
462
  }
463
463
  /**
@@ -493,13 +493,22 @@ function handleDataStream(mailServer, stream, session, callback) {
493
493
  return __awaiter(this, void 0, void 0, function* () {
494
494
  const id = utils.makeId();
495
495
  const emlStream = fs.createWriteStream(path.join(mailServer.mailDir, id + ".eml"));
496
- stream.on("end", function () {
497
- emlStream.end();
498
- callback(null, "Message queued as " + id);
496
+ let size = 0;
497
+ const pt = new PassThrough();
498
+ pt.on("data", (data) => {
499
+ size += data.length;
500
+ emlStream.write(data);
501
+ });
502
+ let streamEnd = new Promise((resolve) => {
503
+ stream.on("end", () => {
504
+ emlStream.end();
505
+ callback(null, "Message queued as " + id);
506
+ resolve();
507
+ });
499
508
  });
500
- stream.pipe(emlStream);
501
- const parsed = yield (0, mailparser_1.parse)(stream);
502
- const mail = yield buildMail(mailServer.mailDir, id, parsed);
509
+ const parsed = yield (0, mailparser_1.parse)(stream.pipe(pt));
510
+ yield streamEnd;
511
+ const mail = yield buildMail(id, parsed, size);
503
512
  return saveEmailToStore(mailServer, mail);
504
513
  });
505
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.12",
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",
@@ -63,7 +64,7 @@
63
64
  "cors": "2.8.6",
64
65
  "dompurify": "3.3.1",
65
66
  "express": "5.2.1",
66
- "jsdom": "28.0.0",
67
+ "jsdom": "28.1.0",
67
68
  "mailparser": "3.9.3",
68
69
  "mime": "4.1.0",
69
70
  "nodemailer": "8.0.1",
@@ -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.1"
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",