@e-mc/module 0.6.11 → 0.6.13
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/index.d.ts +4 -4
- package/index.js +20 -7
- package/lib-v4.d.ts +4 -4
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ModuleConstructor } from '
|
|
2
|
-
|
|
3
|
-
declare const Module: ModuleConstructor;
|
|
4
|
-
|
|
1
|
+
import type { ModuleConstructor } from '@e-mc/types/lib';
|
|
2
|
+
|
|
3
|
+
declare const Module: ModuleConstructor;
|
|
4
|
+
|
|
5
5
|
export = Module;
|
package/index.js
CHANGED
|
@@ -102,6 +102,7 @@ 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"]: '',
|
|
105
106
|
["temp.dir"]: "tmp",
|
|
106
107
|
["temp.write"]: false,
|
|
107
108
|
["process.password"]: '',
|
|
@@ -586,7 +587,7 @@ class Module extends EventEmitter {
|
|
|
586
587
|
this[_f] = new AbortController();
|
|
587
588
|
this[_g] = null;
|
|
588
589
|
}
|
|
589
|
-
static get VERSION() { return "0.6.
|
|
590
|
+
static get VERSION() { return "0.6.13"; }
|
|
590
591
|
static get LOG_TYPE() { return types_1.LOG_TYPE; }
|
|
591
592
|
static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
|
|
592
593
|
static get MAX_TIMEOUT() { return 2147483647; }
|
|
@@ -626,6 +627,7 @@ class Module extends EventEmitter {
|
|
|
626
627
|
case "error.fatal":
|
|
627
628
|
return VALUES[key];
|
|
628
629
|
case "node.require.ext":
|
|
630
|
+
case "node.settings.package_manager":
|
|
629
631
|
case "process.password":
|
|
630
632
|
case "process.cipher.algorithm":
|
|
631
633
|
return VALUES[key] !== '';
|
|
@@ -1869,8 +1871,8 @@ class Module extends EventEmitter {
|
|
|
1869
1871
|
}
|
|
1870
1872
|
static sanitizeArgs(values, doubleQuote) {
|
|
1871
1873
|
const result = typeof values === 'string' ? [values] : values;
|
|
1872
|
-
const pattern = /[
|
|
1873
|
-
const sanitize = (value) => value.replace(pattern, capture => (capture === '$' || capture === '`' ? '\\' : '') + '\\' + capture);
|
|
1874
|
+
const pattern = /[^\w+-.,/:@]/g;
|
|
1875
|
+
const sanitize = (value) => value.replace(pattern, capture => capture === '\n' ? "'\n'" : (capture === '$' || capture === '`' ? '\\' : '') + '\\' + capture);
|
|
1874
1876
|
for (let i = 0; i < result.length; ++i) {
|
|
1875
1877
|
let value = result[i].trim(), leading = '';
|
|
1876
1878
|
if (value !== '--') {
|
|
@@ -1977,8 +1979,8 @@ class Module extends EventEmitter {
|
|
|
1977
1979
|
}
|
|
1978
1980
|
}
|
|
1979
1981
|
static loadSettings(settings, password) {
|
|
1980
|
-
var _h;
|
|
1981
|
-
var
|
|
1982
|
+
var _h, _j;
|
|
1983
|
+
var _k;
|
|
1982
1984
|
const current = VALUES["process.password"];
|
|
1983
1985
|
if (current) {
|
|
1984
1986
|
const proc = settings.process || {};
|
|
@@ -2033,6 +2035,17 @@ class Module extends EventEmitter {
|
|
|
2033
2035
|
VALUES["node.require.inline"] = inline;
|
|
2034
2036
|
}
|
|
2035
2037
|
}
|
|
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
|
+
}
|
|
2036
2049
|
}
|
|
2037
2050
|
if ((0, types_1.isPlainObject)(settings.process)) {
|
|
2038
2051
|
const { env, cipher, password: pwd } = settings.process;
|
|
@@ -2040,7 +2053,7 @@ class Module extends EventEmitter {
|
|
|
2040
2053
|
VALUES["process.env.apply"] = env.apply;
|
|
2041
2054
|
}
|
|
2042
2055
|
if ((0, types_1.isString)(pwd)) {
|
|
2043
|
-
VALUES[
|
|
2056
|
+
VALUES[_k = "process.password"] || (VALUES[_k] = encryptMessage(pwd, cipher));
|
|
2044
2057
|
}
|
|
2045
2058
|
}
|
|
2046
2059
|
if (memory && (0, types_1.isPlainObject)(memory.settings)) {
|
|
@@ -3055,7 +3068,7 @@ class Module extends EventEmitter {
|
|
|
3055
3068
|
if (typeof options === 'number') {
|
|
3056
3069
|
options = undefined;
|
|
3057
3070
|
}
|
|
3058
|
-
this.writeFail("Unknown", err, { ...options, type: types_1.LOG_TYPE.SYSTEM, code: types_1.ERR_CODE.MODULE_NOT_FOUND, exec: { command: 'npm', args: ['
|
|
3071
|
+
this.writeFail("Unknown", err, { ...options, type: types_1.LOG_TYPE.SYSTEM, code: types_1.ERR_CODE.MODULE_NOT_FOUND, exec: { command: VALUES["node.settings.package_manager"] || 'npm', args: ['install', name] } });
|
|
3059
3072
|
return true;
|
|
3060
3073
|
}
|
|
3061
3074
|
if (value) {
|
package/lib-v4.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IModuleLibV4 } from '
|
|
2
|
-
|
|
3
|
-
declare const LibV4: IModuleLibV4;
|
|
4
|
-
|
|
1
|
+
import type { IModuleLibV4 } from '@e-mc/types/lib/compat-v4';
|
|
2
|
+
|
|
3
|
+
declare const LibV4: IModuleLibV4;
|
|
4
|
+
|
|
5
5
|
export = LibV4;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/module",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
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.13",
|
|
24
24
|
"abort-controller": "^3.0.0",
|
|
25
25
|
"chalk": "4.1.2",
|
|
26
26
|
"event-target-shim": "^5.0.1",
|