@e-mc/module 0.8.23 → 0.8.24
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 +5 -5
- package/index.js +10 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
12
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/index.d.ts
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogStatus } from "./squared";
|
|
@@ -231,10 +231,10 @@ interface ModuleConstructor {
|
|
|
231
231
|
|
|
232
232
|
## References
|
|
233
233
|
|
|
234
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
235
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
236
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
237
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
234
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/core.d.ts
|
|
235
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/logger.d.ts
|
|
236
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/module.d.ts
|
|
237
|
+
- https://www.unpkg.com/@e-mc/types@0.8.24/lib/node.d.ts
|
|
238
238
|
|
|
239
239
|
## LICENSE
|
|
240
240
|
|
package/index.js
CHANGED
|
@@ -681,7 +681,7 @@ function formatPercent(value, precision) {
|
|
|
681
681
|
return value.toPrecision(value < 1 ? 2 : precision) + '%';
|
|
682
682
|
}
|
|
683
683
|
const hideAbort = (err) => err.name === 'AbortError' && SETTINGS.abort === false;
|
|
684
|
-
const asFile = (value) =>
|
|
684
|
+
const asFile = (value) => typeof value === 'string' ? PLATFORM_WIN32 ? value.trim() : value : value instanceof URL && value.protocol === 'file:' ? url.fileURLToPath(value) : '';
|
|
685
685
|
const wrapQuote = (value) => '"' + value.replace(/"/g, '\\"') + '"';
|
|
686
686
|
const isFunction = (value) => typeof value === 'function';
|
|
687
687
|
const isFileURL = (value) => /^file:\/\//i.test(value);
|
|
@@ -716,7 +716,7 @@ class Module extends EventEmitter {
|
|
|
716
716
|
this[_f] = new AbortController();
|
|
717
717
|
this[_g] = null;
|
|
718
718
|
}
|
|
719
|
-
static get VERSION() { return "0.8.
|
|
719
|
+
static get VERSION() { return "0.8.24"; }
|
|
720
720
|
static get LOG_TYPE() { return types_1.LOG_TYPE; }
|
|
721
721
|
static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
|
|
722
722
|
static get MAX_TIMEOUT() { return 2147483647; }
|
|
@@ -802,7 +802,7 @@ class Module extends EventEmitter {
|
|
|
802
802
|
if (error && hideAbort(message)) {
|
|
803
803
|
return;
|
|
804
804
|
}
|
|
805
|
-
if (options.type) {
|
|
805
|
+
if (typeof options.type === 'number') {
|
|
806
806
|
type |= options.type;
|
|
807
807
|
}
|
|
808
808
|
const BROADCAST_OUT = VALUES["broadcast.out"];
|
|
@@ -1307,7 +1307,7 @@ class Module extends EventEmitter {
|
|
|
1307
1307
|
filename = undefined;
|
|
1308
1308
|
}
|
|
1309
1309
|
if (typeof value === 'string') {
|
|
1310
|
-
let pathname = value.trim(), convert = true;
|
|
1310
|
+
let pathname = PLATFORM_WIN32 ? value.trim() : value, convert = true;
|
|
1311
1311
|
if (normalize) {
|
|
1312
1312
|
pathname = path.normalize(pathname);
|
|
1313
1313
|
convert = PLATFORM_WIN32;
|
|
@@ -1414,7 +1414,7 @@ class Module extends EventEmitter {
|
|
|
1414
1414
|
return false;
|
|
1415
1415
|
}
|
|
1416
1416
|
static resolveFile(value) {
|
|
1417
|
-
if (isFileURL(value = value instanceof URL ? value.toString() : value
|
|
1417
|
+
if (isFileURL(value = value instanceof URL ? value.toString() : value)) {
|
|
1418
1418
|
try {
|
|
1419
1419
|
return url.fileURLToPath(value);
|
|
1420
1420
|
}
|
|
@@ -1429,7 +1429,7 @@ class Module extends EventEmitter {
|
|
|
1429
1429
|
}
|
|
1430
1430
|
static resolvePath(value, base) {
|
|
1431
1431
|
try {
|
|
1432
|
-
if (this.isURL(value
|
|
1432
|
+
if (this.isURL(value)) {
|
|
1433
1433
|
return isFileURL(value) ? url.fileURLToPath(value) : new URL(value).href;
|
|
1434
1434
|
}
|
|
1435
1435
|
if (base instanceof URL || this.isURL(base)) {
|
|
@@ -1461,7 +1461,7 @@ class Module extends EventEmitter {
|
|
|
1461
1461
|
if (typeof flags === 'boolean') {
|
|
1462
1462
|
flags = flags ? 2 : 0;
|
|
1463
1463
|
}
|
|
1464
|
-
let result = value.trim();
|
|
1464
|
+
let result = PLATFORM_WIN32 ? value.trim() : value;
|
|
1465
1465
|
result = flags & 1 ? path.resolve(result) : path.normalize(result);
|
|
1466
1466
|
if ((flags & 3) && result.length) {
|
|
1467
1467
|
result = ensureDir(result);
|
|
@@ -3377,12 +3377,12 @@ class Module extends EventEmitter {
|
|
|
3377
3377
|
}
|
|
3378
3378
|
}
|
|
3379
3379
|
writeLog(type, value, timeStamp, duration) {
|
|
3380
|
-
let queue;
|
|
3380
|
+
let queue = false;
|
|
3381
3381
|
if ((0, types_1.isObject)(type)) {
|
|
3382
3382
|
if (typeof value === 'boolean') {
|
|
3383
3383
|
queue = value;
|
|
3384
3384
|
}
|
|
3385
|
-
|
|
3385
|
+
value = type.value;
|
|
3386
3386
|
}
|
|
3387
3387
|
const output = Module.asString(value);
|
|
3388
3388
|
if (output) {
|
|
@@ -3410,7 +3410,7 @@ class Module extends EventEmitter {
|
|
|
3410
3410
|
from = timeStamp;
|
|
3411
3411
|
timeStamp = 0;
|
|
3412
3412
|
}
|
|
3413
|
-
else if ((0, types_1.
|
|
3413
|
+
else if ((0, types_1.isPlainObject)(timeStamp)) {
|
|
3414
3414
|
({ timeStamp, duration, from, source } = timeStamp);
|
|
3415
3415
|
}
|
|
3416
3416
|
const name = types_1.STATUS_TYPE[type] || types_1.STATUS_TYPE[type = 0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/module",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.24",
|
|
4
4
|
"description": "Module base class for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/types": "0.8.
|
|
23
|
+
"@e-mc/types": "0.8.24",
|
|
24
24
|
"abort-controller": "^3.0.0",
|
|
25
25
|
"chalk": "4.1.2",
|
|
26
26
|
"event-target-shim": "^5.0.1",
|