@e-mc/module 0.9.17 → 0.9.18
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 +6 -6
- 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
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.18/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogStatus } from "./squared";
|
|
@@ -394,11 +394,11 @@ type ForegroundColor = typeof IForegroundColor | `#${string}`;
|
|
|
394
394
|
|
|
395
395
|
## References
|
|
396
396
|
|
|
397
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
398
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
399
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
400
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
401
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
397
|
+
- https://www.unpkg.com/@e-mc/types@0.9.18/lib/core.d.ts
|
|
398
|
+
- https://www.unpkg.com/@e-mc/types@0.9.18/lib/logger.d.ts
|
|
399
|
+
- https://www.unpkg.com/@e-mc/types@0.9.18/lib/module.d.ts
|
|
400
|
+
- https://www.unpkg.com/@e-mc/types@0.9.18/lib/node.d.ts
|
|
401
|
+
- https://www.unpkg.com/@e-mc/types@0.9.18/lib/settings.d.ts
|
|
402
402
|
|
|
403
403
|
* https://www.npmjs.com/package/@types/node
|
|
404
404
|
|
package/index.js
CHANGED
|
@@ -704,7 +704,7 @@ function formatPercent(value, precision) {
|
|
|
704
704
|
return value.toPrecision(value < 1 ? 2 : precision) + '%';
|
|
705
705
|
}
|
|
706
706
|
const hideAbort = (err) => err.name === 'AbortError' && SETTINGS.abort === false;
|
|
707
|
-
const asFile = (value) => typeof value === 'string' ? value.trim() : value instanceof URL && value.protocol === 'file:' ? url.fileURLToPath(value) : '';
|
|
707
|
+
const asFile = (value) => typeof value === 'string' ? PLATFORM_WIN32 ? value.trim() : value : value instanceof URL && value.protocol === 'file:' ? url.fileURLToPath(value) : '';
|
|
708
708
|
const wrapQuote = (value) => '"' + value.replace(/"/g, '\\"') + '"';
|
|
709
709
|
const isFunction = (value) => typeof value === 'function';
|
|
710
710
|
const isFileURL = (value) => /^file:\/\//i.test(value);
|
|
@@ -740,7 +740,7 @@ class Module extends EventEmitter {
|
|
|
740
740
|
this[_f] = new AbortController();
|
|
741
741
|
this[_g] = null;
|
|
742
742
|
}
|
|
743
|
-
static get VERSION() { return "0.9.
|
|
743
|
+
static get VERSION() { return "0.9.18"; }
|
|
744
744
|
static get LOG_TYPE() { return types_1.LOG_TYPE; }
|
|
745
745
|
static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
|
|
746
746
|
static get MAX_TIMEOUT() { return 2147483647; }
|
|
@@ -826,7 +826,7 @@ class Module extends EventEmitter {
|
|
|
826
826
|
if (error && hideAbort(message)) {
|
|
827
827
|
return;
|
|
828
828
|
}
|
|
829
|
-
if (options.type) {
|
|
829
|
+
if (typeof options.type === 'number') {
|
|
830
830
|
type |= options.type;
|
|
831
831
|
}
|
|
832
832
|
const BROADCAST_OUT = VALUES["broadcast.out"];
|
|
@@ -1332,7 +1332,7 @@ class Module extends EventEmitter {
|
|
|
1332
1332
|
filename = undefined;
|
|
1333
1333
|
}
|
|
1334
1334
|
if (typeof value === 'string') {
|
|
1335
|
-
let pathname = value.trim(), convert = true;
|
|
1335
|
+
let pathname = PLATFORM_WIN32 ? value.trim() : value, convert = true;
|
|
1336
1336
|
if (normalize) {
|
|
1337
1337
|
pathname = path.normalize(pathname);
|
|
1338
1338
|
convert = PLATFORM_WIN32;
|
|
@@ -1443,7 +1443,7 @@ class Module extends EventEmitter {
|
|
|
1443
1443
|
return false;
|
|
1444
1444
|
}
|
|
1445
1445
|
static resolveFile(value) {
|
|
1446
|
-
if (isFileURL(value = value instanceof URL ? value.toString() : value
|
|
1446
|
+
if (isFileURL(value = value instanceof URL ? value.toString() : value)) {
|
|
1447
1447
|
try {
|
|
1448
1448
|
return url.fileURLToPath(value);
|
|
1449
1449
|
}
|
|
@@ -1458,7 +1458,7 @@ class Module extends EventEmitter {
|
|
|
1458
1458
|
}
|
|
1459
1459
|
static resolvePath(value, base) {
|
|
1460
1460
|
try {
|
|
1461
|
-
if (this.isURL(value
|
|
1461
|
+
if (this.isURL(value)) {
|
|
1462
1462
|
return isFileURL(value) ? url.fileURLToPath(value) : new URL(value).href;
|
|
1463
1463
|
}
|
|
1464
1464
|
if (base instanceof URL || this.isURL(base)) {
|
|
@@ -1490,7 +1490,7 @@ class Module extends EventEmitter {
|
|
|
1490
1490
|
if (typeof flags === 'boolean') {
|
|
1491
1491
|
flags = flags ? 2 : 0;
|
|
1492
1492
|
}
|
|
1493
|
-
let result = value.trim();
|
|
1493
|
+
let result = PLATFORM_WIN32 ? value.trim() : value;
|
|
1494
1494
|
result = flags & 1 ? path.resolve(result) : path.normalize(result);
|
|
1495
1495
|
if ((flags & 3) && result.length) {
|
|
1496
1496
|
result = ensureDir(result);
|
|
@@ -3456,12 +3456,12 @@ class Module extends EventEmitter {
|
|
|
3456
3456
|
}
|
|
3457
3457
|
}
|
|
3458
3458
|
writeLog(type, value, timeStamp, duration) {
|
|
3459
|
-
let queue;
|
|
3459
|
+
let queue = false;
|
|
3460
3460
|
if ((0, types_1.isObject)(type)) {
|
|
3461
3461
|
if (typeof value === 'boolean') {
|
|
3462
3462
|
queue = value;
|
|
3463
3463
|
}
|
|
3464
|
-
|
|
3464
|
+
value = type.value;
|
|
3465
3465
|
}
|
|
3466
3466
|
const output = Module.asString(value);
|
|
3467
3467
|
if (output) {
|
|
@@ -3489,7 +3489,7 @@ class Module extends EventEmitter {
|
|
|
3489
3489
|
from = timeStamp;
|
|
3490
3490
|
timeStamp = 0;
|
|
3491
3491
|
}
|
|
3492
|
-
else if ((0, types_1.
|
|
3492
|
+
else if ((0, types_1.isPlainObject)(timeStamp)) {
|
|
3493
3493
|
({ timeStamp, duration, from, source } = timeStamp);
|
|
3494
3494
|
}
|
|
3495
3495
|
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.9.
|
|
3
|
+
"version": "0.9.18",
|
|
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": "BSD-3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/types": "0.9.
|
|
23
|
+
"@e-mc/types": "0.9.18",
|
|
24
24
|
"chalk": "4.1.2",
|
|
25
25
|
"file-type": "16.5.4",
|
|
26
26
|
"js-yaml": "^4.1.0",
|