@e-mc/module 0.6.12 → 0.6.14
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/index.js +7 -20
- 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/index.js
CHANGED
|
@@ -102,7 +102,6 @@ const VALUES = {
|
|
|
102
102
|
["node.process.cpu_usage"]: true,
|
|
103
103
|
["node.process.memory_usage"]: true,
|
|
104
104
|
["node.process.inline"]: true,
|
|
105
|
-
["node.settings.package_manager"]: '',
|
|
106
105
|
["temp.dir"]: "tmp",
|
|
107
106
|
["temp.write"]: false,
|
|
108
107
|
["process.password"]: '',
|
|
@@ -587,7 +586,7 @@ class Module extends EventEmitter {
|
|
|
587
586
|
this[_f] = new AbortController();
|
|
588
587
|
this[_g] = null;
|
|
589
588
|
}
|
|
590
|
-
static get VERSION() { return "0.6.
|
|
589
|
+
static get VERSION() { return "0.6.14"; }
|
|
591
590
|
static get LOG_TYPE() { return types_1.LOG_TYPE; }
|
|
592
591
|
static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
|
|
593
592
|
static get MAX_TIMEOUT() { return 2147483647; }
|
|
@@ -627,7 +626,6 @@ class Module extends EventEmitter {
|
|
|
627
626
|
case "error.fatal":
|
|
628
627
|
return VALUES[key];
|
|
629
628
|
case "node.require.ext":
|
|
630
|
-
case "node.settings.package_manager":
|
|
631
629
|
case "process.password":
|
|
632
630
|
case "process.cipher.algorithm":
|
|
633
631
|
return VALUES[key] !== '';
|
|
@@ -1979,8 +1977,8 @@ class Module extends EventEmitter {
|
|
|
1979
1977
|
}
|
|
1980
1978
|
}
|
|
1981
1979
|
static loadSettings(settings, password) {
|
|
1982
|
-
var _h
|
|
1983
|
-
var
|
|
1980
|
+
var _h;
|
|
1981
|
+
var _j;
|
|
1984
1982
|
const current = VALUES["process.password"];
|
|
1985
1983
|
if (current) {
|
|
1986
1984
|
const proc = settings.process || {};
|
|
@@ -2035,17 +2033,6 @@ class Module extends EventEmitter {
|
|
|
2035
2033
|
VALUES["node.require.inline"] = inline;
|
|
2036
2034
|
}
|
|
2037
2035
|
}
|
|
2038
|
-
const manager = (_j = node.settings) === null || _j === void 0 ? void 0 : _j.package_manager;
|
|
2039
|
-
switch (manager) {
|
|
2040
|
-
case 'npm':
|
|
2041
|
-
case 'yarn':
|
|
2042
|
-
case 'pnpm':
|
|
2043
|
-
VALUES["node.settings.package_manager"] = manager;
|
|
2044
|
-
break;
|
|
2045
|
-
default:
|
|
2046
|
-
VALUES["node.settings.package_manager"] = '';
|
|
2047
|
-
break;
|
|
2048
|
-
}
|
|
2049
2036
|
}
|
|
2050
2037
|
if ((0, types_1.isPlainObject)(settings.process)) {
|
|
2051
2038
|
const { env, cipher, password: pwd } = settings.process;
|
|
@@ -2053,7 +2040,7 @@ class Module extends EventEmitter {
|
|
|
2053
2040
|
VALUES["process.env.apply"] = env.apply;
|
|
2054
2041
|
}
|
|
2055
2042
|
if ((0, types_1.isString)(pwd)) {
|
|
2056
|
-
VALUES[
|
|
2043
|
+
VALUES[_j = "process.password"] || (VALUES[_j] = encryptMessage(pwd, cipher));
|
|
2057
2044
|
}
|
|
2058
2045
|
}
|
|
2059
2046
|
if (memory && (0, types_1.isPlainObject)(memory.settings)) {
|
|
@@ -3068,7 +3055,7 @@ class Module extends EventEmitter {
|
|
|
3068
3055
|
if (typeof options === 'number') {
|
|
3069
3056
|
options = undefined;
|
|
3070
3057
|
}
|
|
3071
|
-
this.writeFail("Unknown", err, { ...options, type: types_1.LOG_TYPE.SYSTEM, code: types_1.ERR_CODE.MODULE_NOT_FOUND, exec: { command:
|
|
3058
|
+
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] } });
|
|
3072
3059
|
return true;
|
|
3073
3060
|
}
|
|
3074
3061
|
if (value) {
|
|
@@ -3361,8 +3348,8 @@ Module.LOG_STYLE_WARN = Object.freeze({ titleBgColor: 'bgBlack', titleColor: 'ye
|
|
|
3361
3348
|
Module.LOG_STYLE_NOTICE = Object.freeze({ titleBgColor: 'bgGrey', titleColor: 'white' });
|
|
3362
3349
|
Module.LOG_STYLE_REVERSE = Object.freeze({ titleBgColor: 'bgWhite', titleColor: 'black', messageBgColor: 'bgGrey' });
|
|
3363
3350
|
if (!Module.supported(15, 4)) {
|
|
3364
|
-
({ AbortController:
|
|
3365
|
-
({ EventTarget:
|
|
3351
|
+
({ AbortController: globalThis.AbortController } = require('abort-controller'));
|
|
3352
|
+
({ EventTarget: globalThis.EventTarget } = require('event-target-shim'));
|
|
3366
3353
|
}
|
|
3367
3354
|
EventEmitter.defaultMaxListeners = Infinity;
|
|
3368
3355
|
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.6.
|
|
3
|
+
"version": "0.6.14",
|
|
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.6.
|
|
23
|
+
"@e-mc/types": "0.6.14",
|
|
24
24
|
"abort-controller": "^3.0.0",
|
|
25
25
|
"chalk": "4.1.2",
|
|
26
26
|
"event-target-shim": "^5.0.1",
|