@e-mc/module 0.6.10 → 0.6.12
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 +6 -6
- package/README.md +6 -6
- package/index.d.ts +4 -4
- package/index.js +20 -7
- package/lib-v4.d.ts +4 -4
- package/package.json +31 -31
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Copyright 2024 An Pham
|
|
2
|
-
|
|
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
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
1
|
+
Copyright 2024 An Pham
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
7
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# @e-mc/module
|
|
2
|
-
|
|
3
|
-
PEP 402 - Forever Any Mayo
|
|
4
|
-
|
|
5
|
-
## LICENSE
|
|
6
|
-
|
|
1
|
+
# @e-mc/module
|
|
2
|
+
|
|
3
|
+
PEP 402 - Forever Any Mayo
|
|
4
|
+
|
|
5
|
+
## LICENSE
|
|
6
|
+
|
|
7
7
|
MIT
|
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.12"; }
|
|
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,31 +1,31 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@e-mc/module",
|
|
3
|
-
"version": "0.6.
|
|
4
|
-
"description": "Module base class for E-mc.",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"types": "index.d.ts",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "https://github.com/anpham6/e-mc.git",
|
|
13
|
-
"directory": "src/module"
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"squared",
|
|
17
|
-
"squared-functions"
|
|
18
|
-
],
|
|
19
|
-
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@e-mc/types": "0.6.
|
|
24
|
-
"abort-controller": "^3.0.0",
|
|
25
|
-
"chalk": "4.1.2",
|
|
26
|
-
"event-target-shim": "^5.0.1",
|
|
27
|
-
"file-type": "16.5.4",
|
|
28
|
-
"mime-types": "^2.1.35",
|
|
29
|
-
"strip-ansi": "6.0.1"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@e-mc/module",
|
|
3
|
+
"version": "0.6.12",
|
|
4
|
+
"description": "Module base class for E-mc.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/anpham6/e-mc.git",
|
|
13
|
+
"directory": "src/module"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"squared",
|
|
17
|
+
"squared-functions"
|
|
18
|
+
],
|
|
19
|
+
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@e-mc/types": "0.6.12",
|
|
24
|
+
"abort-controller": "^3.0.0",
|
|
25
|
+
"chalk": "4.1.2",
|
|
26
|
+
"event-target-shim": "^5.0.1",
|
|
27
|
+
"file-type": "16.5.4",
|
|
28
|
+
"mime-types": "^2.1.35",
|
|
29
|
+
"strip-ansi": "6.0.1"
|
|
30
|
+
}
|
|
31
|
+
}
|