@e-mc/module 0.7.15 → 0.7.17
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.7.
|
|
589
|
+
static get VERSION() { return "0.7.17"; }
|
|
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] !== '';
|
|
@@ -2010,8 +2008,8 @@ class Module extends EventEmitter {
|
|
|
2010
2008
|
}
|
|
2011
2009
|
}
|
|
2012
2010
|
static loadSettings(settings, password) {
|
|
2013
|
-
var _h
|
|
2014
|
-
var
|
|
2011
|
+
var _h;
|
|
2012
|
+
var _j;
|
|
2015
2013
|
const current = VALUES["process.password"];
|
|
2016
2014
|
if (current) {
|
|
2017
2015
|
const proc = settings.process || {};
|
|
@@ -2066,17 +2064,6 @@ class Module extends EventEmitter {
|
|
|
2066
2064
|
VALUES["node.require.inline"] = inline;
|
|
2067
2065
|
}
|
|
2068
2066
|
}
|
|
2069
|
-
const manager = (_j = node.settings) === null || _j === void 0 ? void 0 : _j.package_manager;
|
|
2070
|
-
switch (manager) {
|
|
2071
|
-
case 'npm':
|
|
2072
|
-
case 'yarn':
|
|
2073
|
-
case 'pnpm':
|
|
2074
|
-
VALUES["node.settings.package_manager"] = manager;
|
|
2075
|
-
break;
|
|
2076
|
-
default:
|
|
2077
|
-
VALUES["node.settings.package_manager"] = '';
|
|
2078
|
-
break;
|
|
2079
|
-
}
|
|
2080
2067
|
}
|
|
2081
2068
|
if ((0, types_1.isPlainObject)(settings.process)) {
|
|
2082
2069
|
const { env, cipher, password: pwd } = settings.process;
|
|
@@ -2084,7 +2071,7 @@ class Module extends EventEmitter {
|
|
|
2084
2071
|
VALUES["process.env.apply"] = env.apply;
|
|
2085
2072
|
}
|
|
2086
2073
|
if ((0, types_1.isString)(pwd)) {
|
|
2087
|
-
VALUES[
|
|
2074
|
+
VALUES[_j = "process.password"] || (VALUES[_j] = encryptMessage(pwd, cipher));
|
|
2088
2075
|
}
|
|
2089
2076
|
}
|
|
2090
2077
|
if (memory && (0, types_1.isPlainObject)(memory.settings)) {
|
|
@@ -3100,7 +3087,7 @@ class Module extends EventEmitter {
|
|
|
3100
3087
|
if (typeof options === 'number') {
|
|
3101
3088
|
options = undefined;
|
|
3102
3089
|
}
|
|
3103
|
-
this.writeFail("Unknown", err, { ...options, type: types_1.LOG_TYPE.SYSTEM, code: types_1.ERR_CODE.MODULE_NOT_FOUND, exec: { command:
|
|
3090
|
+
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] } });
|
|
3104
3091
|
return true;
|
|
3105
3092
|
}
|
|
3106
3093
|
if (value) {
|
|
@@ -3393,8 +3380,8 @@ Module.LOG_STYLE_WARN = Object.freeze({ titleBgColor: 'bgBlack', titleColor: 'ye
|
|
|
3393
3380
|
Module.LOG_STYLE_NOTICE = Object.freeze({ titleBgColor: 'bgGrey', titleColor: 'white' });
|
|
3394
3381
|
Module.LOG_STYLE_REVERSE = Object.freeze({ titleBgColor: 'bgWhite', titleColor: 'black', messageBgColor: 'bgGrey' });
|
|
3395
3382
|
if (!Module.supported(15, 4)) {
|
|
3396
|
-
({ AbortController:
|
|
3397
|
-
({ EventTarget:
|
|
3383
|
+
({ AbortController: globalThis.AbortController } = require('abort-controller'));
|
|
3384
|
+
({ EventTarget: globalThis.EventTarget } = require('event-target-shim'));
|
|
3398
3385
|
}
|
|
3399
3386
|
EventEmitter.defaultMaxListeners = Infinity;
|
|
3400
3387
|
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.7.
|
|
3
|
+
"version": "0.7.17",
|
|
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.7.
|
|
23
|
+
"@e-mc/types": "0.7.17",
|
|
24
24
|
"abort-controller": "^3.0.0",
|
|
25
25
|
"chalk": "4.1.2",
|
|
26
26
|
"event-target-shim": "^5.0.1",
|