@e-mc/module 0.10.1 → 0.10.3
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 +10 -10
- package/README.md +419 -413
- package/index.d.ts +4 -4
- package/index.js +94 -52
- package/lib-v4.d.ts +4 -4
- package/package.json +31 -31
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
|
@@ -141,7 +141,7 @@ const MEMORY_CACHE_DISK = {
|
|
|
141
141
|
const SUPPORTED_CANPARSE = (0, types_1.supported)(19, 9) || (0, types_1.supported)(18, 17, 0, true);
|
|
142
142
|
const REGEXP_TORRENT = /^(?:magnet:\?xt=|(?:https?|s?ftp):\/\/[^/][^\n]*?\.(?:torrent|metalink|meta4)(?:\?[^\n]*)?$)/i;
|
|
143
143
|
const REGEXP_PROTOCOL = /^([a-z][a-z\d+-.]*):\/\/[^@:[\]\\^<>|\s]/i;
|
|
144
|
-
const REGEXP_CLIESCAPE = /[^\w
|
|
144
|
+
const REGEXP_CLIESCAPE = /[^\w+-.,/:@]/g;
|
|
145
145
|
const REGEXP_CLIOPTION = /^(-[^\s=]+|--[^-\s=][^\s=]*)(=)?\s*(.*)$/;
|
|
146
146
|
const REGEXP_ANSIESCAPE = /[\u001B\u009B]/;
|
|
147
147
|
const LOG_CPUBARCOLOR = SETTINGS.process.cpu_bar_color;
|
|
@@ -214,12 +214,12 @@ function setPnpmVer() {
|
|
|
214
214
|
return PNPM_VER;
|
|
215
215
|
}
|
|
216
216
|
function addPnpmPackage(items, value) {
|
|
217
|
-
let index = value.indexOf('(');
|
|
217
|
+
let index = (value = value.replace(/^\//, '')).indexOf('(');
|
|
218
218
|
if (index !== -1) {
|
|
219
219
|
value = value.substring(0, index);
|
|
220
220
|
}
|
|
221
|
-
index = value.lastIndexOf(value.indexOf('@',
|
|
222
|
-
const name = value.substring(
|
|
221
|
+
index = value.lastIndexOf(value.indexOf('@', 1) !== -1 ? '@' : '/');
|
|
222
|
+
const name = value.substring(0, index);
|
|
223
223
|
const version = value.substring(index + 1);
|
|
224
224
|
if (!items.find(item => item[0] === name && item[1] === version)) {
|
|
225
225
|
items.push([name, version]);
|
|
@@ -298,9 +298,8 @@ function getLatestRelease(result, unstable = false) {
|
|
|
298
298
|
return result[0];
|
|
299
299
|
}
|
|
300
300
|
function applyStyle(options, style) {
|
|
301
|
-
var _h;
|
|
302
301
|
for (const attr in style) {
|
|
303
|
-
|
|
302
|
+
options[attr] ??= style[attr];
|
|
304
303
|
}
|
|
305
304
|
return options;
|
|
306
305
|
}
|
|
@@ -310,51 +309,51 @@ function checkColorOptions(type, settings, options) {
|
|
|
310
309
|
}
|
|
311
310
|
let result = false;
|
|
312
311
|
if (settings.valueColor) {
|
|
313
|
-
options.valueColor
|
|
312
|
+
options.valueColor ||= settings.valueColor;
|
|
314
313
|
result = true;
|
|
315
314
|
}
|
|
316
315
|
if (settings.valueBgColor) {
|
|
317
|
-
options.valueBgColor
|
|
316
|
+
options.valueBgColor ||= settings.valueBgColor;
|
|
318
317
|
result = true;
|
|
319
318
|
}
|
|
320
319
|
if (typeof settings.valueBold === 'boolean') {
|
|
321
|
-
options.valueBold
|
|
320
|
+
options.valueBold ??= settings.valueBold;
|
|
322
321
|
}
|
|
323
322
|
if (settings.hintColor) {
|
|
324
|
-
options.hintColor
|
|
323
|
+
options.hintColor ||= settings.hintColor;
|
|
325
324
|
result = true;
|
|
326
325
|
}
|
|
327
326
|
if (settings.hintBgColor) {
|
|
328
|
-
options.hintBgColor
|
|
327
|
+
options.hintBgColor ||= settings.hintBgColor;
|
|
329
328
|
result = true;
|
|
330
329
|
}
|
|
331
330
|
if (typeof settings.hintBold === 'boolean') {
|
|
332
|
-
options.hintBold
|
|
331
|
+
options.hintBold ??= settings.hintBold;
|
|
333
332
|
}
|
|
334
333
|
if (type & types_1.LOG_TYPE.FAIL) {
|
|
335
334
|
return result;
|
|
336
335
|
}
|
|
337
336
|
if (settings.titleColor) {
|
|
338
|
-
options.titleColor
|
|
337
|
+
options.titleColor ||= settings.titleColor;
|
|
339
338
|
result = true;
|
|
340
339
|
}
|
|
341
340
|
if (settings.titleBgColor) {
|
|
342
|
-
options.titleBgColor
|
|
341
|
+
options.titleBgColor ||= settings.titleBgColor;
|
|
343
342
|
result = true;
|
|
344
343
|
}
|
|
345
344
|
if (typeof settings.titleBold === 'boolean') {
|
|
346
|
-
options.titleBold
|
|
345
|
+
options.titleBold ??= settings.titleBold;
|
|
347
346
|
}
|
|
348
347
|
if (settings.messageColor) {
|
|
349
|
-
options.messageColor
|
|
348
|
+
options.messageColor ||= settings.messageColor;
|
|
350
349
|
result = true;
|
|
351
350
|
}
|
|
352
351
|
if (settings.messageBgColor) {
|
|
353
|
-
options.messageBgColor
|
|
352
|
+
options.messageBgColor ||= settings.messageBgColor;
|
|
354
353
|
result = true;
|
|
355
354
|
}
|
|
356
355
|
if (typeof settings.messageBold === 'boolean') {
|
|
357
|
-
options.messageBold
|
|
356
|
+
options.messageBold ??= settings.messageBold;
|
|
358
357
|
}
|
|
359
358
|
return result;
|
|
360
359
|
}
|
|
@@ -630,6 +629,20 @@ function getCacheTotal() {
|
|
|
630
629
|
function isMatch(key, value) {
|
|
631
630
|
return pm.isMatch(key, value, { nocase: PLATFORM_WIN32, matchBase: value.startsWith('*') });
|
|
632
631
|
}
|
|
632
|
+
function listDir(src, paths, depth, include, exclude, outFiles) {
|
|
633
|
+
const srcDir = path.join(src, ...paths);
|
|
634
|
+
fs.readdirSync(srcDir, { withFileTypes: true }).forEach(file => {
|
|
635
|
+
if (file.isFile()) {
|
|
636
|
+
const pathname = path.join(srcDir, file.name);
|
|
637
|
+
if (include(pathname) && !exclude?.(pathname)) {
|
|
638
|
+
outFiles.push(pathname);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
else if (depth > 0 && file.isDirectory()) {
|
|
642
|
+
listDir(src, paths.concat(file.name), depth - 1, include, exclude, outFiles);
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
}
|
|
633
646
|
function checkFunction(value) {
|
|
634
647
|
if (typeof value === 'function') {
|
|
635
648
|
Object.defineProperty(value, "__cjs__", { value: true, writable: false, enumerable: false });
|
|
@@ -638,12 +651,11 @@ function checkFunction(value) {
|
|
|
638
651
|
return null;
|
|
639
652
|
}
|
|
640
653
|
function encryptMessage(data, cipher, algorithm) {
|
|
641
|
-
var _h;
|
|
642
654
|
if (cipher?.key && cipher.iv) {
|
|
643
|
-
algorithm
|
|
655
|
+
algorithm ||= cipher.algorithm || 'aes-256-gcm';
|
|
644
656
|
const result = (0, types_1.encryptUTF8)(algorithm, cipher.key, cipher.iv, data);
|
|
645
657
|
if (result) {
|
|
646
|
-
VALUES[
|
|
658
|
+
VALUES["process.cipher.algorithm"] ||= algorithm;
|
|
647
659
|
return result;
|
|
648
660
|
}
|
|
649
661
|
}
|
|
@@ -768,7 +780,7 @@ function checkExDev(err, src, dest) {
|
|
|
768
780
|
return false;
|
|
769
781
|
}
|
|
770
782
|
function applySessionId(instance, options) {
|
|
771
|
-
options.sessionId
|
|
783
|
+
options.sessionId ??= instance.sessionId;
|
|
772
784
|
let value = options.broadcastId;
|
|
773
785
|
if (value === undefined) {
|
|
774
786
|
value = instance.broadcastId;
|
|
@@ -901,7 +913,7 @@ function truncateStart(value, length = LOG_MIN_WIDTH, style = false) {
|
|
|
901
913
|
function truncateEnd(value, length) {
|
|
902
914
|
return (REGEXP_ANSIESCAPE.test(value) ? stripansi(value) : value).length > length ? '...' + value.substring(value.length - length + 3) : value;
|
|
903
915
|
}
|
|
904
|
-
const escapeArg = (value) => value.replace(REGEXP_CLIESCAPE, capture => (capture === '$' || capture === '`' ? '\\' : '') + '\\' + capture);
|
|
916
|
+
const escapeArg = (value) => value.replace(REGEXP_CLIESCAPE, capture => capture === '\n' ? "'\n'" : (capture === '$' || capture === '`' ? '\\' : '') + '\\' + capture);
|
|
905
917
|
const isMeterUnit = (type, ident) => (type & 256) === 256 && !ident;
|
|
906
918
|
const formatLogMessage = (type, message, unit, ident) => isMeterUnit(type, ident) ? (unit + LOG_DIVIDER + message).trimEnd() : unit ? (message + (ident ? '' : ' ') + unit).trimStart() : message;
|
|
907
919
|
const hideAbort = (err) => err.name === 'AbortError' && SETTINGS.abort === false;
|
|
@@ -945,7 +957,7 @@ class Module extends EventEmitter {
|
|
|
945
957
|
this[_g] = null;
|
|
946
958
|
}
|
|
947
959
|
static get VERSION() {
|
|
948
|
-
return "0.10.
|
|
960
|
+
return "0.10.3";
|
|
949
961
|
}
|
|
950
962
|
static get LOG_TYPE() {
|
|
951
963
|
return types_1.LOG_TYPE;
|
|
@@ -1106,7 +1118,7 @@ class Module extends EventEmitter {
|
|
|
1106
1118
|
else if (type & 2) {
|
|
1107
1119
|
if (!checkColorOptions(type, SETTINGS.node, options)) {
|
|
1108
1120
|
applyStyle(options, this.LOG_STYLE_REVERSE);
|
|
1109
|
-
options.hintColor
|
|
1121
|
+
options.hintColor ||= 'yellow';
|
|
1110
1122
|
}
|
|
1111
1123
|
titleJustify = 'center';
|
|
1112
1124
|
}
|
|
@@ -1140,7 +1152,7 @@ class Module extends EventEmitter {
|
|
|
1140
1152
|
}
|
|
1141
1153
|
if (type & 128) {
|
|
1142
1154
|
if (!checkColorOptions(type, SETTINGS.time_elapsed, options)) {
|
|
1143
|
-
options.hintColor
|
|
1155
|
+
options.hintColor ||= 'yellow';
|
|
1144
1156
|
}
|
|
1145
1157
|
if (options.titleBgColor) {
|
|
1146
1158
|
titleJustify = 'center';
|
|
@@ -1148,7 +1160,7 @@ class Module extends EventEmitter {
|
|
|
1148
1160
|
}
|
|
1149
1161
|
else if (type & 256) {
|
|
1150
1162
|
if (options.failed) {
|
|
1151
|
-
options.messageBgColor
|
|
1163
|
+
options.messageBgColor ||= 'bgGrey';
|
|
1152
1164
|
}
|
|
1153
1165
|
else {
|
|
1154
1166
|
const { color, bgColor, bold } = format.meter;
|
|
@@ -1161,7 +1173,7 @@ class Module extends EventEmitter {
|
|
|
1161
1173
|
}
|
|
1162
1174
|
}
|
|
1163
1175
|
if (bold) {
|
|
1164
|
-
options.messageBold
|
|
1176
|
+
options.messageBold ??= true;
|
|
1165
1177
|
}
|
|
1166
1178
|
}
|
|
1167
1179
|
}
|
|
@@ -1180,7 +1192,7 @@ class Module extends EventEmitter {
|
|
|
1180
1192
|
}
|
|
1181
1193
|
if (!hintColor && !hintBgColor) {
|
|
1182
1194
|
({ color: hintColor, bgColor: hintBgColor } = formatHint);
|
|
1183
|
-
hintBold
|
|
1195
|
+
hintBold ??= formatHint.bold;
|
|
1184
1196
|
}
|
|
1185
1197
|
value = getValue();
|
|
1186
1198
|
hint = coloring ? (L && chalk.blackBright(L)) + formatLogColumn(truncateEnd(hint, hintWidth), hintColor, hintBgColor, hintBold) + chalk.blackBright(R) : L + truncateEnd(hint, hintWidth) + R;
|
|
@@ -1204,7 +1216,7 @@ class Module extends EventEmitter {
|
|
|
1204
1216
|
}
|
|
1205
1217
|
if (!valueColor && !valueBgColor) {
|
|
1206
1218
|
({ color: valueColor, bgColor: valueBgColor } = formatValue);
|
|
1207
|
-
valueBold
|
|
1219
|
+
valueBold ??= formatValue.bold;
|
|
1208
1220
|
}
|
|
1209
1221
|
try {
|
|
1210
1222
|
let v = value, i = id, m = message;
|
|
@@ -1217,7 +1229,7 @@ class Module extends EventEmitter {
|
|
|
1217
1229
|
const formatMessage = format.message;
|
|
1218
1230
|
if (!messageColor && !messageBgColor) {
|
|
1219
1231
|
({ color: messageColor, bgColor: messageBgColor, bold: messageBold } = formatMessage);
|
|
1220
|
-
messageBold
|
|
1232
|
+
messageBold ??= formatMessage.bold;
|
|
1221
1233
|
}
|
|
1222
1234
|
const [L, R] = formatMessage.braces;
|
|
1223
1235
|
let u = unit;
|
|
@@ -1371,7 +1383,7 @@ class Module extends EventEmitter {
|
|
|
1371
1383
|
}
|
|
1372
1384
|
}
|
|
1373
1385
|
try {
|
|
1374
|
-
result
|
|
1386
|
+
result ||= (0, types_1.asFunction)(fs.readFileSync(pathname, 'utf-8'), sync);
|
|
1375
1387
|
}
|
|
1376
1388
|
catch (err) {
|
|
1377
1389
|
this.writeFail(["Unable to read file", value], err, 32);
|
|
@@ -1906,6 +1918,33 @@ class Module extends EventEmitter {
|
|
|
1906
1918
|
});
|
|
1907
1919
|
});
|
|
1908
1920
|
}
|
|
1921
|
+
static async globDir(src, pattern, options) {
|
|
1922
|
+
const outDir = sanitizePath(asFile(src));
|
|
1923
|
+
if (!(outDir && this.isDir(outDir))) {
|
|
1924
|
+
return Promise.reject(errorDirectory(asFile(src) || "Unknown"));
|
|
1925
|
+
}
|
|
1926
|
+
const pmOpts = { posixSlashes: true, windows: true, nocase: PLATFORM_WIN32 };
|
|
1927
|
+
let exclude, recursive;
|
|
1928
|
+
if ((0, types_1.isObject)(options)) {
|
|
1929
|
+
if (options.matchBase) {
|
|
1930
|
+
pmOpts.matchBase = true;
|
|
1931
|
+
}
|
|
1932
|
+
if (options.contains) {
|
|
1933
|
+
pmOpts.contains = true;
|
|
1934
|
+
}
|
|
1935
|
+
if (options.dot) {
|
|
1936
|
+
pmOpts.dot = true;
|
|
1937
|
+
}
|
|
1938
|
+
({ exclude, recursive } = options);
|
|
1939
|
+
}
|
|
1940
|
+
else {
|
|
1941
|
+
recursive = options;
|
|
1942
|
+
}
|
|
1943
|
+
recursive ??= true;
|
|
1944
|
+
const result = [];
|
|
1945
|
+
listDir(outDir, [], !recursive ? 0 : typeof recursive === 'number' ? recursive : Infinity, pm(pattern, pmOpts), exclude ? pm(exclude, pmOpts) : undefined, result);
|
|
1946
|
+
return result;
|
|
1947
|
+
}
|
|
1909
1948
|
static renameFile(src, dest, throws = true) {
|
|
1910
1949
|
try {
|
|
1911
1950
|
fs.renameSync(src, dest);
|
|
@@ -2030,7 +2069,7 @@ class Module extends EventEmitter {
|
|
|
2030
2069
|
return (minStreamSize !== undefined ? Promise.resolve(null) : null);
|
|
2031
2070
|
}
|
|
2032
2071
|
static async resolveMime(data) {
|
|
2033
|
-
FILETYPE_ESM
|
|
2072
|
+
FILETYPE_ESM ||= await (0, types_1.importESM)('file-type');
|
|
2034
2073
|
return typeof data === 'string' ? FILETYPE_ESM.fileTypeFromFile(data) : data instanceof stream.Readable ? FILETYPE_ESM.fileTypeFromStream(data) : FILETYPE_ESM.fileTypeFromBuffer(data);
|
|
2035
2074
|
}
|
|
2036
2075
|
static lookupMime(value, extension) {
|
|
@@ -2225,11 +2264,19 @@ class Module extends EventEmitter {
|
|
|
2225
2264
|
return '0.0.0';
|
|
2226
2265
|
}
|
|
2227
2266
|
static checkSemVer(name, min = 0, max = Infinity, unstable, startDir) {
|
|
2267
|
+
let equals, includes;
|
|
2228
2268
|
if ((0, types_1.isObject)(min)) {
|
|
2229
|
-
({ min = 0, max = Infinity, unstable, startDir } = min);
|
|
2269
|
+
({ min = 0, max = Infinity, unstable, startDir, equals, includes } = min);
|
|
2230
2270
|
}
|
|
2231
2271
|
else if ((0, types_1.isObject)(unstable)) {
|
|
2232
|
-
({ unstable, startDir } = unstable);
|
|
2272
|
+
({ unstable, startDir, includes } = unstable);
|
|
2273
|
+
}
|
|
2274
|
+
let version = this.getPackageVersion(name, unstable, startDir);
|
|
2275
|
+
if (version === '0.0.0') {
|
|
2276
|
+
return false;
|
|
2277
|
+
}
|
|
2278
|
+
if (equals) {
|
|
2279
|
+
return equals === version;
|
|
2233
2280
|
}
|
|
2234
2281
|
if (typeof min === 'number' && Math.floor(min) !== min) {
|
|
2235
2282
|
min = min.toString();
|
|
@@ -2238,7 +2285,7 @@ class Module extends EventEmitter {
|
|
|
2238
2285
|
max = max.toString();
|
|
2239
2286
|
}
|
|
2240
2287
|
const minVersion = typeof min === 'string' ? min.split('.').map(ver => parseInt(ver)) : [min];
|
|
2241
|
-
let maxVersion, maxRange;
|
|
2288
|
+
let maxVersion, maxRange = false;
|
|
2242
2289
|
if (typeof max === 'string') {
|
|
2243
2290
|
maxVersion = max.split('.').map(ver => parseInt(ver));
|
|
2244
2291
|
}
|
|
@@ -2246,13 +2293,9 @@ class Module extends EventEmitter {
|
|
|
2246
2293
|
maxVersion = [Infinity];
|
|
2247
2294
|
}
|
|
2248
2295
|
else {
|
|
2249
|
-
maxVersion = [max - 1];
|
|
2296
|
+
maxVersion = [max - (includes ? 0 : 1)];
|
|
2250
2297
|
maxRange = true;
|
|
2251
2298
|
}
|
|
2252
|
-
let version = this.getPackageVersion(name, unstable, startDir);
|
|
2253
|
-
if (version === '0.0.0') {
|
|
2254
|
-
return false;
|
|
2255
|
-
}
|
|
2256
2299
|
version = version.split('.').map(ver => parseInt(ver));
|
|
2257
2300
|
for (let i = 0, length = Math.max(version.length, minVersion.length), lower = false, upper = false; i < length; ++i) {
|
|
2258
2301
|
const ver = version[i] || 0;
|
|
@@ -2393,7 +2436,6 @@ class Module extends EventEmitter {
|
|
|
2393
2436
|
}
|
|
2394
2437
|
}
|
|
2395
2438
|
static loadSettings(settings, password) {
|
|
2396
|
-
var _h;
|
|
2397
2439
|
const current = VALUES["process.password"];
|
|
2398
2440
|
if (current) {
|
|
2399
2441
|
const proc = settings.process || {};
|
|
@@ -2455,7 +2497,7 @@ class Module extends EventEmitter {
|
|
|
2455
2497
|
VALUES["process.env.apply"] = env.apply;
|
|
2456
2498
|
}
|
|
2457
2499
|
if ((0, types_1.isString)(pwd)) {
|
|
2458
|
-
VALUES[
|
|
2500
|
+
VALUES["process.password"] ||= encryptMessage(pwd, cipher, null);
|
|
2459
2501
|
}
|
|
2460
2502
|
}
|
|
2461
2503
|
if (memory?.settings) {
|
|
@@ -2706,7 +2748,7 @@ class Module extends EventEmitter {
|
|
|
2706
2748
|
}
|
|
2707
2749
|
let dir = settings.temp_dir, env, write, modified;
|
|
2708
2750
|
if ((0, types_1.isPlainObject)(temp)) {
|
|
2709
|
-
dir
|
|
2751
|
+
dir ||= temp.dir;
|
|
2710
2752
|
if (temp.env) {
|
|
2711
2753
|
env = process.env[temp.env];
|
|
2712
2754
|
}
|
|
@@ -2747,7 +2789,7 @@ class Module extends EventEmitter {
|
|
|
2747
2789
|
} while ((dir !== "tmp") && (dir = "tmp"));
|
|
2748
2790
|
}
|
|
2749
2791
|
if (typeof write === 'boolean') {
|
|
2750
|
-
modified
|
|
2792
|
+
modified ||= VALUES["temp.write"] !== write;
|
|
2751
2793
|
VALUES["temp.write"] = write;
|
|
2752
2794
|
}
|
|
2753
2795
|
if (modified) {
|
|
@@ -2793,11 +2835,11 @@ class Module extends EventEmitter {
|
|
|
2793
2835
|
let result;
|
|
2794
2836
|
if ((0, types_1.isString)(pathname)) {
|
|
2795
2837
|
leading.push(pathname);
|
|
2796
|
-
createDir
|
|
2838
|
+
createDir ??= true;
|
|
2797
2839
|
}
|
|
2798
2840
|
if (uuidDir) {
|
|
2799
2841
|
leading.push(crypto.randomUUID());
|
|
2800
|
-
createDir
|
|
2842
|
+
createDir ??= true;
|
|
2801
2843
|
}
|
|
2802
2844
|
if ((createDir || increment > 0) && !Module.isDir(result = path.join(...leading))) {
|
|
2803
2845
|
const [output] = tryIncrementDir(result, increment);
|
|
@@ -2871,7 +2913,7 @@ class Module extends EventEmitter {
|
|
|
2871
2913
|
[options, promises, callback] = parseFileArgs(options, callback);
|
|
2872
2914
|
if (outSrc = hasFileSystem(this, 0, src, options)) {
|
|
2873
2915
|
let { encoding, requireExt, minStreamSize, cache } = options;
|
|
2874
|
-
encoding
|
|
2916
|
+
encoding &&= (0, types_1.getEncoding)(encoding);
|
|
2875
2917
|
const setCache = (data, cjs) => {
|
|
2876
2918
|
if (data) {
|
|
2877
2919
|
if (cache || cache !== false && autoMemoryCache()) {
|
|
@@ -2896,7 +2938,7 @@ class Module extends EventEmitter {
|
|
|
2896
2938
|
}
|
|
2897
2939
|
}
|
|
2898
2940
|
if (cache) {
|
|
2899
|
-
result
|
|
2941
|
+
result ||= (encoding ? getCacheItem(CACHE_READTEXT, outSrc) : getCacheItem(CACHE_READBUFFER, outSrc));
|
|
2900
2942
|
}
|
|
2901
2943
|
try {
|
|
2902
2944
|
if (!isNaN(minStreamSize = (0, types_1.alignSize)(minStreamSize)) || promises && fs.statSync(outSrc).size >= 2097152000) {
|
|
@@ -3301,7 +3343,7 @@ class Module extends EventEmitter {
|
|
|
3301
3343
|
return false;
|
|
3302
3344
|
}
|
|
3303
3345
|
async allSettled(tasks, rejected, options) {
|
|
3304
|
-
rejected
|
|
3346
|
+
rejected ||= "Unknown";
|
|
3305
3347
|
return Promise.allSettled(tasks).then(result => {
|
|
3306
3348
|
const items = [];
|
|
3307
3349
|
for (const item of result) {
|
|
@@ -3396,7 +3438,7 @@ class Module extends EventEmitter {
|
|
|
3396
3438
|
message = value;
|
|
3397
3439
|
value = '';
|
|
3398
3440
|
}
|
|
3399
|
-
value
|
|
3441
|
+
value ||= isFailed(options) ? "Failed" : "Success";
|
|
3400
3442
|
const duration = getTimeOffset(startTime, 0);
|
|
3401
3443
|
const args = [
|
|
3402
3444
|
(128 | type),
|
|
@@ -3457,7 +3499,7 @@ class Module extends EventEmitter {
|
|
|
3457
3499
|
if ((0, types_1.isPlainObject)(output)) {
|
|
3458
3500
|
output = { ...output };
|
|
3459
3501
|
if (Array.isArray(output.warn)) {
|
|
3460
|
-
(exec.warn
|
|
3502
|
+
(exec.warn ||= []).push(...output.warn);
|
|
3461
3503
|
}
|
|
3462
3504
|
delete output.command;
|
|
3463
3505
|
delete output.warn;
|
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.10.
|
|
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": "git+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": "BSD
|
|
21
|
-
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@e-mc/types": "0.10.
|
|
24
|
-
"chalk": "4.1.2",
|
|
25
|
-
"file-type": "^18.7.0",
|
|
26
|
-
"js-yaml": "^4.1.0",
|
|
27
|
-
"mime-types": "^2.1.35",
|
|
28
|
-
"picomatch": "^4.0.2",
|
|
29
|
-
"strip-ansi": "6.0.1"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@e-mc/module",
|
|
3
|
+
"version": "0.10.3",
|
|
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": "git+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": "BSD-3-Clause",
|
|
21
|
+
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@e-mc/types": "0.10.3",
|
|
24
|
+
"chalk": "4.1.2",
|
|
25
|
+
"file-type": "^18.7.0",
|
|
26
|
+
"js-yaml": "^4.1.0",
|
|
27
|
+
"mime-types": "^2.1.35",
|
|
28
|
+
"picomatch": "^4.0.2",
|
|
29
|
+
"strip-ansi": "6.0.1"
|
|
30
|
+
}
|
|
31
|
+
}
|