@e-mc/module 0.9.2 → 0.9.3
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 +7 -7
- 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.3/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogStatus } from "./squared";
|
|
@@ -391,11 +391,11 @@ type ForegroundColor = typeof IForegroundColor | `#${string}`;
|
|
|
391
391
|
|
|
392
392
|
## References
|
|
393
393
|
|
|
394
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
395
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
396
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
397
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
398
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
394
|
+
- https://www.unpkg.com/@e-mc/types@0.9.3/lib/core.d.ts
|
|
395
|
+
- https://www.unpkg.com/@e-mc/types@0.9.3/lib/logger.d.ts
|
|
396
|
+
- https://www.unpkg.com/@e-mc/types@0.9.3/lib/module.d.ts
|
|
397
|
+
- https://www.unpkg.com/@e-mc/types@0.9.3/lib/node.d.ts
|
|
398
|
+
- https://www.unpkg.com/@e-mc/types@0.9.3/lib/settings.d.ts
|
|
399
399
|
|
|
400
400
|
* https://www.npmjs.com/package/@types/node
|
|
401
401
|
|
package/index.js
CHANGED
|
@@ -649,7 +649,7 @@ function withinDir(value, base) {
|
|
|
649
649
|
value = path.normalize(value);
|
|
650
650
|
return (PLATFORM_WIN32 ? value.toLowerCase() : value).startsWith(ensureDir(PLATFORM_WIN32 ? base.toLowerCase() : base));
|
|
651
651
|
}
|
|
652
|
-
function formatPercent(value, precision
|
|
652
|
+
function formatPercent(value, precision) {
|
|
653
653
|
if (value <= 0) {
|
|
654
654
|
return '0%';
|
|
655
655
|
}
|
|
@@ -695,7 +695,7 @@ class Module extends EventEmitter {
|
|
|
695
695
|
this[_f] = new AbortController();
|
|
696
696
|
this[_g] = null;
|
|
697
697
|
}
|
|
698
|
-
static get VERSION() { return "0.9.
|
|
698
|
+
static get VERSION() { return "0.9.3"; }
|
|
699
699
|
static get LOG_TYPE() { return types_1.LOG_TYPE; }
|
|
700
700
|
static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
|
|
701
701
|
static get MAX_TIMEOUT() { return 2147483647; }
|
|
@@ -1808,7 +1808,7 @@ class Module extends EventEmitter {
|
|
|
1808
1808
|
const usage = user + system;
|
|
1809
1809
|
result = usage > 0 ? Math.min(usage / value, 1) * (typeof SETTINGS.process === 'object' && SETTINGS.process.cpu_single_core ? 1 : CPU_CORETOTAL) : 0;
|
|
1810
1810
|
}
|
|
1811
|
-
return format ? formatPercent(result) : result;
|
|
1811
|
+
return format ? formatPercent(result, 3) : result;
|
|
1812
1812
|
}
|
|
1813
1813
|
}
|
|
1814
1814
|
return format ? '' : 0;
|
|
@@ -1838,7 +1838,7 @@ class Module extends EventEmitter {
|
|
|
1838
1838
|
return (0, types_1.formatSize)(result, { unit });
|
|
1839
1839
|
}
|
|
1840
1840
|
}
|
|
1841
|
-
return format ? formatPercent(result / MEM_TOTAL) : result;
|
|
1841
|
+
return format ? formatPercent(result / MEM_TOTAL, 3) : result;
|
|
1842
1842
|
}
|
|
1843
1843
|
static formatCpuMem(start, all) {
|
|
1844
1844
|
let cpu, cpu_bar, cpu_single_core, mem, mem_format;
|
|
@@ -1869,7 +1869,7 @@ class Module extends EventEmitter {
|
|
|
1869
1869
|
}
|
|
1870
1870
|
const unit = Math.max(bar, 10);
|
|
1871
1871
|
const length = Math.floor(usage * unit);
|
|
1872
|
-
const hint = usage === 1 ? "MAX" : usage < 0 ? "N/A" : formatPercent(usage, 2);
|
|
1872
|
+
const hint = usage === 1 ? "MAX" : usage < 0 ? "N/A" : formatPercent(usage, 2).padStart(3);
|
|
1873
1873
|
result += chalk[usage >= red ? 'bgRed' : usage >= yellow ? 'bgYellow' : 'bgBlue'].white(':'.repeat(length)) + chalk.bgGrey.white(':'.repeat(unit - length)) + (hint ? chalk.bgWhite.grey(` ${hint} `) : '');
|
|
1874
1874
|
}
|
|
1875
1875
|
else if (usage) {
|
|
@@ -1879,7 +1879,7 @@ class Module extends EventEmitter {
|
|
|
1879
1879
|
if (mem || all) {
|
|
1880
1880
|
const usage = this.getMemUsage(mem_format || true);
|
|
1881
1881
|
if (usage) {
|
|
1882
|
-
result += (result ? ' ' : '') + usage + ' MEM';
|
|
1882
|
+
result += (result ? ' ' : '') + usage.padStart(7) + ' MEM';
|
|
1883
1883
|
}
|
|
1884
1884
|
}
|
|
1885
1885
|
return result;
|
|
@@ -2289,7 +2289,7 @@ class Module extends EventEmitter {
|
|
|
2289
2289
|
if ((0, types_1.isArray)(include)) {
|
|
2290
2290
|
MEMORY_CACHE_DISK.include = include.map(value => this.toPosix(value, true));
|
|
2291
2291
|
}
|
|
2292
|
-
|
|
2292
|
+
if ((0, types_1.isArray)(exclude)) {
|
|
2293
2293
|
MEMORY_CACHE_DISK.exclude = exclude.map(value => this.toPosix(value, true));
|
|
2294
2294
|
}
|
|
2295
2295
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/module",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
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.3",
|
|
24
24
|
"chalk": "4.1.2",
|
|
25
25
|
"file-type": "16.5.4",
|
|
26
26
|
"js-yaml": "^4.1.0",
|