@e-mc/module 0.12.6 → 0.12.7
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 +28 -26
- 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.12.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.12.7/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogStatus } from "./squared";
|
|
@@ -414,11 +414,11 @@ interface LoggerModule {
|
|
|
414
414
|
|
|
415
415
|
## References
|
|
416
416
|
|
|
417
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
418
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
419
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
420
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
421
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
417
|
+
- https://www.unpkg.com/@e-mc/types@0.12.7/lib/core.d.ts
|
|
418
|
+
- https://www.unpkg.com/@e-mc/types@0.12.7/lib/logger.d.ts
|
|
419
|
+
- https://www.unpkg.com/@e-mc/types@0.12.7/lib/module.d.ts
|
|
420
|
+
- https://www.unpkg.com/@e-mc/types@0.12.7/lib/node.d.ts
|
|
421
|
+
- https://www.unpkg.com/@e-mc/types@0.12.7/lib/settings.d.ts
|
|
422
422
|
|
|
423
423
|
* https://www.npmjs.com/package/@types/node
|
|
424
424
|
|
package/index.js
CHANGED
|
@@ -869,7 +869,7 @@ class Module extends EventEmitter {
|
|
|
869
869
|
static LOG_STYLE_NOTICE = Object.freeze({ titleBgColor: 'bgGrey', titleColor: 'white' });
|
|
870
870
|
static LOG_STYLE_REVERSE = Object.freeze({ titleBgColor: 'bgWhite', titleColor: 'black', messageBgColor: 'bgGrey' });
|
|
871
871
|
static get VERSION() {
|
|
872
|
-
return "0.12.
|
|
872
|
+
return "0.12.7";
|
|
873
873
|
}
|
|
874
874
|
static get LOG_TYPE() {
|
|
875
875
|
return types_1.LOG_TYPE;
|
|
@@ -1373,33 +1373,33 @@ class Module extends EventEmitter {
|
|
|
1373
1373
|
return cacheKey ? crypto.randomUUID() : '';
|
|
1374
1374
|
}
|
|
1375
1375
|
static asHash(data, algorithm, encoding) {
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
let options;
|
|
1380
|
-
if ((0, types_1.isObject)(algorithm)) {
|
|
1381
|
-
options = { ...algorithm };
|
|
1382
|
-
if ('algorithm' in options) {
|
|
1383
|
-
algorithm = options.algorithm;
|
|
1384
|
-
delete options.algorithm;
|
|
1385
|
-
}
|
|
1386
|
-
else {
|
|
1387
|
-
algorithm = undefined;
|
|
1376
|
+
try {
|
|
1377
|
+
if (!algorithm && !encoding) {
|
|
1378
|
+
return crypto.createHash("sha256").update(data).digest("hex");
|
|
1388
1379
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1380
|
+
let options;
|
|
1381
|
+
if ((0, types_1.isObject)(algorithm)) {
|
|
1382
|
+
options = { ...algorithm };
|
|
1383
|
+
if ('algorithm' in options) {
|
|
1384
|
+
algorithm = options.algorithm;
|
|
1385
|
+
delete options.algorithm;
|
|
1386
|
+
}
|
|
1387
|
+
else {
|
|
1388
|
+
algorithm = undefined;
|
|
1389
|
+
}
|
|
1390
|
+
if ('digestEncoding' in options || 'digest' in options) {
|
|
1391
|
+
encoding = options.digestEncoding || options.digest;
|
|
1392
|
+
delete options.digest;
|
|
1393
|
+
delete options.digestEncoding;
|
|
1394
|
+
}
|
|
1395
|
+
else {
|
|
1396
|
+
encoding = undefined;
|
|
1397
|
+
}
|
|
1393
1398
|
}
|
|
1394
|
-
else {
|
|
1399
|
+
else if ((0, types_1.isObject)(encoding)) {
|
|
1400
|
+
options = encoding;
|
|
1395
1401
|
encoding = undefined;
|
|
1396
1402
|
}
|
|
1397
|
-
}
|
|
1398
|
-
else if ((0, types_1.isObject)(encoding)) {
|
|
1399
|
-
options = encoding;
|
|
1400
|
-
encoding = undefined;
|
|
1401
|
-
}
|
|
1402
|
-
try {
|
|
1403
1403
|
return crypto.createHash(algorithm || "sha256", options).update(data).digest(encoding || "hex");
|
|
1404
1404
|
}
|
|
1405
1405
|
catch {
|
|
@@ -1593,11 +1593,13 @@ class Module extends EventEmitter {
|
|
|
1593
1593
|
if (typeof values[values.length - 1] === 'boolean') {
|
|
1594
1594
|
normalize = values.pop();
|
|
1595
1595
|
}
|
|
1596
|
-
const paths = values.
|
|
1596
|
+
const paths = values.filter(item => (0, types_1.isString)(item)).map(value => this.toPosix(value, normalize));
|
|
1597
1597
|
let result = paths[0] || '';
|
|
1598
1598
|
for (let i = 1; i < paths.length; ++i) {
|
|
1599
1599
|
const trailing = paths[i];
|
|
1600
|
-
|
|
1600
|
+
if (trailing) {
|
|
1601
|
+
result += (!trailing.startsWith('/') && !result.endsWith('/') ? '/' : '') + trailing;
|
|
1602
|
+
}
|
|
1601
1603
|
}
|
|
1602
1604
|
return result;
|
|
1603
1605
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/module",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.7",
|
|
4
4
|
"description": "Module base class for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"license": "BSD-3-Clause",
|
|
20
20
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@e-mc/types": "0.12.
|
|
22
|
+
"@e-mc/types": "0.12.7",
|
|
23
23
|
"chalk": "4.1.2",
|
|
24
24
|
"file-type": "^18.7.0",
|
|
25
25
|
"js-yaml": "^4.1.0",
|