@e-mc/module 0.8.20 → 0.8.21
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/LICENSE +1 -1
- package/README.md +5 -5
- package/index.js +8 -21
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2023 An Pham
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
12
|
+
- https://www.unpkg.com/@e-mc/types@0.8.21/lib/index.d.ts
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogStatus } from "./squared";
|
|
@@ -231,10 +231,10 @@ interface ModuleConstructor {
|
|
|
231
231
|
|
|
232
232
|
## References
|
|
233
233
|
|
|
234
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
235
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
236
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
237
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
234
|
+
- https://www.unpkg.com/@e-mc/types@0.8.21/lib/core.d.ts
|
|
235
|
+
- https://www.unpkg.com/@e-mc/types@0.8.21/lib/logger.d.ts
|
|
236
|
+
- https://www.unpkg.com/@e-mc/types@0.8.21/lib/module.d.ts
|
|
237
|
+
- https://www.unpkg.com/@e-mc/types@0.8.21/lib/node.d.ts
|
|
238
238
|
|
|
239
239
|
## LICENSE
|
|
240
240
|
|
package/index.js
CHANGED
|
@@ -106,7 +106,6 @@ const VALUES = {
|
|
|
106
106
|
["node.process.cpu_usage"]: true,
|
|
107
107
|
["node.process.memory_usage"]: true,
|
|
108
108
|
["node.process.inline"]: true,
|
|
109
|
-
["node.settings.package_manager"]: '',
|
|
110
109
|
["temp.dir"]: "tmp",
|
|
111
110
|
["temp.write"]: false,
|
|
112
111
|
["process.password"]: '',
|
|
@@ -715,7 +714,7 @@ class Module extends EventEmitter {
|
|
|
715
714
|
this[_f] = new AbortController();
|
|
716
715
|
this[_g] = null;
|
|
717
716
|
}
|
|
718
|
-
static get VERSION() { return "0.8.
|
|
717
|
+
static get VERSION() { return "0.8.21"; }
|
|
719
718
|
static get LOG_TYPE() { return types_1.LOG_TYPE; }
|
|
720
719
|
static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
|
|
721
720
|
static get MAX_TIMEOUT() { return 2147483647; }
|
|
@@ -757,7 +756,6 @@ class Module extends EventEmitter {
|
|
|
757
756
|
case "error.fatal":
|
|
758
757
|
return VALUES[key];
|
|
759
758
|
case "node.require.ext":
|
|
760
|
-
case "node.settings.package_manager":
|
|
761
759
|
case "process.password":
|
|
762
760
|
case "process.cipher.algorithm":
|
|
763
761
|
return VALUES[key] !== '';
|
|
@@ -2206,8 +2204,8 @@ class Module extends EventEmitter {
|
|
|
2206
2204
|
}
|
|
2207
2205
|
}
|
|
2208
2206
|
static loadSettings(settings, password) {
|
|
2209
|
-
var _h
|
|
2210
|
-
var
|
|
2207
|
+
var _h;
|
|
2208
|
+
var _j;
|
|
2211
2209
|
const current = VALUES["process.password"];
|
|
2212
2210
|
if (current) {
|
|
2213
2211
|
const proc = settings.process || {};
|
|
@@ -2262,17 +2260,6 @@ class Module extends EventEmitter {
|
|
|
2262
2260
|
VALUES["node.require.inline"] = inline;
|
|
2263
2261
|
}
|
|
2264
2262
|
}
|
|
2265
|
-
const manager = (_j = node.settings) === null || _j === void 0 ? void 0 : _j.package_manager;
|
|
2266
|
-
switch (manager) {
|
|
2267
|
-
case 'npm':
|
|
2268
|
-
case 'yarn':
|
|
2269
|
-
case 'pnpm':
|
|
2270
|
-
VALUES["node.settings.package_manager"] = manager;
|
|
2271
|
-
break;
|
|
2272
|
-
default:
|
|
2273
|
-
VALUES["node.settings.package_manager"] = '';
|
|
2274
|
-
break;
|
|
2275
|
-
}
|
|
2276
2263
|
}
|
|
2277
2264
|
if ((0, types_1.isPlainObject)(settings.process)) {
|
|
2278
2265
|
const { env, cipher, password: pwd } = settings.process;
|
|
@@ -2280,7 +2267,7 @@ class Module extends EventEmitter {
|
|
|
2280
2267
|
VALUES["process.env.apply"] = env.apply;
|
|
2281
2268
|
}
|
|
2282
2269
|
if ((0, types_1.isString)(pwd)) {
|
|
2283
|
-
VALUES[
|
|
2270
|
+
VALUES[_j = "process.password"] || (VALUES[_j] = encryptMessage(pwd, cipher));
|
|
2284
2271
|
}
|
|
2285
2272
|
}
|
|
2286
2273
|
if ((0, types_1.isPlainObject)(memory === null || memory === void 0 ? void 0 : memory.settings)) {
|
|
@@ -3360,7 +3347,7 @@ class Module extends EventEmitter {
|
|
|
3360
3347
|
if (typeof options === 'number') {
|
|
3361
3348
|
options = undefined;
|
|
3362
3349
|
}
|
|
3363
|
-
this.writeFail("Unknown", err, { ...options, type: types_1.LOG_TYPE.SYSTEM, code: types_1.ERR_CODE.MODULE_NOT_FOUND, exec: { command:
|
|
3350
|
+
this.writeFail("Unknown", err, { ...options, type: types_1.LOG_TYPE.SYSTEM, code: types_1.ERR_CODE.MODULE_NOT_FOUND, exec: { command: 'npm', args: ['i', name] } });
|
|
3364
3351
|
return true;
|
|
3365
3352
|
}
|
|
3366
3353
|
if (value) {
|
|
@@ -3652,9 +3639,9 @@ Module.LOG_STYLE_INFO = Object.freeze({ titleBgColor: 'bgBlue', titleColor: 'whi
|
|
|
3652
3639
|
Module.LOG_STYLE_WARN = Object.freeze({ titleBgColor: 'bgBlack', titleColor: 'yellow', titleBold: true });
|
|
3653
3640
|
Module.LOG_STYLE_NOTICE = Object.freeze({ titleBgColor: 'bgGrey', titleColor: 'white' });
|
|
3654
3641
|
Module.LOG_STYLE_REVERSE = Object.freeze({ titleBgColor: 'bgWhite', titleColor: 'black', messageBgColor: 'bgGrey' });
|
|
3655
|
-
if (!Module.supported(15, 4) && (!
|
|
3656
|
-
({ AbortController:
|
|
3657
|
-
({ EventTarget:
|
|
3642
|
+
if (!Module.supported(15, 4) && (!globalThis.AbortController || !globalThis.EventTarget)) {
|
|
3643
|
+
({ AbortController: globalThis.AbortController } = require('abort-controller'));
|
|
3644
|
+
({ EventTarget: globalThis.EventTarget } = require('event-target-shim'));
|
|
3658
3645
|
}
|
|
3659
3646
|
EventEmitter.defaultMaxListeners = Infinity;
|
|
3660
3647
|
Object.freeze(types_1.LOG_TYPE);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/module",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.21",
|
|
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": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/types": "0.8.
|
|
23
|
+
"@e-mc/types": "0.8.21",
|
|
24
24
|
"abort-controller": "^3.0.0",
|
|
25
25
|
"chalk": "4.1.2",
|
|
26
26
|
"event-target-shim": "^5.0.1",
|