mailpop 1.0.5 → 1.0.7
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/dist/config.js +9 -1
- package/dist/logger.js +2 -1
- package/dist/utils/validators.js +7 -2
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import dotenv from 'dotenv';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
|
|
3
|
+
import { existsSync } from 'fs';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
// 1. Load environment variables from CWD .env (if present)
|
|
4
6
|
dotenv.config();
|
|
7
|
+
// 2. Load from package directory .env as a fallback for defaults
|
|
8
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const packageEnv = path.resolve(__dirname, '../.env');
|
|
10
|
+
if (existsSync(packageEnv)) {
|
|
11
|
+
dotenv.config({ path: packageEnv });
|
|
12
|
+
}
|
|
5
13
|
const getEnvNumber = (key, defaultValue) => {
|
|
6
14
|
const val = process.env[key];
|
|
7
15
|
if (val === undefined)
|
package/dist/logger.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
|
|
3
|
+
import os from 'os';
|
|
4
|
+
const LOGS_DIR = path.join(os.tmpdir(), 'mailpop-logs');
|
|
4
5
|
// ANSI escape codes for styling
|
|
5
6
|
const RESET = '\x1b[0m';
|
|
6
7
|
const BOLD = '\x1b[1m';
|
package/dist/utils/validators.js
CHANGED
|
@@ -46,8 +46,13 @@ export function isValidEmail(email) {
|
|
|
46
46
|
if (REJECTED_PREFIXES.includes(localPart)) {
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
49
|
-
// Reject user-configured excluded prefixes
|
|
50
|
-
|
|
49
|
+
// Reject user-configured excluded prefixes (matches exact, or delimited by -, ., _, +)
|
|
50
|
+
const isExcluded = config.excludePrefixes.some((prefix) => {
|
|
51
|
+
const escaped = prefix.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
52
|
+
const regex = new RegExp(`(^|[-._+])` + escaped + `($|[-._+])`, 'i');
|
|
53
|
+
return regex.test(localPart);
|
|
54
|
+
});
|
|
55
|
+
if (isExcluded) {
|
|
51
56
|
return false;
|
|
52
57
|
}
|
|
53
58
|
// Reject blacklisted domains
|