@e-mc/module 0.8.5 → 0.8.6

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.
Files changed (5) hide show
  1. package/LICENSE +8 -4
  2. package/README.md +237 -2
  3. package/index.js +250 -240
  4. package/lib-v4.js +4 -4
  5. package/package.json +3 -3
package/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint no-global-assign: "off" */
3
2
  var _a, _b, _c, _d, _e, _f, _g;
4
3
  Object.defineProperty(exports, "__esModule", { value: true });
5
4
  const path = require("path");
@@ -13,7 +12,7 @@ const pm = require("picomatch");
13
12
  const chalk = require("chalk");
14
13
  const stripansi = require("strip-ansi");
15
14
  const EventEmitter = require("events");
16
- const types_1 = require("../types");
15
+ const types_1 = require("@e-mc/types");
17
16
  const kSessionId = Symbol('sessionId');
18
17
  const kBroadcastId = Symbol('broadcastId');
19
18
  const kTempDir = Symbol('tempDir');
@@ -101,25 +100,25 @@ const SETTINGS = {
101
100
  stdout: true
102
101
  };
103
102
  const VALUES = {
104
- ["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */]: 'cjs',
105
- ["node.require.npm" /* KEY_NAME.NODE_REQUIRE_NPM */]: true,
106
- ["node.require.inline" /* KEY_NAME.NODE_REQUIRE_INLINE */]: true,
107
- ["node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */]: true,
108
- ["node.process.memory_usage" /* KEY_NAME.NODE_PROCESS_MEMORYUSAGE */]: true,
109
- ["node.process.inline" /* KEY_NAME.NODE_PROCESS_INLINE */]: true,
110
- ["temp.dir" /* KEY_NAME.TEMP_DIR */]: "tmp" /* INTERNAL.TEMP_DIR */,
111
- ["temp.write" /* KEY_NAME.TEMP_WRITE */]: false,
112
- ["process.password" /* KEY_NAME.PROCESS_PASSWORD */]: '',
113
- ["process.cipher.algorithm" /* KEY_NAME.PROCESS_CIPHER_ALGORITHM */]: '',
114
- ["process.env.apply" /* KEY_NAME.PROCESS_ENV_APPLY */]: false,
115
- ["permission.process_exec" /* KEY_NAME.PERMISSION_PROCESS_EXEC */]: [],
116
- ["permission.home_read" /* KEY_NAME.PERMISSION_HOMEREAD */]: false,
117
- ["permission.home_write" /* KEY_NAME.PERMISSION_HOMEWRITE */]: false,
118
- ["memory.settings.users" /* KEY_NAME.MEMORY_SETTINGS_USERS */]: false,
119
- ["error.out" /* KEY_NAME.ERROR_OUT */]: null,
120
- ["error.fatal" /* KEY_NAME.ERROR_FATAL */]: false,
121
- ["broadcast.out" /* KEY_NAME.BROADCAST_OUT */]: null,
122
- ["logger.level" /* KEY_NAME.LOGGER_LEVEL */]: -1
103
+ ["node.require.ext"]: 'cjs',
104
+ ["node.require.npm"]: true,
105
+ ["node.require.inline"]: true,
106
+ ["node.process.cpu_usage"]: true,
107
+ ["node.process.memory_usage"]: true,
108
+ ["node.process.inline"]: true,
109
+ ["temp.dir"]: "tmp",
110
+ ["temp.write"]: false,
111
+ ["process.password"]: '',
112
+ ["process.cipher.algorithm"]: '',
113
+ ["process.env.apply"]: false,
114
+ ["permission.process_exec"]: [],
115
+ ["permission.home_read"]: false,
116
+ ["permission.home_write"]: false,
117
+ ["memory.settings.users"]: false,
118
+ ["error.out"]: null,
119
+ ["error.fatal"]: false,
120
+ ["broadcast.out"]: null,
121
+ ["logger.level"]: -1
123
122
  };
124
123
  const MEMORY_CACHE_DISK = {
125
124
  enabled: false,
@@ -132,7 +131,7 @@ const MEMORY_CACHE_DISK = {
132
131
  const REGEXP_TORRENT = /^(?:magnet:\?xt=|(?:https?|s?ftp):\/\/[^/][^\n]*?\.(?:torrent|metalink|meta4)(?:\?[^\n]*)?$)/i;
133
132
  let LOG_NEWLINE = true;
134
133
  let LOG_EMPTYLINE = false;
135
- let TEMP_DIR = path.join(PROCESS_CWD, "tmp" /* INTERNAL.TEMP_DIR */);
134
+ let TEMP_DIR = path.join(PROCESS_CWD, "tmp");
136
135
  const PNPM_VER = (function () {
137
136
  try {
138
137
  const pathname = path.resolve('./node_modules/.modules.yaml');
@@ -257,13 +256,15 @@ function tryRemoveDir(value, empty, recursive) {
257
256
  const temp = typeof empty === 'number';
258
257
  let options;
259
258
  if (!temp) {
260
- if (Module.supported(14, 14)) {
259
+ try {
261
260
  fs.rmSync(value, { recursive, force: true });
262
261
  if (empty) {
263
262
  fs.mkdirSync(value);
264
263
  }
265
264
  return [];
266
265
  }
266
+ catch {
267
+ }
267
268
  options = { recursive };
268
269
  }
269
270
  value = Module.normalizePath(value, 1);
@@ -340,9 +341,9 @@ function errorObject(message) {
340
341
  case 'string':
341
342
  return new Error(message);
342
343
  case 'number':
343
- return (0, types_1.errorMessage)("Error code" /* ERR_MESSAGE.ERROR_CODE */, message.toString());
344
+ return (0, types_1.errorMessage)("Error code", message.toString());
344
345
  default:
345
- return new Error(Module.asString(message) || "Unknown" /* ERR_MESSAGE.UNKNOWN */);
346
+ return new Error(Module.asString(message) || "Unknown");
346
347
  }
347
348
  }
348
349
  function isFailed(options) {
@@ -363,7 +364,7 @@ function recurseCause(err, out, visited) {
363
364
  visited = new WeakSet();
364
365
  }
365
366
  visited.add(err);
366
- if (err.hasOwnProperty('cause')) { // eslint-disable-line no-prototype-builtins
367
+ if (err.hasOwnProperty('cause')) {
367
368
  const cause = err.cause;
368
369
  if (cause instanceof Error) {
369
370
  if (message) {
@@ -375,7 +376,7 @@ function recurseCause(err, out, visited) {
375
376
  return;
376
377
  }
377
378
  if ((0, types_1.isString)(cause)) {
378
- message = message ? message + ` (${cause})` : cause; // eslint-disable-line @typescript-eslint/restrict-template-expressions
379
+ message = message ? message + ` (${cause})` : cause;
379
380
  }
380
381
  }
381
382
  if (message) {
@@ -385,7 +386,7 @@ function recurseCause(err, out, visited) {
385
386
  function getErrorMessage(err) {
386
387
  const cause = [];
387
388
  recurseCause(err, cause);
388
- return (SETTINGS.stack_trace && err.stack || err.message || err.toString() || "Unknown" /* ERR_MESSAGE.UNKNOWN */) + (cause.length ? cause.map((value, index) => `\n\nCause #${cause.length - index}: ` + value).join('') : '');
389
+ return (SETTINGS.stack_trace && err.stack || err.message || err.toString() || "Unknown") + (cause.length ? cause.map((value, index) => `\n\nCause #${cause.length - index}: ` + value).join('') : '');
389
390
  }
390
391
  function writeLine(value) {
391
392
  PROCESS_STDOUT.write((!LOG_NEWLINE ? '\n' : '') + value + '\n');
@@ -475,7 +476,7 @@ function addCacheItem(map, key, data, cache) {
475
476
  }
476
477
  function checkFunction(value) {
477
478
  if (typeof value === 'function') {
478
- Object.defineProperty(value, "__cjs__" /* INTERNAL.CJS */, { value: true });
479
+ Object.defineProperty(value, "__cjs__", { value: true });
479
480
  return value;
480
481
  }
481
482
  return null;
@@ -486,15 +487,18 @@ function encryptMessage(data, cipher, algorithm) {
486
487
  algorithm || (algorithm = cipher.algorithm || 'aes-256-gcm');
487
488
  const result = (0, types_1.encryptUTF8)(algorithm, cipher.key, cipher.iv, data);
488
489
  if (result) {
489
- VALUES[_h = "process.cipher.algorithm" /* KEY_NAME.PROCESS_CIPHER_ALGORITHM */] || (VALUES[_h] = algorithm);
490
+ VALUES[_h = "process.cipher.algorithm"] || (VALUES[_h] = algorithm);
490
491
  return result;
491
492
  }
492
493
  }
493
494
  return data;
494
495
  }
495
496
  function setCpuAndMem(options) {
496
- let host, usage;
497
- if (!options.messageUnit && (usage = ('startCPU' in this) && this.startCPU || CACHE_CPUHOST.get(this) || (host = this.host) && CACHE_CPUHOST.get(host))) {
497
+ if (options.messageUnit) {
498
+ return;
499
+ }
500
+ const usage = ('startCPU' in this) && this.startCPU || CACHE_CPUHOST.get(this) || this.host && CACHE_CPUHOST.get(this.host);
501
+ if (usage) {
498
502
  options.messageUnit = Module.formatCpuMem(usage);
499
503
  }
500
504
  }
@@ -511,7 +515,7 @@ function hasFileSystem(type, value, options, ignoreExists, overwrite) {
511
515
  }
512
516
  else if (!(result = Module.fromLocalPath(value))) {
513
517
  if (options.throwsDoesNotExist) {
514
- throw (0, types_1.errorValue)("File not found" /* ERR_MESSAGE.NOTFOUND_FILE */, value);
518
+ throw (0, types_1.errorValue)("File not found", value);
515
519
  }
516
520
  return '';
517
521
  }
@@ -523,14 +527,14 @@ function hasFileSystem(type, value, options, ignoreExists, overwrite) {
523
527
  }
524
528
  if (!ignoreExists && !Module.isPath(result)) {
525
529
  if (options.throwsDoesNotExist) {
526
- throw (0, types_1.errorValue)("File not found" /* ERR_MESSAGE.NOTFOUND_FILE */, value);
530
+ throw (0, types_1.errorValue)("File not found", value);
527
531
  }
528
532
  return '';
529
533
  }
530
534
  if (options.ignorePermission) {
531
535
  return result;
532
536
  }
533
- const method = type === 1 /* FILE_SYSTEM.WRITE */ ? 'canWrite' : 'canRead';
537
+ const method = type === 1 ? 'canWrite' : 'canRead';
534
538
  if (options.ownPermissionOnly) {
535
539
  if (this.hasOwnPermission() && !this[method](result)) {
536
540
  if (options.throwsPermission) {
@@ -597,10 +601,10 @@ const ensureDir = (value) => value.endsWith(path.sep) ? value : value + path.sep
597
601
  const trimDir = (value) => value.endsWith(path.sep) ? value.substring(0, value.length - 1) : value;
598
602
  const getExtension = (value) => path.extname(value).toLowerCase().substring(1);
599
603
  const hasString = (item, value) => (0, types_1.isString)(value) && (item === value || Array.isArray(item) && item.includes(value));
600
- const getCpuTimes = () => os.cpus().reduce((a, b) => a + b.times.user + b.times.sys, 0) * 1000 /* TIME.S */;
604
+ const getCpuTimes = () => os.cpus().reduce((a, b) => a + b.times.user + b.times.sys, 0) * 1000;
601
605
  const autoMemoryCache = () => MEMORY_CACHE_DISK.enabled && MEMORY_CACHE_DISK.max_size > 0;
602
- const errorDirectory = (value) => (0, types_1.errorValue)("Path is not a directory" /* ERR_MESSAGE.NOT_DIRECTORY */, value);
603
- const errorPermission = (value) => (0, types_1.errorValue)("Unsupported access" /* ERR_MESSAGE.UNSUPPORTED_ACCESS */, value);
606
+ const errorDirectory = (value) => (0, types_1.errorValue)("Path is not a directory", value);
607
+ const errorPermission = (value) => (0, types_1.errorValue)("Unsupported access", value);
604
608
  class Module extends EventEmitter {
605
609
  constructor() {
606
610
  super(...arguments);
@@ -612,18 +616,18 @@ class Module extends EventEmitter {
612
616
  this._threadable = false;
613
617
  this._logEnabled = true;
614
618
  this._logFlushed = false;
615
- this._logLevel = VALUES["logger.level" /* KEY_NAME.LOGGER_LEVEL */];
619
+ this._logLevel = VALUES["logger.level"];
616
620
  this._hostEvents = ['abort'];
617
621
  this._logQueued = [];
618
622
  this[_a] = '';
619
- this[_b] = VALUES["temp.dir" /* KEY_NAME.TEMP_DIR */];
623
+ this[_b] = VALUES["temp.dir"];
620
624
  this[_c] = '';
621
625
  this[_d] = null;
622
626
  this[_e] = { stripAnsi: { value: true, modified: false } };
623
627
  this[_f] = new AbortController();
624
628
  this[_g] = null;
625
629
  }
626
- static get VERSION() { return "0.8.5" /* INTERNAL.VERSION */; }
630
+ static get VERSION() { return "0.8.6"; }
627
631
  static get LOG_TYPE() { return types_1.LOG_TYPE; }
628
632
  static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
629
633
  static get MAX_TIMEOUT() { return 2147483647; }
@@ -645,35 +649,35 @@ class Module extends EventEmitter {
645
649
  }
646
650
  static enabled(key, username) {
647
651
  switch (key) {
648
- case "memory.settings.users" /* KEY_NAME.MEMORY_SETTINGS_USERS */: {
652
+ case "memory.settings.users": {
649
653
  const users = VALUES[key];
650
654
  return users === false || !!username && (users === true || users.includes(username));
651
655
  }
652
- case "temp.dir" /* KEY_NAME.TEMP_DIR */:
653
- return VALUES[key] !== "tmp" /* INTERNAL.TEMP_DIR */;
654
- case "memory.settings.cache_disk" /* KEY_NAME.MEMORY_SETTINGS_CACHE_DISK */:
656
+ case "temp.dir":
657
+ return VALUES[key] !== "tmp";
658
+ case "memory.settings.cache_disk":
655
659
  return MEMORY_CACHE_DISK.enabled;
656
- case "node.require.npm" /* KEY_NAME.NODE_REQUIRE_NPM */:
657
- case "node.require.inline" /* KEY_NAME.NODE_REQUIRE_INLINE */:
658
- case "node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */:
659
- case "node.process.memory_usage" /* KEY_NAME.NODE_PROCESS_MEMORYUSAGE */:
660
- case "node.process.inline" /* KEY_NAME.NODE_PROCESS_INLINE */:
661
- case "temp.write" /* KEY_NAME.TEMP_WRITE */:
662
- case "permission.home_read" /* KEY_NAME.PERMISSION_HOMEREAD */:
663
- case "permission.home_write" /* KEY_NAME.PERMISSION_HOMEWRITE */:
664
- case "process.env.apply" /* KEY_NAME.PROCESS_ENV_APPLY */:
665
- case "error.fatal" /* KEY_NAME.ERROR_FATAL */:
660
+ case "node.require.npm":
661
+ case "node.require.inline":
662
+ case "node.process.cpu_usage":
663
+ case "node.process.memory_usage":
664
+ case "node.process.inline":
665
+ case "temp.write":
666
+ case "permission.home_read":
667
+ case "permission.home_write":
668
+ case "process.env.apply":
669
+ case "error.fatal":
666
670
  return VALUES[key];
667
- case "node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */:
668
- case "process.password" /* KEY_NAME.PROCESS_PASSWORD */:
669
- case "process.cipher.algorithm" /* KEY_NAME.PROCESS_CIPHER_ALGORITHM */:
671
+ case "node.require.ext":
672
+ case "process.password":
673
+ case "process.cipher.algorithm":
670
674
  return VALUES[key] !== '';
671
- case "permission.process_exec" /* KEY_NAME.PERMISSION_PROCESS_EXEC */:
675
+ case "permission.process_exec":
672
676
  return VALUES[key].length > 0;
673
- case "error.out" /* KEY_NAME.ERROR_OUT */:
674
- case "broadcast.out" /* KEY_NAME.BROADCAST_OUT */:
677
+ case "error.out":
678
+ case "broadcast.out":
675
679
  return VALUES[key] !== null;
676
- case "logger.level" /* KEY_NAME.LOGGER_LEVEL */:
680
+ case "logger.level":
677
681
  return VALUES[key] >= 0;
678
682
  default:
679
683
  return false;
@@ -685,20 +689,20 @@ class Module extends EventEmitter {
685
689
  return false;
686
690
  }
687
691
  }
688
- else if ((value & 1 /* LOG_VALUE.SYSTEM */) && SETTINGS.system === false ||
689
- (value & 2 /* LOG_VALUE.NODE */) && SETTINGS.node === false ||
690
- (value & 4 /* LOG_VALUE.PROCESS */) && SETTINGS.process === false ||
691
- (value & 8 /* LOG_VALUE.COMPRESS */) && SETTINGS.compress === false ||
692
- (value & 16 /* LOG_VALUE.WATCH */) && SETTINGS.watch === false ||
693
- (value & 32 /* LOG_VALUE.FILE */) && SETTINGS.file === false ||
694
- (value & 64 /* LOG_VALUE.CLOUD */) && SETTINGS.cloud === false ||
695
- (value & 128 /* LOG_VALUE.TIME_ELAPSED */) && SETTINGS.time_elapsed === false ||
696
- (value & 256 /* LOG_VALUE.TIME_PROCESS */) && SETTINGS.time_process === false ||
697
- (value & 1024 /* LOG_VALUE.HTTP */) && SETTINGS.http === false ||
698
- (value & 2048 /* LOG_VALUE.IMAGE */) && SETTINGS.image === false ||
699
- (value & 4096 /* LOG_VALUE.EXEC */) && SETTINGS.exec === false ||
700
- (value & 32768 /* LOG_VALUE.STDOUT */) && SETTINGS.stdout === false ||
701
- (value & 65536 /* LOG_VALUE.DB */) && SETTINGS.db === false) {
692
+ else if ((value & 1) && SETTINGS.system === false ||
693
+ (value & 2) && SETTINGS.node === false ||
694
+ (value & 4) && SETTINGS.process === false ||
695
+ (value & 8) && SETTINGS.compress === false ||
696
+ (value & 16) && SETTINGS.watch === false ||
697
+ (value & 32) && SETTINGS.file === false ||
698
+ (value & 64) && SETTINGS.cloud === false ||
699
+ (value & 128) && SETTINGS.time_elapsed === false ||
700
+ (value & 256) && SETTINGS.time_process === false ||
701
+ (value & 1024) && SETTINGS.http === false ||
702
+ (value & 2048) && SETTINGS.image === false ||
703
+ (value & 4096) && SETTINGS.exec === false ||
704
+ (value & 32768) && SETTINGS.stdout === false ||
705
+ (value & 65536) && SETTINGS.db === false) {
702
706
  return false;
703
707
  }
704
708
  return true;
@@ -711,19 +715,18 @@ class Module extends EventEmitter {
711
715
  if (options.type) {
712
716
  type |= options.type;
713
717
  }
714
- const BROADCAST_OUT = VALUES["broadcast.out" /* KEY_NAME.BROADCAST_OUT */];
718
+ const BROADCAST_OUT = VALUES["broadcast.out"];
715
719
  const sessionId = options.sessionId;
716
720
  let broadcastId = options.broadcastId;
717
- if ((type & 512 /* LOG_VALUE.FAIL */) === 512 /* LOG_VALUE.FAIL */ && VALUES["error.out" /* KEY_NAME.ERROR_OUT */]) {
721
+ if ((type & 512) === 512 && VALUES["error.out"]) {
718
722
  try {
719
- const ERROR_OUT = VALUES["error.out" /* KEY_NAME.ERROR_OUT */];
720
- const errorOptions = { type: type & ~512 /* LOG_VALUE.FAIL */, value, timeStamp: getTimeStamp(options, true), sessionId };
721
- // @ts-ignore
722
- if (ERROR_OUT["__cjs__" /* INTERNAL.CJS */]) {
723
+ const ERROR_OUT = VALUES["error.out"];
724
+ const errorOptions = { type: type & ~512, value, timeStamp: getTimeStamp(options, true), sessionId };
725
+ if (ERROR_OUT["__cjs__"]) {
723
726
  ERROR_OUT(errorObject(message), errorOptions);
724
727
  }
725
728
  else {
726
- ERROR_OUT.apply(VALUES["node.process.inline" /* KEY_NAME.NODE_PROCESS_INLINE */] ? process : null, VALUES["node.require.inline" /* KEY_NAME.NODE_REQUIRE_INLINE */] ? [errorObject(message), errorOptions, require] : [errorObject(message), errorOptions]);
729
+ ERROR_OUT.apply(VALUES["node.process.inline"] ? process : null, VALUES["node.require.inline"] ? [errorObject(message), errorOptions, require] : [errorObject(message), errorOptions]);
727
730
  }
728
731
  }
729
732
  catch {
@@ -746,7 +749,7 @@ class Module extends EventEmitter {
746
749
  const formatValue = format.value;
747
750
  const id = sessionId && SETTINGS.session_id ? ' ' + sessionId.padStart(SETTINGS.session_id, '0') + ' ' : '';
748
751
  const titleIndent = options.titleIndent ? typeof options.titleIndent === 'number' ? Math.max(options.titleIndent, 0) : 0 : -1;
749
- let output, hint, valueWidth = Math.max(formatValue.width - (id ? SETTINGS.session_id + 1 : 0), 1), titleJustify = options.titleJustify || ((type & 512 /* LOG_VALUE.FAIL */) || options.failed ? 'center' : formatTitle.justify);
752
+ let output, hint, valueWidth = Math.max(formatValue.width - (id ? SETTINGS.session_id + 1 : 0), 1), titleJustify = options.titleJustify || ((type & 512) || options.failed ? 'center' : formatTitle.justify);
750
753
  if (Array.isArray(value)) {
751
754
  hint = value[1] ?? '';
752
755
  value = value[0];
@@ -829,52 +832,52 @@ class Module extends EventEmitter {
829
832
  }
830
833
  return indent + (bold ? chalk.bold(content) : content);
831
834
  };
832
- if (type === 0 /* LOG_VALUE.UNKNOWN */) {
835
+ if (type === 0) {
833
836
  checkColorOptions(type, SETTINGS.unknown, options);
834
837
  }
835
838
  else {
836
- if (type & 4096 /* LOG_VALUE.EXEC */) {
839
+ if (type & 4096) {
837
840
  checkColorOptions(type, SETTINGS.exec, options);
838
841
  }
839
- else if (type & 32 /* LOG_VALUE.FILE */) {
842
+ else if (type & 32) {
840
843
  checkColorOptions(type, SETTINGS.file, options);
841
844
  }
842
- else if (type & 2 /* LOG_VALUE.NODE */) {
845
+ else if (type & 2) {
843
846
  if (!checkColorOptions(type, SETTINGS.node, options)) {
844
847
  applyStyle(options, this.LOG_STYLE_REVERSE);
845
848
  options.hintColor || (options.hintColor = 'yellow');
846
849
  }
847
850
  titleJustify = 'center';
848
851
  }
849
- else if (type & 1 /* LOG_VALUE.SYSTEM */) {
852
+ else if (type & 1) {
850
853
  checkColorOptions(type, SETTINGS.system, options);
851
854
  if (options.titleBgColor) {
852
855
  titleJustify = 'center';
853
856
  }
854
857
  }
855
- if (type & 1024 /* LOG_VALUE.HTTP */) {
858
+ if (type & 1024) {
856
859
  checkColorOptions(type, SETTINGS.http, options);
857
860
  }
858
- else if (type & 64 /* LOG_VALUE.CLOUD */) {
861
+ else if (type & 64) {
859
862
  checkColorOptions(type, SETTINGS.cloud, options);
860
863
  }
861
- else if (type & 65536 /* LOG_VALUE.DB */) {
864
+ else if (type & 65536) {
862
865
  checkColorOptions(type, SETTINGS.db, options);
863
866
  }
864
- else if (type & 16 /* LOG_VALUE.WATCH */) {
867
+ else if (type & 16) {
865
868
  checkColorOptions(type, SETTINGS.watch, options);
866
869
  titleJustify = 'center';
867
870
  }
868
- else if (type & 2048 /* LOG_VALUE.IMAGE */) {
871
+ else if (type & 2048) {
869
872
  checkColorOptions(type, SETTINGS.image, options);
870
873
  }
871
- else if (type & 8 /* LOG_VALUE.COMPRESS */) {
874
+ else if (type & 8) {
872
875
  checkColorOptions(type, SETTINGS.compress, options);
873
876
  }
874
- else if ((type & 4 /* LOG_VALUE.PROCESS */) && !options.titleColor && !checkColorOptions(type, SETTINGS.process, options)) {
877
+ else if ((type & 4) && !options.titleColor && !checkColorOptions(type, SETTINGS.process, options)) {
875
878
  options.titleColor = 'magenta';
876
879
  }
877
- if (type & 128 /* LOG_VALUE.TIME_ELAPSED */) {
880
+ if (type & 128) {
878
881
  if (!checkColorOptions(type, SETTINGS.time_elapsed, options)) {
879
882
  options.hintColor || (options.hintColor = 'yellow');
880
883
  }
@@ -882,7 +885,7 @@ class Module extends EventEmitter {
882
885
  titleJustify = 'center';
883
886
  }
884
887
  }
885
- else if (type & 256 /* LOG_VALUE.TIME_PROCESS */) {
888
+ else if (type & 256) {
886
889
  if (options.failed) {
887
890
  options.messageBgColor || (options.messageBgColor = 'bgGrey');
888
891
  }
@@ -922,8 +925,8 @@ class Module extends EventEmitter {
922
925
  else if (title) {
923
926
  value = getValue();
924
927
  }
925
- const unit = options.messageUnit ? type & 256 /* LOG_VALUE.TIME_PROCESS */ ? options.messageUnit.padStart(options.messageUnitMinWidth || 0) : options.messageUnit : '';
926
- const getMessage = (m, u) => type & 256 /* LOG_VALUE.TIME_PROCESS */ && messageUnitIndent === undefined ? (u + m).trimEnd() : u ? (m + (messageUnitIndent === undefined ? ' ' : '') + u).trimStart() : m;
928
+ const unit = options.messageUnit ? type & 256 ? options.messageUnit.padStart(options.messageUnitMinWidth || 0) : options.messageUnit : '';
929
+ const getMessage = (m, u) => type & 256 && messageUnitIndent === undefined ? (u + m).trimEnd() : u ? (m + (messageUnitIndent === undefined ? ' ' : '') + u).trimStart() : m;
927
930
  if (coloring) {
928
931
  let { titleColor, titleBgColor, valueColor, valueBgColor, valueBold, messageWidth, messageColor, messageBgColor, messageBold } = options;
929
932
  if (!titleColor && !titleBgColor) {
@@ -983,12 +986,11 @@ class Module extends EventEmitter {
983
986
  if (BROADCAST_OUT) {
984
987
  try {
985
988
  options = { ...options, broadcastId, timeStamp: getTimeStamp(options, false) };
986
- // @ts-ignore
987
- if (BROADCAST_OUT["__cjs__" /* INTERNAL.CJS */]) {
989
+ if (BROADCAST_OUT["__cjs__"]) {
988
990
  BROADCAST_OUT(output, options);
989
991
  }
990
992
  else {
991
- BROADCAST_OUT.apply(VALUES["node.process.inline" /* KEY_NAME.NODE_PROCESS_INLINE */] ? process : null, VALUES["node.require.inline" /* KEY_NAME.NODE_REQUIRE_INLINE */] ? [output, options, require] : [output, options]);
993
+ BROADCAST_OUT.apply(VALUES["node.process.inline"] ? process : null, VALUES["node.require.inline"] ? [output, options, require] : [output, options]);
992
994
  }
993
995
  }
994
996
  catch {
@@ -1007,7 +1009,7 @@ class Module extends EventEmitter {
1007
1009
  LOG_EMPTYLINE = true;
1008
1010
  }
1009
1011
  }
1010
- if (type & 512 /* LOG_VALUE.FAIL */) {
1012
+ if (type & 512) {
1011
1013
  process.stderr.write((!LOG_NEWLINE ? '\n' : '') + output + '\n');
1012
1014
  }
1013
1015
  else if (typeof options.progressBar === 'boolean' && typeof PROCESS_STDOUT.clearLine === 'function') {
@@ -1040,7 +1042,7 @@ class Module extends EventEmitter {
1040
1042
  }
1041
1043
  options = {};
1042
1044
  }
1043
- this.formatMessage(((type || 1 /* LOG_VALUE.SYSTEM */) | 512 /* LOG_VALUE.FAIL */), "FAIL!" /* ERR_MESSAGE.FAIL */, value, message, applyStyle(options, this.LOG_STYLE_FAIL));
1045
+ this.formatMessage(((type || 1) | 512), "FAIL!", value, message, applyStyle(options, this.LOG_STYLE_FAIL));
1044
1046
  }
1045
1047
  static parseFunction(value, absolute, sync = true) {
1046
1048
  let context, requireExt, external;
@@ -1048,7 +1050,7 @@ class Module extends EventEmitter {
1048
1050
  ({ context, requireExt, external, absolute, sync = true } = absolute);
1049
1051
  }
1050
1052
  if (requireExt === undefined || requireExt === true) {
1051
- requireExt = VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */];
1053
+ requireExt = VALUES["node.require.ext"];
1052
1054
  }
1053
1055
  let result = (0, types_1.asFunction)(value, sync);
1054
1056
  if (!result && (0, types_1.isString)(value)) {
@@ -1057,7 +1059,7 @@ class Module extends EventEmitter {
1057
1059
  location = location.substring(4);
1058
1060
  }
1059
1061
  else if (pathname = absolute && path.isAbsolute(location) ? location : this.fromLocalPath(location)) {
1060
- if (requireExt && VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] && hasString(requireExt, getExtension(pathname))) {
1062
+ if (requireExt && VALUES["node.require.ext"] && hasString(requireExt, getExtension(pathname))) {
1061
1063
  try {
1062
1064
  result = checkFunction(require(pathname));
1063
1065
  }
@@ -1069,13 +1071,12 @@ class Module extends EventEmitter {
1069
1071
  result = (0, types_1.asFunction)(fs.readFileSync(pathname, 'utf-8'), sync);
1070
1072
  }
1071
1073
  catch (err) {
1072
- this.writeFail(["Unable to read file" /* ERR_MESSAGE.READ_FILE */, value], err, 32 /* LOG_VALUE.FILE */);
1074
+ this.writeFail(["Unable to read file", value], err, 32);
1073
1075
  }
1074
1076
  }
1075
1077
  }
1076
- if (external && !pathname && VALUES["node.require.npm" /* KEY_NAME.NODE_REQUIRE_NPM */] && /^(?:@[a-z\d-*~][a-z\d-*._~]*\/|node:)?[a-z\d-~][a-z\d-._~]*(?:\/.*)?$/.test(location)) {
1078
+ if (external && !pathname && VALUES["node.require.npm"] && /^(?:@[a-z\d-*~][a-z\d-*._~]*\/|node:)?[a-z\d-~][a-z\d-._~]*(?:\/.*)?$/.test(location)) {
1077
1079
  try {
1078
- // @ts-ignore
1079
1080
  result = checkFunction(require(types_1.IMPORT_MAP[location] || location));
1080
1081
  }
1081
1082
  catch {
@@ -1134,13 +1135,13 @@ class Module extends EventEmitter {
1134
1135
  break;
1135
1136
  }
1136
1137
  if (cacheKey === 'throws') {
1137
- throw new Error("Not able to cache" /* ERR_MESSAGE.NOT_CACHEABLE */);
1138
+ throw new Error("Not able to cache");
1138
1139
  }
1139
1140
  return cacheKey ? (0, types_1.generateUUID)() : '';
1140
1141
  }
1141
1142
  static asHash(data, algorithm, minLength = 0) {
1142
1143
  if (!algorithm && !minLength) {
1143
- return crypto.createHash("sha256" /* HASH_OUTPUT.ALGORITHM */).update(data).digest("hex" /* HASH_OUTPUT.DIGEST */);
1144
+ return crypto.createHash("sha256").update(data).digest("hex");
1144
1145
  }
1145
1146
  let options, digest;
1146
1147
  if (typeof minLength !== 'number') {
@@ -1174,19 +1175,19 @@ class Module extends EventEmitter {
1174
1175
  return data;
1175
1176
  }
1176
1177
  try {
1177
- return crypto.createHash(algorithm || "sha256" /* HASH_OUTPUT.ALGORITHM */, options).update(data).digest(digest || "hex" /* HASH_OUTPUT.DIGEST */);
1178
+ return crypto.createHash(algorithm || "sha256", options).update(data).digest(digest || "hex");
1178
1179
  }
1179
1180
  catch {
1180
1181
  return '';
1181
1182
  }
1182
1183
  }
1183
1184
  static async readHash(value, options = {}) {
1184
- const { algorithm, digest, chunkSize = 2097152000 /* HASH_OUTPUT.CHUNK_SIZE */ } = options;
1185
- const hash = crypto.createHash(algorithm || "sha256" /* HASH_OUTPUT.ALGORITHM */);
1185
+ const { algorithm, digest, chunkSize = 2097152000 } = options;
1186
+ const hash = crypto.createHash(algorithm || "sha256");
1186
1187
  try {
1187
1188
  const minStreamSize = (0, types_1.alignSize)(options.minStreamSize);
1188
- if (fs.statSync(value).size <= Math.min(minStreamSize > 0 ? minStreamSize : Infinity, 2097152000 /* HASH_OUTPUT.CHUNK_SIZE */)) {
1189
- return hash.update(fs.readFileSync(value)).digest(digest || "hex" /* HASH_OUTPUT.DIGEST */);
1189
+ if (fs.statSync(value).size <= Math.min(minStreamSize > 0 ? minStreamSize : Infinity, 2097152000)) {
1190
+ return hash.update(fs.readFileSync(value)).digest(digest || "hex");
1190
1191
  }
1191
1192
  }
1192
1193
  catch (err) {
@@ -1210,7 +1211,7 @@ class Module extends EventEmitter {
1210
1211
  if (chunks.length) {
1211
1212
  hash.update(Buffer.concat(chunks));
1212
1213
  }
1213
- return hash.digest(digest || "hex" /* HASH_OUTPUT.DIGEST */);
1214
+ return hash.digest(digest || "hex");
1214
1215
  }
1215
1216
  static toPosix(value, filename, normalize) {
1216
1217
  if (typeof filename === 'boolean') {
@@ -1387,7 +1388,7 @@ class Module extends EventEmitter {
1387
1388
  return path.join(PROCESS_CWD, value);
1388
1389
  }
1389
1390
  if (ch === '~' && value[1] === '/') {
1390
- return VALUES["permission.home_read" /* KEY_NAME.PERMISSION_HOMEREAD */] ? path.join(OS_HOMEDIR, value.substring(2)) : '';
1391
+ return VALUES["permission.home_read"] ? path.join(OS_HOMEDIR, value.substring(2)) : '';
1391
1392
  }
1392
1393
  try {
1393
1394
  if (fs.existsSync(value = path.join(PROCESS_CWD, value))) {
@@ -1411,7 +1412,7 @@ class Module extends EventEmitter {
1411
1412
  fs.unlinkSync(outDir);
1412
1413
  }
1413
1414
  catch {
1414
- this.formatMessage(32 /* LOG_VALUE.FILE */, 'WARN', "Unable to overwrite file" /* ERR_MESSAGE.OVERWRITE_FILE */, value, { ...this.LOG_STYLE_WARN });
1415
+ this.formatMessage(32, 'WARN', "Unable to overwrite file", value, { ...this.LOG_STYLE_WARN });
1415
1416
  return false;
1416
1417
  }
1417
1418
  }
@@ -1428,7 +1429,7 @@ class Module extends EventEmitter {
1428
1429
  return tryCreateDir(outDir);
1429
1430
  }
1430
1431
  catch (err) {
1431
- this.writeFail(["Unable to create directory" /* ERR_MESSAGE.CREATE_DIRECTORY */, value], err, 32 /* LOG_VALUE.FILE */);
1432
+ this.writeFail(["Unable to create directory", value], err, 32);
1432
1433
  }
1433
1434
  }
1434
1435
  return false;
@@ -1451,7 +1452,7 @@ class Module extends EventEmitter {
1451
1452
  }
1452
1453
  }
1453
1454
  catch (err) {
1454
- this.writeFail(["Unable to remove directory" /* ERR_MESSAGE.REMOVE_DIRECTORY */, value], err, 32 /* LOG_VALUE.FILE */);
1455
+ this.writeFail(["Unable to remove directory", value], err, 32);
1455
1456
  }
1456
1457
  }
1457
1458
  return false;
@@ -1459,11 +1460,11 @@ class Module extends EventEmitter {
1459
1460
  static async copyDir(src, dest, move, recursive = true) {
1460
1461
  const srcOut = sanitizePath(asFile(src));
1461
1462
  if (!srcOut || !this.isDir(srcOut)) {
1462
- return Promise.reject(errorDirectory(asFile(src) || "Unknown" /* ERR_MESSAGE.UNKNOWN */));
1463
+ return Promise.reject(errorDirectory(asFile(src) || "Unknown"));
1463
1464
  }
1464
1465
  const destOut = sanitizePath(asFile(dest));
1465
1466
  if (!destOut || !this.createDir(destOut)) {
1466
- return Promise.reject(errorDirectory(asFile(dest) || "Unknown" /* ERR_MESSAGE.UNKNOWN */));
1467
+ return Promise.reject(errorDirectory(asFile(dest) || "Unknown"));
1467
1468
  }
1468
1469
  let symFile, symDir, ignoreFile, ignoreDir, silent, overwrite;
1469
1470
  if ((0, types_1.isObject)(move)) {
@@ -1534,7 +1535,7 @@ class Module extends EventEmitter {
1534
1535
  .catch(err => {
1535
1536
  failed.push(srcPath);
1536
1537
  if (!silent) {
1537
- this.writeFail([move ? "Unable to move file" /* ERR_MESSAGE.MOVE_FILE */ : "Unable to copy file" /* ERR_MESSAGE.COPY_FILE */, path.basename(srcPath)], err, 32 /* LOG_VALUE.FILE */);
1538
+ this.writeFail([move ? "Unable to move file" : "Unable to copy file", path.basename(srcPath)], err, 32);
1538
1539
  }
1539
1540
  }));
1540
1541
  }
@@ -1549,7 +1550,7 @@ class Module extends EventEmitter {
1549
1550
  catch (err) {
1550
1551
  failed.push(srcDir);
1551
1552
  if (!silent) {
1552
- this.writeFail(["Unable to read directory" /* ERR_MESSAGE.READ_DIRECTORY */, path.basename(srcDir)], err, 32 /* LOG_VALUE.FILE */);
1553
+ this.writeFail(["Unable to read directory", path.basename(srcDir)], err, 32);
1553
1554
  }
1554
1555
  }
1555
1556
  }
@@ -1601,7 +1602,7 @@ class Module extends EventEmitter {
1601
1602
  }
1602
1603
  catch (error) {
1603
1604
  if (copied) {
1604
- this.formatMessage(32 /* LOG_VALUE.FILE */, 'WARN', ["Unable to delete file" /* ERR_MESSAGE.DELETE_FILE */, path.basename(src instanceof URL ? url.fileURLToPath(src) : src)], error, { ...this.LOG_STYLE_WARN });
1605
+ this.formatMessage(32, 'WARN', ["Unable to delete file", path.basename(src instanceof URL ? url.fileURLToPath(src) : src)], error, { ...this.LOG_STYLE_WARN });
1605
1606
  throws = false;
1606
1607
  }
1607
1608
  }
@@ -1623,7 +1624,7 @@ class Module extends EventEmitter {
1623
1624
  return new Promise(async (resolve) => {
1624
1625
  const fileSize = fs.statSync(src).size;
1625
1626
  let data;
1626
- if (fileSize >= (0, types_1.alignSize)(minStreamSize) || fileSize >= 2097152000 /* HASH_OUTPUT.CHUNK_SIZE */) {
1627
+ if (fileSize >= (0, types_1.alignSize)(minStreamSize) || fileSize >= 2097152000) {
1627
1628
  const readable = fs.createReadStream(src, { signal });
1628
1629
  const chunks = [];
1629
1630
  for await (const chunk of readable) {
@@ -1671,7 +1672,7 @@ class Module extends EventEmitter {
1671
1672
  return result;
1672
1673
  }
1673
1674
  catch (err) {
1674
- this.writeFail(["Unable to read file" /* ERR_MESSAGE.READ_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
1675
+ this.writeFail(["Unable to read file", path.basename(src)], err, 32);
1675
1676
  }
1676
1677
  }
1677
1678
  return (minStreamSize !== undefined ? Promise.resolve('') : '');
@@ -1699,7 +1700,7 @@ class Module extends EventEmitter {
1699
1700
  return result;
1700
1701
  }
1701
1702
  catch (err) {
1702
- this.writeFail(["Unable to read file" /* ERR_MESSAGE.READ_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
1703
+ this.writeFail(["Unable to read file", path.basename(src)], err, 32);
1703
1704
  }
1704
1705
  }
1705
1706
  return (minStreamSize !== undefined ? Promise.resolve(null) : null);
@@ -1711,7 +1712,7 @@ class Module extends EventEmitter {
1711
1712
  return (extension ? mime.extension(value) : mime.lookup(value)) || '';
1712
1713
  }
1713
1714
  static initCpuUsage(instance) {
1714
- if (!VALUES["node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */]) {
1715
+ if (!VALUES["node.process.cpu_usage"]) {
1715
1716
  return { user: 0, system: 0 };
1716
1717
  }
1717
1718
  const result = process.cpuUsage();
@@ -1722,7 +1723,7 @@ class Module extends EventEmitter {
1722
1723
  return result;
1723
1724
  }
1724
1725
  static getCpuUsage(start, format) {
1725
- if (VALUES["node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */]) {
1726
+ if (VALUES["node.process.cpu_usage"]) {
1726
1727
  let value = CACHE_CPU.get(start);
1727
1728
  if (value === undefined) {
1728
1729
  CACHE_CPU.set(start, getCpuTimes());
@@ -1740,7 +1741,7 @@ class Module extends EventEmitter {
1740
1741
  return format ? '' : 0;
1741
1742
  }
1742
1743
  static getMemUsage(format) {
1743
- if (!VALUES["node.process.memory_usage" /* KEY_NAME.NODE_PROCESS_MEMORYUSAGE */]) {
1744
+ if (!VALUES["node.process.memory_usage"]) {
1744
1745
  return format ? '' : 0;
1745
1746
  }
1746
1747
  const usage = process.memoryUsage();
@@ -1778,24 +1779,24 @@ class Module extends EventEmitter {
1778
1779
  if (!cpu_single_core) {
1779
1780
  usage /= CPU_CORETOTAL;
1780
1781
  }
1781
- if (usage + 0.005 /* CPU_MEM.BAR_100_OFFSET */ >= 1) {
1782
+ if (usage + 0.005 >= 1) {
1782
1783
  usage = 1;
1783
1784
  }
1784
- let bar = 20 /* CPU_MEM.BAR_LENGTH */, red = 0.9 /* CPU_MEM.BAR_RED */, yellow = 0.75 /* CPU_MEM.BAR_YELLOW */;
1785
+ let bar = 20, red = 0.9, yellow = 0.75;
1785
1786
  if (typeof cpu_bar === 'number') {
1786
1787
  bar = cpu_bar;
1787
1788
  }
1788
- else if (Array.isArray(cpu_bar) && cpu_bar[0] >= 10 /* CPU_MEM.BAR_MIN_LENGTH */) {
1789
+ else if (Array.isArray(cpu_bar) && cpu_bar[0] >= 10) {
1789
1790
  let r, y;
1790
- [bar, r = 0.9 /* CPU_MEM.BAR_RED */, y = 0.75 /* CPU_MEM.BAR_YELLOW */] = cpu_bar;
1791
+ [bar, r = 0.9, y = 0.75] = cpu_bar;
1791
1792
  if (r > 0 && r < 1 && y > 0 && y < 1 && y < r) {
1792
1793
  red = r;
1793
1794
  yellow = y;
1794
1795
  }
1795
1796
  }
1796
- const unit = Math.max(bar, 10 /* CPU_MEM.BAR_MIN_LENGTH */);
1797
+ const unit = Math.max(bar, 10);
1797
1798
  const length = Math.floor(usage * unit);
1798
- const hint = usage === 1 ? "MAX" /* CPU_MEM.BAR_100 */ : usage < 0 ? "N/A" /* CPU_MEM.BAR_UNDER */ : formatPercent(usage, 2);
1799
+ const hint = usage === 1 ? "MAX" : usage < 0 ? "N/A" : formatPercent(usage, 2);
1799
1800
  result += chalk[usage >= red ? 'bgRed' : usage >= yellow ? 'bgYellow' : 'bgBlue'].white(':'.repeat(length)) + chalk.bgGrey.white(':'.repeat(unit - length)) + (hint ? chalk.bgWhite.grey(` ${hint} `) : '');
1800
1801
  }
1801
1802
  else if (usage) {
@@ -1920,14 +1921,14 @@ class Module extends EventEmitter {
1920
1921
  for (const folder of folders) {
1921
1922
  for (const locator of treeRoots) {
1922
1923
  const item = YARN_VER.getPackageInformation(locator);
1923
- if (item && (PLATFORM_WIN32 ? item.packageLocation.toLowerCase() : item.packageLocation) === folder && (version = getVersion(item))) {
1924
+ if (item && !item.discardFromLookup && (PLATFORM_WIN32 ? item.packageLocation.toLowerCase() : item.packageLocation) === folder && (version = getVersion(item))) {
1924
1925
  return version;
1925
1926
  }
1926
1927
  }
1927
1928
  }
1928
1929
  for (const locator of treeRoots) {
1929
1930
  const item = YARN_VER.getPackageInformation(locator);
1930
- if (item && (version = getVersion(item))) {
1931
+ if (item && !item.discardFromLookup && (version = getVersion(item))) {
1931
1932
  result.push(version);
1932
1933
  }
1933
1934
  }
@@ -2100,22 +2101,22 @@ class Module extends EventEmitter {
2100
2101
  static canWrite(name) {
2101
2102
  switch (name) {
2102
2103
  case 'temp':
2103
- return VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */];
2104
+ return VALUES["temp.write"];
2104
2105
  case 'home':
2105
- return VALUES["permission.home_write" /* KEY_NAME.PERMISSION_HOMEWRITE */];
2106
+ return VALUES["permission.home_write"];
2106
2107
  default:
2107
2108
  return false;
2108
2109
  }
2109
2110
  }
2110
2111
  static loadSettings(settings, password) {
2111
2112
  var _h;
2112
- const current = VALUES["process.password" /* KEY_NAME.PROCESS_PASSWORD */];
2113
+ const current = VALUES["process.password"];
2113
2114
  if (current) {
2114
2115
  const proc = settings.process || {};
2115
2116
  if (!password && !(password = proc.password)) {
2116
2117
  return false;
2117
2118
  }
2118
- const algorithm = VALUES["process.cipher.algorithm" /* KEY_NAME.PROCESS_CIPHER_ALGORITHM */];
2119
+ const algorithm = VALUES["process.cipher.algorithm"];
2119
2120
  if (algorithm) {
2120
2121
  password = encryptMessage(password, proc.cipher, algorithm);
2121
2122
  }
@@ -2124,7 +2125,7 @@ class Module extends EventEmitter {
2124
2125
  }
2125
2126
  }
2126
2127
  else if ((0, types_1.isString)(password)) {
2127
- VALUES["process.password" /* KEY_NAME.PROCESS_PASSWORD */] = encryptMessage(password, settings.process?.cipher);
2128
+ VALUES["process.password"] = encryptMessage(password, settings.process?.cipher);
2128
2129
  }
2129
2130
  const { temp, node, permission, memory, error, logger } = settings;
2130
2131
  if ((0, types_1.isPlainObject)(node)) {
@@ -2132,51 +2133,51 @@ class Module extends EventEmitter {
2132
2133
  if ((0, types_1.isPlainObject)(proc)) {
2133
2134
  const { cpu_usage, memory_usage, inline } = proc;
2134
2135
  if (typeof cpu_usage === 'boolean') {
2135
- VALUES["node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */] = cpu_usage;
2136
+ VALUES["node.process.cpu_usage"] = cpu_usage;
2136
2137
  }
2137
2138
  if (typeof memory_usage === 'boolean') {
2138
- VALUES["node.process.memory_usage" /* KEY_NAME.NODE_PROCESS_MEMORYUSAGE */] = memory_usage;
2139
+ VALUES["node.process.memory_usage"] = memory_usage;
2139
2140
  }
2140
2141
  if (typeof inline === 'boolean') {
2141
- VALUES["node.process.inline" /* KEY_NAME.NODE_PROCESS_INLINE */] = inline;
2142
+ VALUES["node.process.inline"] = inline;
2142
2143
  }
2143
2144
  }
2144
2145
  if ((0, types_1.isPlainObject)(req)) {
2145
2146
  const { ext, npm, inline } = req;
2146
2147
  if (!ext) {
2147
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = '';
2148
+ VALUES["node.require.ext"] = '';
2148
2149
  }
2149
2150
  else if (typeof ext === 'string') {
2150
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = ext.trim().toLowerCase();
2151
+ VALUES["node.require.ext"] = ext.trim().toLowerCase();
2151
2152
  }
2152
2153
  else if (Array.isArray(ext)) {
2153
2154
  const items = ext.map(value => (0, types_1.isString)(value) ? value.trim().toLowerCase() : '').filter(value => value);
2154
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = items.length ? items : '';
2155
+ VALUES["node.require.ext"] = items.length ? items : '';
2155
2156
  }
2156
2157
  else {
2157
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = 'cjs';
2158
+ VALUES["node.require.ext"] = 'cjs';
2158
2159
  }
2159
2160
  if (typeof npm === 'boolean') {
2160
- VALUES["node.require.npm" /* KEY_NAME.NODE_REQUIRE_NPM */] = npm;
2161
+ VALUES["node.require.npm"] = npm;
2161
2162
  }
2162
2163
  if (typeof inline === 'boolean') {
2163
- VALUES["node.require.inline" /* KEY_NAME.NODE_REQUIRE_INLINE */] = inline;
2164
+ VALUES["node.require.inline"] = inline;
2164
2165
  }
2165
2166
  }
2166
2167
  }
2167
2168
  if ((0, types_1.isPlainObject)(settings.process)) {
2168
2169
  const { env, cipher, password: pwd } = settings.process;
2169
2170
  if (env && typeof env.apply === 'boolean') {
2170
- VALUES["process.env.apply" /* KEY_NAME.PROCESS_ENV_APPLY */] = env.apply;
2171
+ VALUES["process.env.apply"] = env.apply;
2171
2172
  }
2172
2173
  if ((0, types_1.isString)(pwd)) {
2173
- VALUES[_h = "process.password" /* KEY_NAME.PROCESS_PASSWORD */] || (VALUES[_h] = encryptMessage(pwd, cipher));
2174
+ VALUES[_h = "process.password"] || (VALUES[_h] = encryptMessage(pwd, cipher));
2174
2175
  }
2175
2176
  }
2176
2177
  if ((0, types_1.isPlainObject)(memory?.settings)) {
2177
2178
  const { users, cache_disk } = memory.settings;
2178
2179
  if (typeof users === 'boolean' || Array.isArray(users)) {
2179
- VALUES["memory.settings.users" /* KEY_NAME.MEMORY_SETTINGS_USERS */] = users;
2180
+ VALUES["memory.settings.users"] = users;
2180
2181
  }
2181
2182
  if ((0, types_1.isPlainObject)(cache_disk)) {
2182
2183
  let { enabled, min_size, max_size, expires, include, exclude } = cache_disk;
@@ -2220,7 +2221,7 @@ class Module extends EventEmitter {
2220
2221
  if (level !== undefined) {
2221
2222
  const value = (0, types_1.isString)(level) ? types_1.STATUS_TYPE[level.trim().toUpperCase()] : level;
2222
2223
  if (value >= -1 && value <= types_1.STATUS_TYPE.TRACE) {
2223
- VALUES["logger.level" /* KEY_NAME.LOGGER_LEVEL */] = value;
2224
+ VALUES["logger.level"] = value;
2224
2225
  }
2225
2226
  }
2226
2227
  if (Array.isArray(production)) {
@@ -2353,7 +2354,7 @@ class Module extends EventEmitter {
2353
2354
  }
2354
2355
  }
2355
2356
  if (broadcast?.out) {
2356
- VALUES["broadcast.out" /* KEY_NAME.BROADCAST_OUT */] = this.parseFunction(broadcast.out, { external: true, absolute: true });
2357
+ VALUES["broadcast.out"] = this.parseFunction(broadcast.out, { external: true, absolute: true });
2357
2358
  }
2358
2359
  if (stack_trace && stack_trace !== true && +stack_trace > 0) {
2359
2360
  Error.stackTraceLimit = +stack_trace;
@@ -2361,23 +2362,32 @@ class Module extends EventEmitter {
2361
2362
  }
2362
2363
  if ((0, types_1.isPlainObject)(error)) {
2363
2364
  if (error.out) {
2364
- VALUES["error.out" /* KEY_NAME.ERROR_OUT */] = this.parseFunction(error.out, { external: true, absolute: true });
2365
+ VALUES["error.out"] = this.parseFunction(error.out, { external: true, absolute: true });
2365
2366
  }
2366
2367
  if (typeof error.fatal === 'boolean') {
2367
- VALUES["error.fatal" /* KEY_NAME.ERROR_FATAL */] = error.fatal;
2368
+ VALUES["error.fatal"] = error.fatal;
2368
2369
  }
2369
2370
  }
2370
- if (Array.isArray(permission?.process_exec)) {
2371
- VALUES["permission.process_exec" /* KEY_NAME.PERMISSION_PROCESS_EXEC */] = permission.process_exec.filter(item => typeof item === 'string' || (0, types_1.isObject)(item) && typeof item.command === 'string').map(exec => {
2372
- if (typeof exec === 'string') {
2373
- return exec.trim();
2374
- }
2375
- if (typeof exec.warn === 'string') {
2376
- exec.warn = [exec.warn];
2377
- }
2378
- exec.command = exec.command.trim();
2379
- return exec;
2380
- });
2371
+ if (permission) {
2372
+ const { home_read, home_write } = permission;
2373
+ if (typeof home_read === 'boolean') {
2374
+ VALUES["permission.home_read"] = home_read;
2375
+ }
2376
+ if (typeof home_write === 'boolean') {
2377
+ VALUES["permission.home_write"] = home_write;
2378
+ }
2379
+ if (Array.isArray(permission.process_exec)) {
2380
+ VALUES["permission.process_exec"] = permission.process_exec.filter(item => typeof item === 'string' || (0, types_1.isObject)(item) && typeof item.command === 'string').map(exec => {
2381
+ if (typeof exec === 'string') {
2382
+ return exec.trim();
2383
+ }
2384
+ if (typeof exec.warn === 'string') {
2385
+ exec.warn = [exec.warn];
2386
+ }
2387
+ exec.command = exec.command.trim();
2388
+ return exec;
2389
+ });
2390
+ }
2381
2391
  }
2382
2392
  {
2383
2393
  let dir = settings.temp_dir, write, modified;
@@ -2390,16 +2400,16 @@ class Module extends EventEmitter {
2390
2400
  dir = dir.substring(ensureDir(PROCESS_CWD).length);
2391
2401
  }
2392
2402
  else {
2393
- this.formatMessage(1 /* LOG_VALUE.SYSTEM */, 'WARN', 'Temp directory can only be relative', dir, { ...this.LOG_STYLE_WARN, newline: true });
2403
+ this.formatMessage(1, 'WARN', 'Temp directory can only be relative', dir, { ...this.LOG_STYLE_WARN, newline: true });
2394
2404
  dir = undefined;
2395
2405
  }
2396
2406
  }
2397
2407
  if (!(0, types_1.isString)(dir)) {
2398
- dir = VALUES["temp.dir" /* KEY_NAME.TEMP_DIR */];
2408
+ dir = VALUES["temp.dir"];
2399
2409
  }
2400
2410
  if (typeof write === 'boolean') {
2401
- modified = VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */] !== write;
2402
- VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */] = write;
2411
+ modified = VALUES["temp.write"] !== write;
2412
+ VALUES["temp.write"] = write;
2403
2413
  }
2404
2414
  do {
2405
2415
  const [output, index] = tryIncrementDir(path.join(PROCESS_CWD, dir), 5);
@@ -2407,19 +2417,19 @@ class Module extends EventEmitter {
2407
2417
  if (index > 0) {
2408
2418
  dir = trimDir(dir) + '_' + index;
2409
2419
  }
2410
- if (dir !== VALUES["temp.dir" /* KEY_NAME.TEMP_DIR */]) {
2411
- VALUES["temp.dir" /* KEY_NAME.TEMP_DIR */] = dir;
2420
+ if (dir !== VALUES["temp.dir"]) {
2421
+ VALUES["temp.dir"] = dir;
2412
2422
  modified = true;
2413
2423
  }
2414
2424
  (0, types_1.setTempDir)(TEMP_DIR = output);
2415
2425
  break;
2416
2426
  }
2417
2427
  if (output instanceof Error) {
2418
- this.writeFail(["Unable to create temp directory" /* ERR_MESSAGE.TEMP_DIRECTORY */, dir], output, 32 /* LOG_VALUE.FILE */);
2428
+ this.writeFail(["Unable to create temp directory", dir], output, 32);
2419
2429
  }
2420
- } while ((dir !== "tmp" /* INTERNAL.TEMP_DIR */) && (dir = "tmp" /* INTERNAL.TEMP_DIR */));
2430
+ } while ((dir !== "tmp") && (dir = "tmp"));
2421
2431
  if (modified) {
2422
- this.formatMessage(1 /* LOG_VALUE.SYSTEM */, 'TEMP', ["Directory was modified" /* VAL_MESSAGE.MODIFIED_DIRECTORY */, dir], TEMP_DIR + (VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */] ? ' - writeable' : ''), { ...this.LOG_STYLE_NOTICE, newline: true });
2432
+ this.formatMessage(1, 'TEMP', ["Directory was modified", dir], TEMP_DIR + (VALUES["temp.write"] ? ' - writeable' : ''), { ...this.LOG_STYLE_NOTICE, newline: true });
2423
2433
  }
2424
2434
  settings.temp_dir = dir;
2425
2435
  if ((0, types_1.isPlainObject)(temp)) {
@@ -2472,7 +2482,7 @@ class Module extends EventEmitter {
2472
2482
  const [output] = tryIncrementDir(result, increment);
2473
2483
  if (!(0, types_1.isString)(output)) {
2474
2484
  if (output instanceof Error) {
2475
- this.writeFail(["Unable to create temp directory" /* ERR_MESSAGE.TEMP_DIRECTORY */, result], output, 32 /* LOG_VALUE.FILE */);
2485
+ this.writeFail(["Unable to create temp directory", result], output, 32);
2476
2486
  }
2477
2487
  return '';
2478
2488
  }
@@ -2506,7 +2516,7 @@ class Module extends EventEmitter {
2506
2516
  if (permission && (Module.isFile(uri, 'unc') ? permission.hasUNCRead(path.normalize(uri)) || ownPermissionOnly && !permission.getUNCRead() : path.isAbsolute(uri = path.resolve(uri)) && (permission.hasDiskRead(uri) || ownPermissionOnly && !permission.getDiskRead()))) {
2507
2517
  return true;
2508
2518
  }
2509
- return VALUES["permission.home_read" /* KEY_NAME.PERMISSION_HOMEREAD */] && withinDir(uri, OS_HOMEDIR);
2519
+ return VALUES["permission.home_read"] && withinDir(uri, OS_HOMEDIR);
2510
2520
  }
2511
2521
  canWrite(uri, options) {
2512
2522
  let permission = this.permission, ownPermissionOnly = false;
@@ -2527,12 +2537,12 @@ class Module extends EventEmitter {
2527
2537
  if (permission && (Module.isFile(uri, 'unc') ? permission.hasUNCWrite(path.normalize(uri)) || ownPermissionOnly && !permission.getUNCWrite() : path.isAbsolute(uri = path.resolve(uri)) && (permission.hasDiskWrite(uri) || ownPermissionOnly && !permission.getDiskWrite()))) {
2528
2538
  return true;
2529
2539
  }
2530
- return VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */] && withinDir(uri, TEMP_DIR) || VALUES["permission.home_write" /* KEY_NAME.PERMISSION_HOMEWRITE */] && withinDir(uri, OS_HOMEDIR);
2540
+ return VALUES["temp.write"] && withinDir(uri, TEMP_DIR) || VALUES["permission.home_write"] && withinDir(uri, OS_HOMEDIR);
2531
2541
  }
2532
2542
  readFile(src, options = {}, callback) {
2533
2543
  let promises, outSrc;
2534
2544
  [options, promises, callback] = parseFileArgs(options, callback);
2535
- if (outSrc = hasFileSystem.call(this, 0 /* FILE_SYSTEM.READ */, src, options)) {
2545
+ if (outSrc = hasFileSystem.call(this, 0, src, options)) {
2536
2546
  let { requireExt, minStreamSize, cache } = options;
2537
2547
  const encoding = options.encoding && (0, types_1.getEncoding)(options.encoding);
2538
2548
  const setCache = (data, cjs) => {
@@ -2544,7 +2554,7 @@ class Module extends EventEmitter {
2544
2554
  }
2545
2555
  };
2546
2556
  let result;
2547
- if (requireExt && VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] && hasString(requireExt === true ? VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] : requireExt, getExtension(src))) {
2557
+ if (requireExt && VALUES["node.require.ext"] && hasString(requireExt === true ? VALUES["node.require.ext"] : requireExt, getExtension(src))) {
2548
2558
  if (cache) {
2549
2559
  result = getCacheItem(CACHE_READCJS, outSrc);
2550
2560
  }
@@ -2563,11 +2573,11 @@ class Module extends EventEmitter {
2563
2573
  }
2564
2574
  try {
2565
2575
  minStreamSize = (0, types_1.alignSize)(minStreamSize);
2566
- if (!isNaN(minStreamSize) || promises && fs.statSync(outSrc).size >= 2097152000 /* HASH_OUTPUT.CHUNK_SIZE */) {
2576
+ if (!isNaN(minStreamSize) || promises && fs.statSync(outSrc).size >= 2097152000) {
2567
2577
  if (result) {
2568
2578
  return Promise.resolve(result);
2569
2579
  }
2570
- if (promises || fs.statSync(outSrc).size >= Math.min(minStreamSize || Infinity, 2097152000 /* HASH_OUTPUT.CHUNK_SIZE */)) {
2580
+ if (promises || fs.statSync(outSrc).size >= Math.min(minStreamSize || Infinity, 2097152000)) {
2571
2581
  return new Promise(async (resolve) => {
2572
2582
  const readable = fs.createReadStream(outSrc, { signal: this.signal });
2573
2583
  const chunks = [];
@@ -2614,7 +2624,7 @@ class Module extends EventEmitter {
2614
2624
  return result;
2615
2625
  }
2616
2626
  catch (err) {
2617
- this.writeFail(["Unable to read file" /* ERR_MESSAGE.READ_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
2627
+ this.writeFail(["Unable to read file", path.basename(src)], err, 32);
2618
2628
  }
2619
2629
  }
2620
2630
  else if (promises) {
@@ -2627,7 +2637,7 @@ class Module extends EventEmitter {
2627
2637
  writeFile(src, data, options = {}, callback) {
2628
2638
  let promises, outSrc;
2629
2639
  [options, promises, callback] = parseFileArgs(options, callback);
2630
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options, true, options.overwrite)) {
2640
+ if (outSrc = hasFileSystem.call(this, 1, src, options, true, options.overwrite)) {
2631
2641
  if (promises) {
2632
2642
  return fs.promises.writeFile(outSrc, data, options.encoding).then(() => {
2633
2643
  this.emit('file:write', outSrc, options);
@@ -2649,7 +2659,7 @@ class Module extends EventEmitter {
2649
2659
  return true;
2650
2660
  }
2651
2661
  catch (err) {
2652
- this.writeFail(["Unable to write file" /* ERR_MESSAGE.WRITE_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
2662
+ this.writeFail(["Unable to write file", path.basename(src)], err, 32);
2653
2663
  }
2654
2664
  }
2655
2665
  else if (promises) {
@@ -2664,7 +2674,7 @@ class Module extends EventEmitter {
2664
2674
  deleteFile(src, options = {}, callback) {
2665
2675
  let promises, outSrc;
2666
2676
  [options, promises, callback] = parseFileArgs(options, callback);
2667
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options)) {
2677
+ if (outSrc = hasFileSystem.call(this, 1, src, options)) {
2668
2678
  if (promises) {
2669
2679
  return fs.promises.unlink(outSrc).then(() => {
2670
2680
  this.emit('file:delete', outSrc, options);
@@ -2685,7 +2695,7 @@ class Module extends EventEmitter {
2685
2695
  }
2686
2696
  catch (err) {
2687
2697
  if (!Module.isErrorCode(err, 'ENOENT')) {
2688
- this.writeFail(["Unable to delete file" /* ERR_MESSAGE.DELETE_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
2698
+ this.writeFail(["Unable to delete file", path.basename(src)], err, 32);
2689
2699
  return false;
2690
2700
  }
2691
2701
  }
@@ -2704,7 +2714,7 @@ class Module extends EventEmitter {
2704
2714
  copyFile(src, dest, options = {}, callback) {
2705
2715
  let promises, outSrc, outDest;
2706
2716
  [options, promises, callback] = parseFileArgs(options, callback);
2707
- if ((outSrc = hasFileSystem.call(this, 0 /* FILE_SYSTEM.READ */, src, options)) && (outDest = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, dest, options, true, options.overwrite))) {
2717
+ if ((outSrc = hasFileSystem.call(this, 0, src, options)) && (outDest = hasFileSystem.call(this, 1, dest, options, true, options.overwrite))) {
2708
2718
  const destDir = path.dirname(outDest);
2709
2719
  if (!Module.isDir(destDir) && (options.createDir === false || !Module.createDir(destDir))) {
2710
2720
  if (promises) {
@@ -2741,7 +2751,7 @@ class Module extends EventEmitter {
2741
2751
  return true;
2742
2752
  }
2743
2753
  catch (err) {
2744
- this.writeFail(["Unable to copy file" /* ERR_MESSAGE.COPY_FILE */, dest], err, 32 /* LOG_VALUE.FILE */);
2754
+ this.writeFail(["Unable to copy file", dest], err, 32);
2745
2755
  }
2746
2756
  }
2747
2757
  }
@@ -2757,7 +2767,7 @@ class Module extends EventEmitter {
2757
2767
  moveFile(src, dest, options = {}, callback) {
2758
2768
  let promises, outSrc, outDest;
2759
2769
  [options, promises, callback] = parseFileArgs(options, callback);
2760
- if ((outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options)) && (outDest = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, dest, options, true, options.overwrite))) {
2770
+ if ((outSrc = hasFileSystem.call(this, 1, src, options)) && (outDest = hasFileSystem.call(this, 1, dest, options, true, options.overwrite))) {
2761
2771
  const destDir = path.dirname(outDest);
2762
2772
  if (!Module.isDir(destDir) && (options.createDir === false || !Module.createDir(destDir))) {
2763
2773
  if (promises) {
@@ -2824,7 +2834,7 @@ class Module extends EventEmitter {
2824
2834
  this.emit('file:move', outDest, options);
2825
2835
  return true;
2826
2836
  }
2827
- this.writeFail(["Unable to move file" /* ERR_MESSAGE.MOVE_FILE */, dest], err, 32 /* LOG_VALUE.FILE */);
2837
+ this.writeFail(["Unable to move file", dest], err, 32);
2828
2838
  }
2829
2839
  }
2830
2840
  }
@@ -2845,7 +2855,7 @@ class Module extends EventEmitter {
2845
2855
  createDir(src, options = {}, callback) {
2846
2856
  let promises, outSrc;
2847
2857
  [options, promises, callback] = parseFileArgs(options, callback);
2848
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options, true)) {
2858
+ if (outSrc = hasFileSystem.call(this, 1, src, options, true)) {
2849
2859
  if (Module.isDir(outSrc)) {
2850
2860
  if (promises) {
2851
2861
  return Promise.resolve(true);
@@ -2892,7 +2902,7 @@ class Module extends EventEmitter {
2892
2902
  }
2893
2903
  }
2894
2904
  catch (err) {
2895
- this.writeFail(["Unable to create directory" /* ERR_MESSAGE.CREATE_DIRECTORY */, src], err, 32 /* LOG_VALUE.FILE */);
2905
+ this.writeFail(["Unable to create directory", src], err, 32);
2896
2906
  }
2897
2907
  }
2898
2908
  else if (promises) {
@@ -2907,11 +2917,11 @@ class Module extends EventEmitter {
2907
2917
  removeDir(src, options = {}, callback) {
2908
2918
  let promises, outSrc;
2909
2919
  [options, promises, callback] = parseFileArgs(options, callback);
2910
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options, true)) {
2920
+ if (outSrc = hasFileSystem.call(this, 1, src, options, true)) {
2911
2921
  try {
2912
2922
  if (Module.isDir(outSrc)) {
2913
2923
  const { emptyDir = false, recursive = true } = options;
2914
- const errorResponse = (failed) => new Error("Unsupported access" /* ERR_MESSAGE.UNSUPPORTED_ACCESS */ + ':' + (failed.length > 1 ? failed.map(value => `\n- ${value}`) : ' ' + failed[0]));
2924
+ const errorResponse = (failed) => new Error("Unsupported access" + ':' + (failed.length > 1 ? failed.map(value => `\n- ${value}`) : ' ' + failed[0]));
2915
2925
  if (promises || isFunction(callback)) {
2916
2926
  const result = new Promise((resolve, reject) => {
2917
2927
  const failed = tryRemoveDir(outSrc, emptyDir, !!recursive);
@@ -2962,7 +2972,7 @@ class Module extends EventEmitter {
2962
2972
  }
2963
2973
  }
2964
2974
  catch (err) {
2965
- this.writeFail(["Unable to remove directory" /* ERR_MESSAGE.REMOVE_DIRECTORY */, src], err, 32 /* LOG_VALUE.FILE */);
2975
+ this.writeFail(["Unable to remove directory", src], err, 32);
2966
2976
  }
2967
2977
  }
2968
2978
  else if (promises) {
@@ -2975,7 +2985,7 @@ class Module extends EventEmitter {
2975
2985
  return false;
2976
2986
  }
2977
2987
  async allSettled(tasks, rejected, options) {
2978
- rejected || (rejected = "Unknown" /* ERR_MESSAGE.UNKNOWN */);
2988
+ rejected || (rejected = "Unknown");
2979
2989
  return Promise.allSettled(tasks).then(result => {
2980
2990
  const items = [];
2981
2991
  for (const item of result) {
@@ -3004,16 +3014,16 @@ class Module extends EventEmitter {
3004
3014
  }
3005
3015
  options = {};
3006
3016
  }
3007
- this.formatFail(type || types_1.LOG_TYPE.SYSTEM, "FAIL!" /* ERR_MESSAGE.FAIL */, value, message, options);
3017
+ this.formatFail(type || types_1.LOG_TYPE.SYSTEM, "FAIL!", value, message, options);
3008
3018
  }
3009
3019
  writeTimeProcess(title, value, startTime, options = {}) {
3010
3020
  const { type = 0, statusType = 0 } = options;
3011
- const http = type & 1024 /* LOG_VALUE.HTTP */;
3021
+ const http = type & 1024;
3012
3022
  const meter = SETTINGS.meter;
3013
3023
  const failed = isFailed(options);
3014
3024
  const increment = options.meterIncrement || (http ? meter.http
3015
- : type & 2048 /* LOG_VALUE.IMAGE */ ? meter.image
3016
- : type & 8 /* LOG_VALUE.COMPRESS */ ? meter.compress
3025
+ : type & 2048 ? meter.image
3026
+ : type & 8 ? meter.compress
3017
3027
  : meter.process) || 250;
3018
3028
  const duration = getTimeOffset(startTime);
3019
3029
  let meterTime = duration, delayTime = options.delayTime;
@@ -3032,10 +3042,10 @@ class Module extends EventEmitter {
3032
3042
  }
3033
3043
  }
3034
3044
  if (failed && !http) {
3035
- value = "Failed" /* ERR_MESSAGE.FAILED */ + ' -> ' + value;
3045
+ value = "Failed" + ' -> ' + value;
3036
3046
  }
3037
3047
  const args = [
3038
- (256 /* LOG_VALUE.TIME_PROCESS */ | type),
3048
+ (256 | type),
3039
3049
  title,
3040
3050
  [value, formatTimeHint(duration)],
3041
3051
  (failed ? 'X' : '>').repeat(Math.min(Math.ceil(meterTime / increment), SETTINGS.format.meter.width)),
@@ -3070,10 +3080,10 @@ class Module extends EventEmitter {
3070
3080
  message = value;
3071
3081
  value = '';
3072
3082
  }
3073
- value || (value = isFailed(options) ? "Failed" /* ERR_MESSAGE.FAILED */ : "Success" /* VAL_MESSAGE.SUCCESS */);
3083
+ value || (value = isFailed(options) ? "Failed" : "Success");
3074
3084
  const duration = getTimeOffset(startTime);
3075
3085
  const args = [
3076
- (128 /* LOG_VALUE.TIME_ELAPSED */ | type),
3086
+ (128 | type),
3077
3087
  title,
3078
3088
  [value, formatTimeHint(duration)],
3079
3089
  message,
@@ -3110,10 +3120,10 @@ class Module extends EventEmitter {
3110
3120
  if (options.passThrough) {
3111
3121
  message = null;
3112
3122
  }
3113
- const args = [(type | 512 /* LOG_VALUE.FAIL */), title, value, message, applyStyle(options, Module.LOG_STYLE_FAIL)];
3123
+ const args = [(type | 512), title, value, message, applyStyle(options, Module.LOG_STYLE_FAIL)];
3114
3124
  applyLogId.call(this, options);
3115
3125
  if (options.queue !== false && !options.passThrough && !this._logFlushed) {
3116
- if (VALUES["error.out" /* KEY_NAME.ERROR_OUT */]) {
3126
+ if (VALUES["error.out"]) {
3117
3127
  options.timeStamp = Date.now();
3118
3128
  }
3119
3129
  this._logQueued.push(args);
@@ -3124,9 +3134,9 @@ class Module extends EventEmitter {
3124
3134
  const host = this.host;
3125
3135
  const target = host || this;
3126
3136
  let fatal;
3127
- if (options.exec && (type & 4096 /* LOG_VALUE.EXEC */) && target.willAbort("(exec)" /* ABORT_NAME.EXEC */)) {
3137
+ if (options.exec && (type & 4096) && target.willAbort("(exec)")) {
3128
3138
  const exec = { ...options.exec };
3129
- let output = VALUES["permission.process_exec" /* KEY_NAME.PERMISSION_PROCESS_EXEC */].find(item => exec.command === ((0, types_1.isObject)(item) ? item.command : item));
3139
+ let output = VALUES["permission.process_exec"].find(item => exec.command === ((0, types_1.isObject)(item) ? item.command : item));
3130
3140
  if (output) {
3131
3141
  if ((0, types_1.isPlainObject)(output)) {
3132
3142
  output = { ...output };
@@ -3147,14 +3157,14 @@ class Module extends EventEmitter {
3147
3157
  }
3148
3158
  }
3149
3159
  else {
3150
- this.formatMessage(4096 /* LOG_VALUE.EXEC */, "WARN!" /* ERR_MESSAGE.WARN */, "Exec command not permitted" /* ERR_MESSAGE.EXEC_PERMISSION */, exec.command, { ...Module.LOG_STYLE_WARN });
3160
+ this.formatMessage(4096, "WARN!", "Exec command not permitted", exec.command, { ...Module.LOG_STYLE_WARN });
3151
3161
  }
3152
3162
  }
3153
3163
  if (options.passThrough) {
3154
3164
  return;
3155
3165
  }
3156
3166
  if (options.abortable !== false && (options.fatal !== false || this.isFatal(message))) {
3157
- if (target.willAbort("(unknown)" /* ABORT_NAME.UNKNOWN */)) {
3167
+ if (target.willAbort("(unknown)")) {
3158
3168
  if (host) {
3159
3169
  host.abort();
3160
3170
  }
@@ -3170,18 +3180,18 @@ class Module extends EventEmitter {
3170
3180
  this.abort();
3171
3181
  fatal = true;
3172
3182
  }
3173
- else if ((type & 8192 /* LOG_VALUE.PERMISSION */ && (!host || host.willAbort("(permission)" /* ABORT_NAME.PERMISSION */))) ||
3174
- (type & 1 /* LOG_VALUE.SYSTEM */) && target.willAbort("(system)" /* ABORT_NAME.SYSTEM */) ||
3175
- (type & 2 /* LOG_VALUE.NODE */) && target.willAbort("(node)" /* ABORT_NAME.NODE */) ||
3176
- (type & 8 /* LOG_VALUE.COMPRESS */) && target.willAbort("(compress)" /* ABORT_NAME.COMPRESS */) ||
3177
- (type & 16 /* LOG_VALUE.WATCH */) && target.willAbort("(watch)" /* ABORT_NAME.WATCH */) ||
3178
- (type & 32 /* LOG_VALUE.FILE */) && target.willAbort("(file)" /* ABORT_NAME.FILE */) ||
3179
- (type & 64 /* LOG_VALUE.CLOUD */) && target.willAbort("(cloud)" /* ABORT_NAME.CLOUD */) ||
3180
- (type & 1024 /* LOG_VALUE.HTTP */) && target.willAbort("(http)" /* ABORT_NAME.HTTP */) ||
3181
- (type & 2048 /* LOG_VALUE.IMAGE */) && target.willAbort("(image)" /* ABORT_NAME.IMAGE */) ||
3182
- (type & 4096 /* LOG_VALUE.EXEC */) && target.willAbort("(exec)" /* ABORT_NAME.EXEC */) ||
3183
- (type & 16384 /* LOG_VALUE.TIMEOUT */) && target.willAbort("(timeout)" /* ABORT_NAME.TIMEOUT */) ||
3184
- (type & 65536 /* LOG_VALUE.DB */) && target.willAbort("(db)" /* ABORT_NAME.DB */)) {
3183
+ else if ((type & 8192 && (!host || host.willAbort("(permission)"))) ||
3184
+ (type & 1) && target.willAbort("(system)") ||
3185
+ (type & 2) && target.willAbort("(node)") ||
3186
+ (type & 8) && target.willAbort("(compress)") ||
3187
+ (type & 16) && target.willAbort("(watch)") ||
3188
+ (type & 32) && target.willAbort("(file)") ||
3189
+ (type & 64) && target.willAbort("(cloud)") ||
3190
+ (type & 1024) && target.willAbort("(http)") ||
3191
+ (type & 2048) && target.willAbort("(image)") ||
3192
+ (type & 4096) && target.willAbort("(exec)") ||
3193
+ (type & 16384) && target.willAbort("(timeout)") ||
3194
+ (type & 65536) && target.willAbort("(db)")) {
3185
3195
  if (host) {
3186
3196
  if (host.abortable) {
3187
3197
  host.abort();
@@ -3221,7 +3231,7 @@ class Module extends EventEmitter {
3221
3231
  this.addLog(statusType, message || (Array.isArray(value) ? value[0] : value));
3222
3232
  }
3223
3233
  if (options.queue && !this._logFlushed) {
3224
- if (VALUES["error.out" /* KEY_NAME.ERROR_OUT */] && (type & 512 /* LOG_VALUE.FAIL */)) {
3234
+ if (VALUES["error.out"] && (type & 512)) {
3225
3235
  options.timeStamp = Date.now();
3226
3236
  }
3227
3237
  this._logQueued.push(args);
@@ -3243,7 +3253,7 @@ class Module extends EventEmitter {
3243
3253
  if (typeof options === 'number') {
3244
3254
  options = undefined;
3245
3255
  }
3246
- this.writeFail("Unknown" /* ERR_MESSAGE.UNKNOWN */, err, { ...options, type: types_1.LOG_TYPE.SYSTEM, code: types_1.ERR_CODE.MODULE_NOT_FOUND, exec: { command: 'npm', args: ['i', name] } });
3256
+ 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] } });
3247
3257
  return true;
3248
3258
  }
3249
3259
  if (value) {
@@ -3271,13 +3281,13 @@ class Module extends EventEmitter {
3271
3281
  }
3272
3282
  session.push(command);
3273
3283
  let type = options.type || 0;
3274
- type |= 4096 /* LOG_VALUE.EXEC */;
3275
- type &= ~1 /* LOG_VALUE.SYSTEM */;
3284
+ type |= 4096;
3285
+ type &= ~1;
3276
3286
  if (options.passThrough) {
3277
3287
  options.passThrough = false;
3278
3288
  message = null;
3279
3289
  }
3280
- return { type, value: ["Install required?" /* ERR_MESSAGE.INSTALL */, command], message };
3290
+ return { type, value: ["Install required?", command], message };
3281
3291
  }
3282
3292
  delete options.exec;
3283
3293
  }
@@ -3365,7 +3375,7 @@ class Module extends EventEmitter {
3365
3375
  message = '';
3366
3376
  }
3367
3377
  }
3368
- this.status.push({ value: message.trim() || "Unknown" /* ERR_MESSAGE.UNKNOWN */, name, duration, timeStamp, type, sessionId: this.sessionId, from: from || this.moduleName, source });
3378
+ this.status.push({ value: message.trim() || "Unknown", name, duration, timeStamp, type, sessionId: this.sessionId, from: from || this.moduleName, source });
3369
3379
  }
3370
3380
  getLog(...type) {
3371
3381
  return this.status.filter(item => type.includes(item.type));
@@ -3425,7 +3435,7 @@ class Module extends EventEmitter {
3425
3435
  }
3426
3436
  isFatal(err) {
3427
3437
  const fatal = this.host?.config.error?.fatal;
3428
- return fatal ?? VALUES["error.fatal" /* KEY_NAME.ERROR_FATAL */];
3438
+ return fatal ?? VALUES["error.fatal"];
3429
3439
  }
3430
3440
  get moduleName() {
3431
3441
  return this._moduleName;
@@ -3441,14 +3451,14 @@ class Module extends EventEmitter {
3441
3451
  const aborting = this._hostEvents.includes('abort');
3442
3452
  if (value.aborted) {
3443
3453
  if (aborting) {
3444
- this.abort(new Error("Aborted by host" /* ERR_MESSAGE.ABORTED_HOST */));
3454
+ this.abort(new Error("Aborted by host"));
3445
3455
  }
3446
3456
  }
3447
3457
  else if (!value.subProcesses.has(this)) {
3448
3458
  this.abortable = value.willAbort(this);
3449
3459
  value.modules.add(this);
3450
3460
  if (aborting) {
3451
- value.signal.addEventListener('abort', this[kAbortEvent] = () => this.abort(new Error("Aborted by host" /* ERR_MESSAGE.ABORTED_HOST */)), { once: true });
3461
+ value.signal.addEventListener('abort', this[kAbortEvent] = () => this.abort(new Error("Aborted by host")), { once: true });
3452
3462
  }
3453
3463
  }
3454
3464
  }
@@ -3534,7 +3544,7 @@ Module.LOG_STYLE_INFO = Object.freeze({ titleBgColor: 'bgBlue', titleColor: 'whi
3534
3544
  Module.LOG_STYLE_WARN = Object.freeze({ titleBgColor: 'bgBlack', titleColor: 'yellow', titleBold: true });
3535
3545
  Module.LOG_STYLE_NOTICE = Object.freeze({ titleBgColor: 'bgGrey', titleColor: 'white' });
3536
3546
  Module.LOG_STYLE_REVERSE = Object.freeze({ titleBgColor: 'bgWhite', titleColor: 'black', messageBgColor: 'bgGrey' });
3537
- if (!Module.supported(15, 4)) {
3547
+ if (!Module.supported(15, 4) && (!global.AbortController || !global.EventTarget)) {
3538
3548
  ({ AbortController: global.AbortController } = require('abort-controller'));
3539
3549
  ({ EventTarget: global.EventTarget } = require('event-target-shim'));
3540
3550
  }