@e-mc/module 0.14.0 → 0.14.2
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 +7 -7
- package/index.js +10 -6
- package/package.json +2 -5
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.14.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.14.2/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogStatus } from "./squared";
|
|
@@ -433,12 +433,12 @@ interface LoggerModule {
|
|
|
433
433
|
|
|
434
434
|
## References
|
|
435
435
|
|
|
436
|
-
- https://www.unpkg.com/@e-mc/types@0.14.
|
|
437
|
-
- https://www.unpkg.com/@e-mc/types@0.14.
|
|
438
|
-
- https://www.unpkg.com/@e-mc/types@0.14.
|
|
439
|
-
- https://www.unpkg.com/@e-mc/types@0.14.
|
|
440
|
-
- https://www.unpkg.com/@e-mc/types@0.14.
|
|
441
|
-
- https://www.unpkg.com/@e-mc/types@0.14.
|
|
436
|
+
- https://www.unpkg.com/@e-mc/types@0.14.2/lib/squared.d.ts
|
|
437
|
+
- https://www.unpkg.com/@e-mc/types@0.14.2/lib/core.d.ts
|
|
438
|
+
- https://www.unpkg.com/@e-mc/types@0.14.2/lib/logger.d.ts
|
|
439
|
+
- https://www.unpkg.com/@e-mc/types@0.14.2/lib/module.d.ts
|
|
440
|
+
- https://www.unpkg.com/@e-mc/types@0.14.2/lib/node.d.ts
|
|
441
|
+
- https://www.unpkg.com/@e-mc/types@0.14.2/lib/settings.d.ts
|
|
442
442
|
|
|
443
443
|
* https://www.npmjs.com/package/@types/node
|
|
444
444
|
* https://www.npmjs.com/package/file-type
|
package/index.js
CHANGED
|
@@ -22,6 +22,7 @@ const OS_HOMEDIR = os.homedir();
|
|
|
22
22
|
const MEM_TOTAL = os.totalmem();
|
|
23
23
|
const CPU_CORETOTAL = os.cpus().length;
|
|
24
24
|
const SUPPORTED_CPUTHREAD = supported(23, 9);
|
|
25
|
+
const SUPPORTED_CPUPARALLELISM = supported(19, 4) || supported(18, 14, true);
|
|
25
26
|
const SUPPORTED_CANPARSE = supported(19, 9) || supported(18, 17, true);
|
|
26
27
|
const CACHE_READTEXT = new Map();
|
|
27
28
|
const CACHE_READBUFFER = new Map();
|
|
@@ -863,7 +864,7 @@ class Module extends EventEmitter {
|
|
|
863
864
|
static LOG_STYLE_NOTICE = Object.freeze({ titleBgColor: 'bgGrey', titleColor: 'white' });
|
|
864
865
|
static LOG_STYLE_REVERSE = Object.freeze({ titleBgColor: 'bgWhite', titleColor: 'black', messageBgColor: 'bgGrey' });
|
|
865
866
|
static get VERSION() {
|
|
866
|
-
return "0.14.
|
|
867
|
+
return "0.14.2";
|
|
867
868
|
}
|
|
868
869
|
static get LOG_TYPE() {
|
|
869
870
|
return LOG_TYPE;
|
|
@@ -1574,7 +1575,10 @@ class Module extends EventEmitter {
|
|
|
1574
1575
|
return isErrorCode(err, ...code);
|
|
1575
1576
|
}
|
|
1576
1577
|
static resolveFile(value) {
|
|
1577
|
-
if (
|
|
1578
|
+
if (value instanceof URL) {
|
|
1579
|
+
value = value.toString();
|
|
1580
|
+
}
|
|
1581
|
+
if (isFileURL(value)) {
|
|
1578
1582
|
try {
|
|
1579
1583
|
return fileURLToPath(value);
|
|
1580
1584
|
}
|
|
@@ -2146,9 +2150,9 @@ class Module extends EventEmitter {
|
|
|
2146
2150
|
folder = path.join(baseDir, folder.slice(PROCESS_CWD.length));
|
|
2147
2151
|
}
|
|
2148
2152
|
try {
|
|
2149
|
-
const
|
|
2150
|
-
if (fs.existsSync(
|
|
2151
|
-
const { name, version } =
|
|
2153
|
+
const packageJSON = path.join(folder, `node_modules/${value}/package.json`);
|
|
2154
|
+
if (fs.existsSync(packageJSON)) {
|
|
2155
|
+
const { name, version } = require(packageJSON);
|
|
2152
2156
|
if (name === value && typeof version === 'string') {
|
|
2153
2157
|
return version.trim();
|
|
2154
2158
|
}
|
|
@@ -2303,7 +2307,7 @@ class Module extends EventEmitter {
|
|
|
2303
2307
|
return result;
|
|
2304
2308
|
}
|
|
2305
2309
|
static availableParallelism(factor = 1) {
|
|
2306
|
-
return Math.ceil((
|
|
2310
|
+
return Math.ceil((SUPPORTED_CPUPARALLELISM ? os.availableParallelism() : os.cpus().length) * factor);
|
|
2307
2311
|
}
|
|
2308
2312
|
static canWrite(name) {
|
|
2309
2313
|
switch (name) {
|
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/module",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"description": "Module base class for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
},
|
|
10
7
|
"repository": {
|
|
11
8
|
"type": "git",
|
|
12
9
|
"url": "git+https://github.com/anpham6/e-mc.git",
|
|
@@ -19,7 +16,7 @@
|
|
|
19
16
|
"license": "BSD-3-Clause",
|
|
20
17
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
21
18
|
"dependencies": {
|
|
22
|
-
"@e-mc/types": "0.14.
|
|
19
|
+
"@e-mc/types": "0.14.2",
|
|
23
20
|
"chalk": "4.1.2",
|
|
24
21
|
"file-type": "^20.5.0",
|
|
25
22
|
"js-yaml": "^4.1.1",
|