@e-mc/module 0.10.8 → 0.10.10
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 +12 -13
- 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.10.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.10/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogStatus } from "./squared";
|
|
@@ -407,11 +407,11 @@ interface LoggerModule {
|
|
|
407
407
|
|
|
408
408
|
## References
|
|
409
409
|
|
|
410
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
411
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
412
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
413
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
414
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
410
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/core.d.ts
|
|
411
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/logger.d.ts
|
|
412
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/module.d.ts
|
|
413
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/node.d.ts
|
|
414
|
+
- https://www.unpkg.com/@e-mc/types@0.10.10/lib/settings.d.ts
|
|
415
415
|
|
|
416
416
|
* https://www.npmjs.com/package/@types/node
|
|
417
417
|
|
package/index.js
CHANGED
|
@@ -917,10 +917,9 @@ function truncateStart(value, length = LOG_MIN_WIDTH, style = false) {
|
|
|
917
917
|
function truncateEnd(value, length) {
|
|
918
918
|
return (REGEXP_ANSIESCAPE.test(value) ? stripansi(value) : value).length > length ? '...' + value.substring(value.length - length + 3) : value;
|
|
919
919
|
}
|
|
920
|
-
const
|
|
921
|
-
const formatLogMessage = (type, message, unit, ident) => isMeterUnit(type, ident) ? (unit + LOG_DIVIDER + message).trimEnd() : unit ? (message + (ident ? '' : ' ') + unit).trimStart() : message;
|
|
920
|
+
const formatLogMessage = (type, message, unit, ident) => !ident && (type & 256) ? (unit + LOG_DIVIDER + message).trimEnd() : unit ? (type & 256) && ident ? unit + LOG_DIVIDER + message : (message + (ident ? '' : ' ') + unit).trimStart() : message;
|
|
922
921
|
const hideAbort = (err) => err.name === 'AbortError' && SETTINGS.abort === false;
|
|
923
|
-
const asFile = (value) => typeof value === 'string' ? value.trim() : value instanceof URL && value.protocol === 'file:' ? (0, url_1.fileURLToPath)(value) : '';
|
|
922
|
+
const asFile = (value) => typeof value === 'string' ? PLATFORM_WIN32 ? value.trim() : value : value instanceof URL && value.protocol === 'file:' ? (0, url_1.fileURLToPath)(value) : '';
|
|
924
923
|
const wrapQuote = (value) => '"' + value.replaceAll('"', '\\"') + '"';
|
|
925
924
|
const isFunction = (value) => typeof value === 'function';
|
|
926
925
|
const isFileURL = (value) => /^file:\/\//i.test(value);
|
|
@@ -960,7 +959,7 @@ class Module extends EventEmitter {
|
|
|
960
959
|
this[_g] = null;
|
|
961
960
|
}
|
|
962
961
|
static get VERSION() {
|
|
963
|
-
return "0.10.
|
|
962
|
+
return "0.10.10";
|
|
964
963
|
}
|
|
965
964
|
static get LOG_TYPE() {
|
|
966
965
|
return types_1.LOG_TYPE;
|
|
@@ -1048,7 +1047,7 @@ class Module extends EventEmitter {
|
|
|
1048
1047
|
if (error && hideAbort(message)) {
|
|
1049
1048
|
return;
|
|
1050
1049
|
}
|
|
1051
|
-
if (options.type) {
|
|
1050
|
+
if (typeof options.type === 'number') {
|
|
1052
1051
|
type |= options.type;
|
|
1053
1052
|
}
|
|
1054
1053
|
const BROADCAST_OUT = VALUES["broadcast.out"];
|
|
@@ -1249,7 +1248,7 @@ class Module extends EventEmitter {
|
|
|
1249
1248
|
const logOptions = { maxLength: messageWidth ?? formatMessage.width, outLength: 0, messageTextWrap };
|
|
1250
1249
|
m = formatLogColumn(m, messageColor, messageBgColor, messageBold, messageUnitIndent ? format.meter.bgAltColor : undefined, logOptions);
|
|
1251
1250
|
if (u && messageTextWrap && messageTextWrap !== 'none' && LOG_MIN_WIDTH + logOptions.outLength + stripansi(unit).length + (messageUnitIndent ? 0 : 1) > PROCESS_STDOUT.columns) {
|
|
1252
|
-
if (
|
|
1251
|
+
if ((type & 256) && !messageUnitIndent) {
|
|
1253
1252
|
m = '';
|
|
1254
1253
|
if (LOG_MIN_WIDTH + stripansi(u).length > PROCESS_STDOUT.columns) {
|
|
1255
1254
|
u = '';
|
|
@@ -1533,7 +1532,7 @@ class Module extends EventEmitter {
|
|
|
1533
1532
|
filename = undefined;
|
|
1534
1533
|
}
|
|
1535
1534
|
if (typeof value === 'string') {
|
|
1536
|
-
let pathname = value.trim(), convert = true;
|
|
1535
|
+
let pathname = PLATFORM_WIN32 ? value.trim() : value, convert = true;
|
|
1537
1536
|
if (normalize) {
|
|
1538
1537
|
pathname = path.normalize(pathname);
|
|
1539
1538
|
convert = PLATFORM_WIN32;
|
|
@@ -1648,7 +1647,7 @@ class Module extends EventEmitter {
|
|
|
1648
1647
|
return false;
|
|
1649
1648
|
}
|
|
1650
1649
|
static resolveFile(value) {
|
|
1651
|
-
if (isFileURL(value = value instanceof URL ? value.toString() : value
|
|
1650
|
+
if (isFileURL(value = value instanceof URL ? value.toString() : value)) {
|
|
1652
1651
|
try {
|
|
1653
1652
|
return (0, url_1.fileURLToPath)(value);
|
|
1654
1653
|
}
|
|
@@ -1663,7 +1662,7 @@ class Module extends EventEmitter {
|
|
|
1663
1662
|
}
|
|
1664
1663
|
static resolvePath(value, base) {
|
|
1665
1664
|
try {
|
|
1666
|
-
if (this.isURL(value
|
|
1665
|
+
if (this.isURL(value)) {
|
|
1667
1666
|
return isFileURL(value) ? (0, url_1.fileURLToPath)(value) : new URL(value).href;
|
|
1668
1667
|
}
|
|
1669
1668
|
if (base instanceof URL || this.isURL(base)) {
|
|
@@ -1695,7 +1694,7 @@ class Module extends EventEmitter {
|
|
|
1695
1694
|
flags = flags ? 2 : 0;
|
|
1696
1695
|
}
|
|
1697
1696
|
if (typeof value === 'string') {
|
|
1698
|
-
let result = value.trim();
|
|
1697
|
+
let result = PLATFORM_WIN32 ? value.trim() : value;
|
|
1699
1698
|
result = flags & 1 ? path.resolve(result) : path.normalize(result);
|
|
1700
1699
|
if ((flags & 2) && result.length > 0) {
|
|
1701
1700
|
result = ensureDir(result);
|
|
@@ -3656,12 +3655,12 @@ class Module extends EventEmitter {
|
|
|
3656
3655
|
}
|
|
3657
3656
|
}
|
|
3658
3657
|
writeLog(type, value, timeStamp, duration) {
|
|
3659
|
-
let queue;
|
|
3658
|
+
let queue = false;
|
|
3660
3659
|
if ((0, types_1.isObject)(type)) {
|
|
3661
3660
|
if (typeof value === 'boolean') {
|
|
3662
3661
|
queue = value;
|
|
3663
3662
|
}
|
|
3664
|
-
|
|
3663
|
+
value = type.value;
|
|
3665
3664
|
}
|
|
3666
3665
|
const output = Module.asString(value);
|
|
3667
3666
|
if (output) {
|
|
@@ -3689,7 +3688,7 @@ class Module extends EventEmitter {
|
|
|
3689
3688
|
from = timeStamp;
|
|
3690
3689
|
timeStamp = 0;
|
|
3691
3690
|
}
|
|
3692
|
-
else if ((0, types_1.
|
|
3691
|
+
else if ((0, types_1.isPlainObject)(timeStamp)) {
|
|
3693
3692
|
({ timeStamp, duration, from, source } = timeStamp);
|
|
3694
3693
|
}
|
|
3695
3694
|
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.10.
|
|
3
|
+
"version": "0.10.10",
|
|
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.10.
|
|
23
|
+
"@e-mc/types": "0.10.10",
|
|
24
24
|
"chalk": "4.1.2",
|
|
25
25
|
"file-type": "^18.7.0",
|
|
26
26
|
"js-yaml": "^4.1.0",
|