@e-mc/module 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.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");
@@ -12,7 +11,7 @@ const mime = require("mime-types");
12
11
  const chalk = require("chalk");
13
12
  const stripansi = require("strip-ansi");
14
13
  const EventEmitter = require("events");
15
- const types_1 = require("../types");
14
+ const types_1 = require("@e-mc/types");
16
15
  const kSessionId = Symbol('sessionId');
17
16
  const kBroadcastId = Symbol('broadcastId');
18
17
  const kTempDir = Symbol('tempDir');
@@ -97,30 +96,30 @@ const SETTINGS = {
97
96
  stdout: true
98
97
  };
99
98
  const VALUES = {
100
- ["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */]: 'cjs',
101
- ["node.require.npm" /* KEY_NAME.NODE_REQUIRE_NPM */]: true,
102
- ["node.require.inline" /* KEY_NAME.NODE_REQUIRE_INLINE */]: true,
103
- ["node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */]: true,
104
- ["node.process.memory_usage" /* KEY_NAME.NODE_PROCESS_MEMORYUSAGE */]: true,
105
- ["node.process.inline" /* KEY_NAME.NODE_PROCESS_INLINE */]: true,
106
- ["temp.dir" /* KEY_NAME.TEMP_DIR */]: "tmp" /* INTERNAL.TEMP_DIR */,
107
- ["temp.write" /* KEY_NAME.TEMP_WRITE */]: false,
108
- ["process.password" /* KEY_NAME.PROCESS_PASSWORD */]: '',
109
- ["process.cipher.algorithm" /* KEY_NAME.PROCESS_CIPHER_ALGORITHM */]: '',
110
- ["process.env.apply" /* KEY_NAME.PROCESS_ENV_APPLY */]: false,
111
- ["permission.process_exec" /* KEY_NAME.PERMISSION_PROCESS_EXEC */]: [],
112
- ["permission.home_read" /* KEY_NAME.PERMISSION_HOMEREAD */]: false,
113
- ["permission.home_write" /* KEY_NAME.PERMISSION_HOMEWRITE */]: false,
114
- ["memory.settings.users" /* KEY_NAME.MEMORY_SETTINGS_USERS */]: false,
115
- ["error.out" /* KEY_NAME.ERROR_OUT */]: null,
116
- ["error.fatal" /* KEY_NAME.ERROR_FATAL */]: false,
117
- ["broadcast.out" /* KEY_NAME.BROADCAST_OUT */]: null,
118
- ["logger.level" /* KEY_NAME.LOGGER_LEVEL */]: -1
99
+ ["node.require.ext"]: 'cjs',
100
+ ["node.require.npm"]: true,
101
+ ["node.require.inline"]: true,
102
+ ["node.process.cpu_usage"]: true,
103
+ ["node.process.memory_usage"]: true,
104
+ ["node.process.inline"]: true,
105
+ ["temp.dir"]: "tmp",
106
+ ["temp.write"]: false,
107
+ ["process.password"]: '',
108
+ ["process.cipher.algorithm"]: '',
109
+ ["process.env.apply"]: false,
110
+ ["permission.process_exec"]: [],
111
+ ["permission.home_read"]: false,
112
+ ["permission.home_write"]: false,
113
+ ["memory.settings.users"]: false,
114
+ ["error.out"]: null,
115
+ ["error.fatal"]: false,
116
+ ["broadcast.out"]: null,
117
+ ["logger.level"]: -1
119
118
  };
120
119
  const REGEXP_TORRENT = /^(?:magnet:\?xt=|(?:https?|s?ftp):\/\/[^/][^\n]*?\.(?:torrent|metalink|meta4)(?:\?[^\n]*)?$)/i;
121
120
  let LOG_NEWLINE = true;
122
121
  let LOG_EMPTYLINE = false;
123
- let TEMP_DIR = path.join(PROCESS_CWD, "tmp" /* INTERNAL.TEMP_DIR */);
122
+ let TEMP_DIR = path.join(PROCESS_CWD, "tmp");
124
123
  const PNPM_VER = (function () {
125
124
  try {
126
125
  const pathname = path.resolve('./node_modules/.modules.yaml');
@@ -307,9 +306,9 @@ function errorObject(message) {
307
306
  case 'string':
308
307
  return new Error(message);
309
308
  case 'number':
310
- return (0, types_1.errorMessage)("Error code" /* ERR_MESSAGE.ERROR_CODE */, message.toString());
309
+ return (0, types_1.errorMessage)("Error code", message.toString());
311
310
  default:
312
- return message instanceof Error ? message : new Error(Module.asString(message) || "Unknown" /* ERR_MESSAGE.UNKNOWN */);
311
+ return message instanceof Error ? message : new Error(Module.asString(message) || "Unknown");
313
312
  }
314
313
  }
315
314
  function isFailed(options) {
@@ -322,7 +321,7 @@ function isFailed(options) {
322
321
  return false;
323
322
  }
324
323
  function getErrorMessage(err) {
325
- return SETTINGS.stack_trace && err.stack || err.message || err.toString() || "Unknown" /* ERR_MESSAGE.UNKNOWN */;
324
+ return SETTINGS.stack_trace && err.stack || err.message || err.toString() || "Unknown";
326
325
  }
327
326
  function writeLine(value) {
328
327
  PROCESS_STDOUT.write((!LOG_NEWLINE ? '\n' : '') + value + '\n');
@@ -330,7 +329,7 @@ function writeLine(value) {
330
329
  LOG_EMPTYLINE = false;
331
330
  }
332
331
  function errorPermission(value) {
333
- return (0, types_1.errorValue)("Unsupported access" /* ERR_MESSAGE.UNSUPPORTED_ACCESS */, value);
332
+ return (0, types_1.errorValue)("Unsupported access", value);
334
333
  }
335
334
  function parseFileArgs(options = {}, callback) {
336
335
  let promises;
@@ -391,7 +390,7 @@ function addCacheItem(map, key, data) {
391
390
  }
392
391
  function checkFunction(value) {
393
392
  if (typeof value === 'function') {
394
- Object.defineProperty(value, "__cjs__" /* INTERNAL.CJS */, { value: true });
393
+ Object.defineProperty(value, "__cjs__", { value: true });
395
394
  return value;
396
395
  }
397
396
  return null;
@@ -404,7 +403,7 @@ function encryptMessage(data, cipher, algorithm) {
404
403
  }
405
404
  const result = (0, types_1.encryptUTF8)(algorithm, cipher.key, cipher.iv, data);
406
405
  if (result) {
407
- VALUES[_h = "process.cipher.algorithm" /* KEY_NAME.PROCESS_CIPHER_ALGORITHM */] || (VALUES[_h] = algorithm);
406
+ VALUES[_h = "process.cipher.algorithm"] || (VALUES[_h] = algorithm);
408
407
  return result;
409
408
  }
410
409
  }
@@ -429,7 +428,7 @@ function hasFileSystem(type, value, options, ignoreExists, overwrite) {
429
428
  }
430
429
  else if (!(result = Module.fromLocalPath(value))) {
431
430
  if (options.throwsDoesNotExist) {
432
- throw (0, types_1.errorValue)("File not found" /* ERR_MESSAGE.NOTFOUND_FILE */, value);
431
+ throw (0, types_1.errorValue)("File not found", value);
433
432
  }
434
433
  return '';
435
434
  }
@@ -441,14 +440,14 @@ function hasFileSystem(type, value, options, ignoreExists, overwrite) {
441
440
  }
442
441
  if (!ignoreExists && !Module.isPath(result)) {
443
442
  if (options.throwsDoesNotExist) {
444
- throw (0, types_1.errorValue)("File not found" /* ERR_MESSAGE.NOTFOUND_FILE */, value);
443
+ throw (0, types_1.errorValue)("File not found", value);
445
444
  }
446
445
  return '';
447
446
  }
448
447
  if (options.ignorePermission) {
449
448
  return result;
450
449
  }
451
- const method = type === 1 /* FILE_SYSTEM.WRITE */ ? 'canWrite' : 'canRead';
450
+ const method = type === 1 ? 'canWrite' : 'canRead';
452
451
  if (options.ownPermissionOnly) {
453
452
  if (this.hasOwnPermission() && !this[method](result)) {
454
453
  if (options.throwsPermission) {
@@ -529,13 +528,13 @@ const asFile = (value) => value instanceof URL ? value.protocol === 'file:' ? ur
529
528
  const wrapQuote = (value) => '"' + value.replace(/"/g, '\\"') + '"';
530
529
  const isFunction = (value) => typeof value === 'function';
531
530
  const isFileURL = (value) => /^file:\/\//i.test(value);
532
- const errorDirectory = (value) => (0, types_1.errorValue)("Path is not a directory" /* ERR_MESSAGE.NOT_DIRECTORY */, value);
531
+ const errorDirectory = (value) => (0, types_1.errorValue)("Path is not a directory", value);
533
532
  const sanitizePath = (value) => (0, types_1.isString)(value) ? path.resolve(value.trim()) : '';
534
- const ensureDir = (value) => value[value.length - 1] !== path.sep ? value + path.sep : value;
535
- const trimDir = (value) => value[value.length - 1] === path.sep ? value.substring(0, value.length - 1) : value;
533
+ const ensureDir = (value) => !value.endsWith(path.sep) ? value + path.sep : value;
534
+ const trimDir = (value) => value.endsWith(path.sep) ? value.substring(0, value.length - 1) : value;
536
535
  const getExtension = (value) => path.extname(value).toLowerCase().substring(1);
537
536
  const hasString = (item, value) => (0, types_1.isString)(value) && (item === value || Array.isArray(item) && item.includes(value));
538
- const getCpuTimes = () => os.cpus().reduce((a, b) => a + b.times.user + b.times.sys, 0) * 1000 /* TIME.S */;
537
+ const getCpuTimes = () => os.cpus().reduce((a, b) => a + b.times.user + b.times.sys, 0) * 1000;
539
538
  class Module extends EventEmitter {
540
539
  constructor() {
541
540
  super(...arguments);
@@ -547,18 +546,18 @@ class Module extends EventEmitter {
547
546
  this._threadable = false;
548
547
  this._logEnabled = true;
549
548
  this._logFlushed = false;
550
- this._logLevel = VALUES["logger.level" /* KEY_NAME.LOGGER_LEVEL */];
549
+ this._logLevel = VALUES["logger.level"];
551
550
  this._hostEvents = ['abort'];
552
551
  this._logQueued = [];
553
552
  this[_a] = '';
554
- this[_b] = VALUES["temp.dir" /* KEY_NAME.TEMP_DIR */];
553
+ this[_b] = VALUES["temp.dir"];
555
554
  this[_c] = '';
556
555
  this[_d] = null;
557
556
  this[_e] = { stripAnsi: { value: true, modified: false } };
558
557
  this[_f] = new AbortController();
559
558
  this[_g] = null;
560
559
  }
561
- static get VERSION() { return "0.6.0" /* INTERNAL.VERSION */; }
560
+ static get VERSION() { return "0.6.2"; }
562
561
  static get LOG_TYPE() { return types_1.LOG_TYPE; }
563
562
  static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
564
563
  static get MAX_TIMEOUT() { return 2147483647; }
@@ -580,33 +579,33 @@ class Module extends EventEmitter {
580
579
  }
581
580
  static enabled(key, username) {
582
581
  switch (key) {
583
- case "memory.settings.users" /* KEY_NAME.MEMORY_SETTINGS_USERS */: {
582
+ case "memory.settings.users": {
584
583
  const users = VALUES[key];
585
584
  return users === false || !!username && (users === true || users.includes(username));
586
585
  }
587
- case "temp.dir" /* KEY_NAME.TEMP_DIR */:
588
- return VALUES[key] !== "tmp" /* INTERNAL.TEMP_DIR */;
589
- case "node.require.npm" /* KEY_NAME.NODE_REQUIRE_NPM */:
590
- case "node.require.inline" /* KEY_NAME.NODE_REQUIRE_INLINE */:
591
- case "node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */:
592
- case "node.process.memory_usage" /* KEY_NAME.NODE_PROCESS_MEMORYUSAGE */:
593
- case "node.process.inline" /* KEY_NAME.NODE_PROCESS_INLINE */:
594
- case "temp.write" /* KEY_NAME.TEMP_WRITE */:
595
- case "permission.home_read" /* KEY_NAME.PERMISSION_HOMEREAD */:
596
- case "permission.home_write" /* KEY_NAME.PERMISSION_HOMEWRITE */:
597
- case "process.env.apply" /* KEY_NAME.PROCESS_ENV_APPLY */:
598
- case "error.fatal" /* KEY_NAME.ERROR_FATAL */:
586
+ case "temp.dir":
587
+ return VALUES[key] !== "tmp";
588
+ case "node.require.npm":
589
+ case "node.require.inline":
590
+ case "node.process.cpu_usage":
591
+ case "node.process.memory_usage":
592
+ case "node.process.inline":
593
+ case "temp.write":
594
+ case "permission.home_read":
595
+ case "permission.home_write":
596
+ case "process.env.apply":
597
+ case "error.fatal":
599
598
  return VALUES[key];
600
- case "node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */:
601
- case "process.password" /* KEY_NAME.PROCESS_PASSWORD */:
602
- case "process.cipher.algorithm" /* KEY_NAME.PROCESS_CIPHER_ALGORITHM */:
599
+ case "node.require.ext":
600
+ case "process.password":
601
+ case "process.cipher.algorithm":
603
602
  return VALUES[key] !== '';
604
- case "permission.process_exec" /* KEY_NAME.PERMISSION_PROCESS_EXEC */:
603
+ case "permission.process_exec":
605
604
  return VALUES[key].length > 0;
606
- case "error.out" /* KEY_NAME.ERROR_OUT */:
607
- case "broadcast.out" /* KEY_NAME.BROADCAST_OUT */:
605
+ case "error.out":
606
+ case "broadcast.out":
608
607
  return VALUES[key] !== null;
609
- case "logger.level" /* KEY_NAME.LOGGER_LEVEL */:
608
+ case "logger.level":
610
609
  return VALUES[key] >= 0;
611
610
  default:
612
611
  return false;
@@ -618,20 +617,20 @@ class Module extends EventEmitter {
618
617
  return false;
619
618
  }
620
619
  }
621
- else if ((value & 1 /* LOG_VALUE.SYSTEM */) && SETTINGS.system === false ||
622
- (value & 2 /* LOG_VALUE.NODE */) && SETTINGS.node === false ||
623
- (value & 4 /* LOG_VALUE.PROCESS */) && SETTINGS.process === false ||
624
- (value & 8 /* LOG_VALUE.COMPRESS */) && SETTINGS.compress === false ||
625
- (value & 16 /* LOG_VALUE.WATCH */) && SETTINGS.watch === false ||
626
- (value & 32 /* LOG_VALUE.FILE */) && SETTINGS.file === false ||
627
- (value & 64 /* LOG_VALUE.CLOUD */) && SETTINGS.cloud === false ||
628
- (value & 128 /* LOG_VALUE.TIME_ELAPSED */) && SETTINGS.time_elapsed === false ||
629
- (value & 256 /* LOG_VALUE.TIME_PROCESS */) && SETTINGS.time_process === false ||
630
- (value & 1024 /* LOG_VALUE.HTTP */) && SETTINGS.http === false ||
631
- (value & 2048 /* LOG_VALUE.IMAGE */) && SETTINGS.image === false ||
632
- (value & 4096 /* LOG_VALUE.EXEC */) && SETTINGS.exec === false ||
633
- (value & 32768 /* LOG_VALUE.STDOUT */) && SETTINGS.stdout === false ||
634
- (value & 65536 /* LOG_VALUE.DB */) && SETTINGS.db === false) {
620
+ else if ((value & 1) && SETTINGS.system === false ||
621
+ (value & 2) && SETTINGS.node === false ||
622
+ (value & 4) && SETTINGS.process === false ||
623
+ (value & 8) && SETTINGS.compress === false ||
624
+ (value & 16) && SETTINGS.watch === false ||
625
+ (value & 32) && SETTINGS.file === false ||
626
+ (value & 64) && SETTINGS.cloud === false ||
627
+ (value & 128) && SETTINGS.time_elapsed === false ||
628
+ (value & 256) && SETTINGS.time_process === false ||
629
+ (value & 1024) && SETTINGS.http === false ||
630
+ (value & 2048) && SETTINGS.image === false ||
631
+ (value & 4096) && SETTINGS.exec === false ||
632
+ (value & 32768) && SETTINGS.stdout === false ||
633
+ (value & 65536) && SETTINGS.db === false) {
635
634
  return false;
636
635
  }
637
636
  return true;
@@ -640,19 +639,18 @@ class Module extends EventEmitter {
640
639
  if (options.type) {
641
640
  type |= options.type;
642
641
  }
643
- const BROADCAST_OUT = VALUES["broadcast.out" /* KEY_NAME.BROADCAST_OUT */];
642
+ const BROADCAST_OUT = VALUES["broadcast.out"];
644
643
  const sessionId = options.sessionId;
645
644
  let broadcastId = options.broadcastId;
646
- if ((type & 512 /* LOG_VALUE.FAIL */) === 512 /* LOG_VALUE.FAIL */ && VALUES["error.out" /* KEY_NAME.ERROR_OUT */]) {
645
+ if ((type & 512) === 512 && VALUES["error.out"]) {
647
646
  try {
648
- const ERROR_OUT = VALUES["error.out" /* KEY_NAME.ERROR_OUT */];
649
- const errorOptions = { type: type & ~512 /* LOG_VALUE.FAIL */, value, timeStamp: getTimeStamp(options, true), sessionId };
650
- // @ts-ignore
651
- if (ERROR_OUT["__cjs__" /* INTERNAL.CJS */]) {
647
+ const ERROR_OUT = VALUES["error.out"];
648
+ const errorOptions = { type: type & ~512, value, timeStamp: getTimeStamp(options, true), sessionId };
649
+ if (ERROR_OUT["__cjs__"]) {
652
650
  ERROR_OUT(errorObject(message), errorOptions);
653
651
  }
654
652
  else {
655
- 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]);
653
+ ERROR_OUT.apply(VALUES["node.process.inline"] ? process : null, VALUES["node.require.inline"] ? [errorObject(message), errorOptions, require] : [errorObject(message), errorOptions]);
656
654
  }
657
655
  }
658
656
  catch {
@@ -663,7 +661,7 @@ class Module extends EventEmitter {
663
661
  }
664
662
  let messageUnitIndent = options.messageUnitIndent, coloring;
665
663
  if (!broadcastId) {
666
- (0, types_1.setLogCurrent)({ type, title, value, message });
664
+ (0, types_1.setLogCurrent)({ type, title, value, message, sessionId });
667
665
  coloring = !(options.useColor === false || SETTINGS.color === false);
668
666
  }
669
667
  else if ((0, types_1.isPlainObject)(broadcastId)) {
@@ -675,7 +673,7 @@ class Module extends EventEmitter {
675
673
  const formatValue = format.value;
676
674
  const id = sessionId && SETTINGS.session_id ? ' ' + sessionId.padStart(SETTINGS.session_id, '0') + ' ' : '';
677
675
  const titleIndent = options.titleIndent ? typeof options.titleIndent === 'number' ? Math.max(options.titleIndent, 0) : 0 : -1;
678
- let output, error, 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);
676
+ let output, error, hint, valueWidth = Math.max(formatValue.width - (id ? SETTINGS.session_id + 1 : 0), 1), titleJustify = options.titleJustify || ((type & 512) || options.failed ? 'center' : formatTitle.justify);
679
677
  if (Array.isArray(value)) {
680
678
  hint = value[1] ?? '';
681
679
  value = value[0];
@@ -724,7 +722,7 @@ class Module extends EventEmitter {
724
722
  indent = match[1];
725
723
  if (bgAltColor) {
726
724
  try {
727
- indent = (bgAltColor[0] === '#' ? chalk.bgHex(bgAltColor) : chalk[bgAltColor])(indent);
725
+ indent = (bgAltColor.startsWith('#') ? chalk.bgHex(bgAltColor) : chalk[bgAltColor])(indent);
728
726
  }
729
727
  catch {
730
728
  }
@@ -747,10 +745,10 @@ class Module extends EventEmitter {
747
745
  try {
748
746
  let current = bold ? chalk.bold : chalk;
749
747
  if (typeof color === 'string' && color.length > 1) {
750
- current = color[0] === '#' ? current.hex(color) : current[color];
748
+ current = color.startsWith('#') ? current.hex(color) : current[color];
751
749
  }
752
750
  if (typeof bgColor === 'string' && bgColor.length > 1) {
753
- current = bgColor[0] === '#' ? current.bgHex(bgColor) : current[bgColor];
751
+ current = bgColor.startsWith('#') ? current.bgHex(bgColor) : current[bgColor];
754
752
  }
755
753
  return indent + current(content);
756
754
  }
@@ -759,52 +757,52 @@ class Module extends EventEmitter {
759
757
  }
760
758
  return indent + (bold ? chalk.bold(content) : content);
761
759
  };
762
- if (type === 0 /* LOG_VALUE.UNKNOWN */) {
760
+ if (type === 0) {
763
761
  checkColorOptions(type, SETTINGS.unknown, options);
764
762
  }
765
763
  else {
766
- if (type & 4096 /* LOG_VALUE.EXEC */) {
764
+ if (type & 4096) {
767
765
  checkColorOptions(type, SETTINGS.exec, options);
768
766
  }
769
- else if (type & 32 /* LOG_VALUE.FILE */) {
767
+ else if (type & 32) {
770
768
  checkColorOptions(type, SETTINGS.file, options);
771
769
  }
772
- else if (type & 2 /* LOG_VALUE.NODE */) {
770
+ else if (type & 2) {
773
771
  if (!checkColorOptions(type, SETTINGS.node, options)) {
774
772
  applyStyle(options, this.LOG_STYLE_REVERSE);
775
773
  options.hintColor || (options.hintColor = 'yellow');
776
774
  }
777
775
  titleJustify = 'center';
778
776
  }
779
- else if (type & 1 /* LOG_VALUE.SYSTEM */) {
777
+ else if (type & 1) {
780
778
  checkColorOptions(type, SETTINGS.system, options);
781
779
  if (options.titleBgColor) {
782
780
  titleJustify = 'center';
783
781
  }
784
782
  }
785
- if (type & 1024 /* LOG_VALUE.HTTP */) {
783
+ if (type & 1024) {
786
784
  checkColorOptions(type, SETTINGS.http, options);
787
785
  }
788
- else if (type & 64 /* LOG_VALUE.CLOUD */) {
786
+ else if (type & 64) {
789
787
  checkColorOptions(type, SETTINGS.cloud, options);
790
788
  }
791
- else if (type & 65536 /* LOG_VALUE.DB */) {
789
+ else if (type & 65536) {
792
790
  checkColorOptions(type, SETTINGS.db, options);
793
791
  }
794
- else if (type & 16 /* LOG_VALUE.WATCH */) {
792
+ else if (type & 16) {
795
793
  checkColorOptions(type, SETTINGS.watch, options);
796
794
  titleJustify = 'center';
797
795
  }
798
- else if (type & 2048 /* LOG_VALUE.IMAGE */) {
796
+ else if (type & 2048) {
799
797
  checkColorOptions(type, SETTINGS.image, options);
800
798
  }
801
- else if (type & 8 /* LOG_VALUE.COMPRESS */) {
799
+ else if (type & 8) {
802
800
  checkColorOptions(type, SETTINGS.compress, options);
803
801
  }
804
- else if ((type & 4 /* LOG_VALUE.PROCESS */) && !options.titleColor && !checkColorOptions(type, SETTINGS.process, options)) {
802
+ else if ((type & 4) && !options.titleColor && !checkColorOptions(type, SETTINGS.process, options)) {
805
803
  options.titleColor = 'magenta';
806
804
  }
807
- if (type & 128 /* LOG_VALUE.TIME_ELAPSED */) {
805
+ if (type & 128) {
808
806
  if (!checkColorOptions(type, SETTINGS.time_elapsed, options)) {
809
807
  options.hintColor || (options.hintColor = 'yellow');
810
808
  }
@@ -812,7 +810,7 @@ class Module extends EventEmitter {
812
810
  titleJustify = 'center';
813
811
  }
814
812
  }
815
- else if (type & 256 /* LOG_VALUE.TIME_PROCESS */) {
813
+ else if (type & 256) {
816
814
  if (options.failed) {
817
815
  options.messageBgColor || (options.messageBgColor = 'bgGrey');
818
816
  }
@@ -851,8 +849,8 @@ class Module extends EventEmitter {
851
849
  else if (title) {
852
850
  value = getValue();
853
851
  }
854
- const unit = options.messageUnit ? type & 256 /* LOG_VALUE.TIME_PROCESS */ ? options.messageUnit.padStart(options.messageUnitMinWidth || 0) : options.messageUnit : '';
855
- const getMessage = (m, u) => type & 256 /* LOG_VALUE.TIME_PROCESS */ && messageUnitIndent === undefined ? (u + m).trimEnd() : u ? (m + (messageUnitIndent === undefined ? ' ' : '') + u).trimStart() : m;
852
+ const unit = options.messageUnit ? type & 256 ? options.messageUnit.padStart(options.messageUnitMinWidth || 0) : options.messageUnit : '';
853
+ const getMessage = (m, u) => type & 256 && messageUnitIndent === undefined ? (u + m).trimEnd() : u ? (m + (messageUnitIndent === undefined ? ' ' : '') + u).trimStart() : m;
856
854
  if (coloring) {
857
855
  let { titleColor, titleBgColor, valueColor, valueBgColor, valueBold, messageWidth, messageColor, messageBgColor, messageBold } = options;
858
856
  if (!titleColor && !titleBgColor) {
@@ -912,12 +910,11 @@ class Module extends EventEmitter {
912
910
  if (BROADCAST_OUT) {
913
911
  try {
914
912
  options = { ...options, broadcastId, timeStamp: getTimeStamp(options, false) };
915
- // @ts-ignore
916
- if (BROADCAST_OUT["__cjs__" /* INTERNAL.CJS */]) {
913
+ if (BROADCAST_OUT["__cjs__"]) {
917
914
  BROADCAST_OUT(output, options);
918
915
  }
919
916
  else {
920
- 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]);
917
+ BROADCAST_OUT.apply(VALUES["node.process.inline"] ? process : null, VALUES["node.require.inline"] ? [output, options, require] : [output, options]);
921
918
  }
922
919
  }
923
920
  catch {
@@ -936,7 +933,7 @@ class Module extends EventEmitter {
936
933
  LOG_EMPTYLINE = true;
937
934
  }
938
935
  }
939
- if (type & 512 /* LOG_VALUE.FAIL */) {
936
+ if (type & 512) {
940
937
  process.stderr.write((!LOG_NEWLINE ? '\n' : '') + output + '\n');
941
938
  }
942
939
  else if (typeof options.progressBar === 'boolean' && typeof PROCESS_STDOUT.clearLine === 'function') {
@@ -969,7 +966,7 @@ class Module extends EventEmitter {
969
966
  }
970
967
  options = {};
971
968
  }
972
- this.formatMessage(((type || 1 /* LOG_VALUE.SYSTEM */) | 512 /* LOG_VALUE.FAIL */), "FAIL!" /* ERR_MESSAGE.FAIL */, value, message, applyStyle(options, this.LOG_STYLE_FAIL));
969
+ this.formatMessage(((type || 1) | 512), "FAIL!", value, message, applyStyle(options, this.LOG_STYLE_FAIL));
973
970
  }
974
971
  static parseFunction(value, absolute, sync = true) {
975
972
  let context, requireExt, external;
@@ -977,7 +974,7 @@ class Module extends EventEmitter {
977
974
  ({ context, requireExt, external, absolute, sync = true } = absolute);
978
975
  }
979
976
  if (requireExt === undefined || requireExt === true) {
980
- requireExt = VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */];
977
+ requireExt = VALUES["node.require.ext"];
981
978
  }
982
979
  let result = (0, types_1.asFunction)(value, sync);
983
980
  if (!result && (0, types_1.isString)(value)) {
@@ -986,7 +983,7 @@ class Module extends EventEmitter {
986
983
  location = location.substring(4);
987
984
  }
988
985
  else if (pathname = absolute && path.isAbsolute(location) ? location : this.fromLocalPath(location)) {
989
- if (requireExt && VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] && hasString(requireExt, getExtension(pathname))) {
986
+ if (requireExt && VALUES["node.require.ext"] && hasString(requireExt, getExtension(pathname))) {
990
987
  try {
991
988
  result = checkFunction(require(pathname));
992
989
  }
@@ -998,13 +995,12 @@ class Module extends EventEmitter {
998
995
  result = (0, types_1.asFunction)(fs.readFileSync(pathname, 'utf-8'), sync);
999
996
  }
1000
997
  catch (err) {
1001
- this.writeFail(["Unable to read file" /* ERR_MESSAGE.READ_FILE */, value], err, 32 /* LOG_VALUE.FILE */);
998
+ this.writeFail(["Unable to read file", value], err, 32);
1002
999
  }
1003
1000
  }
1004
1001
  }
1005
- if (external && !pathname && VALUES["node.require.npm" /* KEY_NAME.NODE_REQUIRE_NPM */] && /^(?:@[a-z\d-*~][a-z\d-*._~]*\/)?[a-z\d-~][a-z\d-._~]*(?:\/.*)?$/.test(location)) {
1002
+ if (external && !pathname && VALUES["node.require.npm"] && /^(?:@[a-z\d-*~][a-z\d-*._~]*\/)?[a-z\d-~][a-z\d-._~]*(?:\/.*)?$/.test(location)) {
1006
1003
  try {
1007
- // @ts-ignore
1008
1004
  result = checkFunction(require(types_1.IMPORT_MAP[location] || location));
1009
1005
  }
1010
1006
  catch {
@@ -1063,7 +1059,7 @@ class Module extends EventEmitter {
1063
1059
  break;
1064
1060
  }
1065
1061
  if (cacheKey === 'throws') {
1066
- throw new Error("Not able to cache" /* ERR_MESSAGE.NOT_CACHEABLE */);
1062
+ throw new Error("Not able to cache");
1067
1063
  }
1068
1064
  return cacheKey ? (0, types_1.generateUUID)() : '';
1069
1065
  }
@@ -1260,7 +1256,7 @@ class Module extends EventEmitter {
1260
1256
  let result = paths[0] || '';
1261
1257
  for (let i = 1; i < paths.length; ++i) {
1262
1258
  const trailing = paths[i];
1263
- result += (trailing[0] !== '/' && result[result.length - 1] !== '/' ? '/' : '') + trailing;
1259
+ result += (!trailing.startsWith('/') && !result.endsWith('/') ? '/' : '') + trailing;
1264
1260
  }
1265
1261
  return result;
1266
1262
  }
@@ -1284,7 +1280,7 @@ class Module extends EventEmitter {
1284
1280
  return path.join(PROCESS_CWD, value);
1285
1281
  }
1286
1282
  if (ch === '~' && value[1] === '/') {
1287
- return VALUES["permission.home_read" /* KEY_NAME.PERMISSION_HOMEREAD */] ? path.join(OS_HOMEDIR, value.substring(2)) : '';
1283
+ return VALUES["permission.home_read"] ? path.join(OS_HOMEDIR, value.substring(2)) : '';
1288
1284
  }
1289
1285
  try {
1290
1286
  if (fs.existsSync(value = path.join(PROCESS_CWD, value))) {
@@ -1308,7 +1304,7 @@ class Module extends EventEmitter {
1308
1304
  fs.unlinkSync(outDir);
1309
1305
  }
1310
1306
  catch {
1311
- this.formatMessage(32 /* LOG_VALUE.FILE */, 'WARN', "Unable to overwrite file" /* ERR_MESSAGE.OVERWRITE_FILE */, value, { ...this.LOG_STYLE_WARN });
1307
+ this.formatMessage(32, 'WARN', "Unable to overwrite file", value, { ...this.LOG_STYLE_WARN });
1312
1308
  return false;
1313
1309
  }
1314
1310
  }
@@ -1325,7 +1321,7 @@ class Module extends EventEmitter {
1325
1321
  return tryCreateDir(outDir);
1326
1322
  }
1327
1323
  catch (err) {
1328
- this.writeFail(["Unable to create directory" /* ERR_MESSAGE.CREATE_DIRECTORY */, value], err, 32 /* LOG_VALUE.FILE */);
1324
+ this.writeFail(["Unable to create directory", value], err, 32);
1329
1325
  }
1330
1326
  }
1331
1327
  return false;
@@ -1347,19 +1343,19 @@ class Module extends EventEmitter {
1347
1343
  }
1348
1344
  }
1349
1345
  catch (err) {
1350
- this.writeFail(["Unable to remove directory" /* ERR_MESSAGE.REMOVE_DIRECTORY */, value], err, 32 /* LOG_VALUE.FILE */);
1346
+ this.writeFail(["Unable to remove directory", value], err, 32);
1351
1347
  }
1352
1348
  }
1353
1349
  return false;
1354
1350
  }
1355
- static copyDir(src, dest, move, recursive = true) {
1351
+ static async copyDir(src, dest, move, recursive = true) {
1356
1352
  const srcOut = sanitizePath(asFile(src));
1357
1353
  if (!srcOut || !this.isDir(srcOut)) {
1358
- return Promise.reject(errorDirectory(asFile(src) || "Unknown" /* ERR_MESSAGE.UNKNOWN */));
1354
+ return Promise.reject(errorDirectory(asFile(src) || "Unknown"));
1359
1355
  }
1360
1356
  const destOut = sanitizePath(asFile(dest));
1361
1357
  if (!destOut || !this.createDir(destOut)) {
1362
- return Promise.reject(errorDirectory(asFile(dest) || "Unknown" /* ERR_MESSAGE.UNKNOWN */));
1358
+ return Promise.reject(errorDirectory(asFile(dest) || "Unknown"));
1363
1359
  }
1364
1360
  let symFile, symDir, ignoreFile, ignoreDir, silent, overwrite;
1365
1361
  if ((0, types_1.isObject)(move)) {
@@ -1430,7 +1426,7 @@ class Module extends EventEmitter {
1430
1426
  .catch(err => {
1431
1427
  failed.push(srcPath);
1432
1428
  if (!silent) {
1433
- 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 */);
1429
+ this.writeFail([move ? "Unable to move file" : "Unable to copy file", path.basename(srcPath)], err, 32);
1434
1430
  }
1435
1431
  }));
1436
1432
  }
@@ -1445,7 +1441,7 @@ class Module extends EventEmitter {
1445
1441
  catch (err) {
1446
1442
  failed.push(srcDir);
1447
1443
  if (!silent) {
1448
- this.writeFail(["Unable to read directory" /* ERR_MESSAGE.READ_DIRECTORY */, path.basename(srcDir)], err, 32 /* LOG_VALUE.FILE */);
1444
+ this.writeFail(["Unable to read directory", path.basename(srcDir)], err, 32);
1449
1445
  }
1450
1446
  }
1451
1447
  }
@@ -1497,7 +1493,7 @@ class Module extends EventEmitter {
1497
1493
  }
1498
1494
  catch (error) {
1499
1495
  if (copied) {
1500
- 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 });
1496
+ this.formatMessage(32, 'WARN', ["Unable to delete file", path.basename(src instanceof URL ? url.fileURLToPath(src) : src)], error, { ...this.LOG_STYLE_WARN });
1501
1497
  throws = false;
1502
1498
  }
1503
1499
  }
@@ -1527,7 +1523,7 @@ class Module extends EventEmitter {
1527
1523
  return result;
1528
1524
  }
1529
1525
  catch (err) {
1530
- this.writeFail(["Unable to read file" /* ERR_MESSAGE.READ_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
1526
+ this.writeFail(["Unable to read file", path.basename(src)], err, 32);
1531
1527
  }
1532
1528
  }
1533
1529
  return '';
@@ -1547,19 +1543,19 @@ class Module extends EventEmitter {
1547
1543
  return result;
1548
1544
  }
1549
1545
  catch (err) {
1550
- this.writeFail(["Unable to read file" /* ERR_MESSAGE.READ_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
1546
+ this.writeFail(["Unable to read file", path.basename(src)], err, 32);
1551
1547
  }
1552
1548
  }
1553
1549
  return null;
1554
1550
  }
1555
- static resolveMime(data) {
1551
+ static async resolveMime(data) {
1556
1552
  return typeof data === 'string' ? filetype.fromFile(data) : filetype.fromBuffer(data);
1557
1553
  }
1558
1554
  static lookupMime(value, extension) {
1559
1555
  return (extension ? mime.extension(value) : mime.lookup(value)) || '';
1560
1556
  }
1561
1557
  static initCpuUsage(instance) {
1562
- if (!VALUES["node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */]) {
1558
+ if (!VALUES["node.process.cpu_usage"]) {
1563
1559
  return { user: 0, system: 0 };
1564
1560
  }
1565
1561
  const result = process.cpuUsage();
@@ -1570,7 +1566,7 @@ class Module extends EventEmitter {
1570
1566
  return result;
1571
1567
  }
1572
1568
  static getCpuUsage(start, format) {
1573
- if (VALUES["node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */]) {
1569
+ if (VALUES["node.process.cpu_usage"]) {
1574
1570
  let value = CACHE_CPU.get(start);
1575
1571
  if (value === undefined) {
1576
1572
  CACHE_CPU.set(start, getCpuTimes());
@@ -1588,7 +1584,7 @@ class Module extends EventEmitter {
1588
1584
  return format ? '' : 0;
1589
1585
  }
1590
1586
  static getMemUsage(format) {
1591
- if (!VALUES["node.process.memory_usage" /* KEY_NAME.NODE_PROCESS_MEMORYUSAGE */]) {
1587
+ if (!VALUES["node.process.memory_usage"]) {
1592
1588
  return format ? '' : 0;
1593
1589
  }
1594
1590
  const usage = process.memoryUsage();
@@ -1626,24 +1622,24 @@ class Module extends EventEmitter {
1626
1622
  if (!cpu_single_core) {
1627
1623
  usage /= CPU_CORETOTAL;
1628
1624
  }
1629
- if (usage + 0.005 /* CPU_MEM.BAR_100_OFFSET */ >= 1) {
1625
+ if (usage + 0.005 >= 1) {
1630
1626
  usage = 1;
1631
1627
  }
1632
- let bar = 20 /* CPU_MEM.BAR_LENGTH */, red = 0.9 /* CPU_MEM.BAR_RED */, yellow = 0.75 /* CPU_MEM.BAR_YELLOW */;
1628
+ let bar = 20, red = 0.9, yellow = 0.75;
1633
1629
  if (typeof cpu_bar === 'number') {
1634
1630
  bar = cpu_bar;
1635
1631
  }
1636
- else if (Array.isArray(cpu_bar) && cpu_bar[0] >= 10 /* CPU_MEM.BAR_MIN_LENGTH */) {
1632
+ else if (Array.isArray(cpu_bar) && cpu_bar[0] >= 10) {
1637
1633
  let r, y;
1638
- [bar, r = 0.9 /* CPU_MEM.BAR_RED */, y = 0.75 /* CPU_MEM.BAR_YELLOW */] = cpu_bar;
1634
+ [bar, r = 0.9, y = 0.75] = cpu_bar;
1639
1635
  if (r > 0 && r < 1 && y > 0 && y < 1 && y < r) {
1640
1636
  red = r;
1641
1637
  yellow = y;
1642
1638
  }
1643
1639
  }
1644
- const unit = Math.max(bar, 10 /* CPU_MEM.BAR_MIN_LENGTH */);
1640
+ const unit = Math.max(bar, 10);
1645
1641
  const length = Math.floor(usage * unit);
1646
- const hint = usage === 1 ? "MAX" /* CPU_MEM.BAR_100 */ : usage < 0 ? "N/A" /* CPU_MEM.BAR_UNDER */ : formatPercent(usage, 2);
1642
+ const hint = usage === 1 ? "MAX" : usage < 0 ? "N/A" : formatPercent(usage, 2);
1647
1643
  result += chalk[usage >= red ? 'bgRed' : usage >= yellow ? 'bgYellow' : 'bgBlue'].white(':'.repeat(length)) + chalk.bgGrey.white(':'.repeat(unit - length)) + (hint ? chalk.bgWhite.grey(` ${hint} `) : '');
1648
1644
  }
1649
1645
  else if (usage) {
@@ -1838,7 +1834,7 @@ class Module extends EventEmitter {
1838
1834
  return true;
1839
1835
  }
1840
1836
  static sanitizeCmd(value) {
1841
- if (value.indexOf(' ') !== -1) {
1837
+ if (value.includes(' ')) {
1842
1838
  return PLATFORM_WIN32 ? wrapQuote(value) : value.replace(/[ ]/g, '\\ ');
1843
1839
  }
1844
1840
  return value;
@@ -1869,7 +1865,7 @@ class Module extends EventEmitter {
1869
1865
  }
1870
1866
  value = quoted[2];
1871
1867
  }
1872
- if (value.indexOf(' ') !== -1) {
1868
+ if (value.includes(' ')) {
1873
1869
  value = wrapQuote(value);
1874
1870
  }
1875
1871
  }
@@ -1904,7 +1900,7 @@ class Module extends EventEmitter {
1904
1900
  }
1905
1901
  return (typeof values === 'string' ? result[0] : result);
1906
1902
  }
1907
- static purgeMemory(percent = 1, limit = 0) {
1903
+ static async purgeMemory(percent = 1, limit = 0) {
1908
1904
  if (typeof limit === 'boolean') {
1909
1905
  limit = 0;
1910
1906
  }
@@ -1942,22 +1938,22 @@ class Module extends EventEmitter {
1942
1938
  static canWrite(name) {
1943
1939
  switch (name) {
1944
1940
  case 'temp':
1945
- return VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */];
1941
+ return VALUES["temp.write"];
1946
1942
  case 'home':
1947
- return VALUES["permission.home_write" /* KEY_NAME.PERMISSION_HOMEWRITE */];
1943
+ return VALUES["permission.home_write"];
1948
1944
  default:
1949
1945
  return false;
1950
1946
  }
1951
1947
  }
1952
1948
  static loadSettings(settings, password) {
1953
1949
  var _h;
1954
- const current = VALUES["process.password" /* KEY_NAME.PROCESS_PASSWORD */];
1950
+ const current = VALUES["process.password"];
1955
1951
  if (current) {
1956
1952
  const proc = settings.process || {};
1957
1953
  if (!password && !(password = proc.password)) {
1958
1954
  return false;
1959
1955
  }
1960
- const algorithm = VALUES["process.cipher.algorithm" /* KEY_NAME.PROCESS_CIPHER_ALGORITHM */];
1956
+ const algorithm = VALUES["process.cipher.algorithm"];
1961
1957
  if (algorithm) {
1962
1958
  password = encryptMessage(password, proc.cipher, algorithm);
1963
1959
  }
@@ -1966,7 +1962,7 @@ class Module extends EventEmitter {
1966
1962
  }
1967
1963
  }
1968
1964
  else if ((0, types_1.isString)(password)) {
1969
- VALUES["process.password" /* KEY_NAME.PROCESS_PASSWORD */] = encryptMessage(password, settings.process?.cipher);
1965
+ VALUES["process.password"] = encryptMessage(password, settings.process?.cipher);
1970
1966
  }
1971
1967
  const { temp, node, permission, memory, error, logger } = settings;
1972
1968
  if ((0, types_1.isPlainObject)(node)) {
@@ -1974,51 +1970,51 @@ class Module extends EventEmitter {
1974
1970
  if ((0, types_1.isPlainObject)(proc)) {
1975
1971
  const { cpu_usage, memory_usage, inline } = proc;
1976
1972
  if (typeof cpu_usage === 'boolean') {
1977
- VALUES["node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */] = cpu_usage;
1973
+ VALUES["node.process.cpu_usage"] = cpu_usage;
1978
1974
  }
1979
1975
  if (typeof memory_usage === 'boolean') {
1980
- VALUES["node.process.memory_usage" /* KEY_NAME.NODE_PROCESS_MEMORYUSAGE */] = memory_usage;
1976
+ VALUES["node.process.memory_usage"] = memory_usage;
1981
1977
  }
1982
1978
  if (typeof inline === 'boolean') {
1983
- VALUES["node.process.inline" /* KEY_NAME.NODE_PROCESS_INLINE */] = inline;
1979
+ VALUES["node.process.inline"] = inline;
1984
1980
  }
1985
1981
  }
1986
1982
  if ((0, types_1.isPlainObject)(req)) {
1987
1983
  const { ext, npm, inline } = req;
1988
1984
  if (!ext) {
1989
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = '';
1985
+ VALUES["node.require.ext"] = '';
1990
1986
  }
1991
1987
  else if (typeof ext === 'string') {
1992
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = ext.trim().toLowerCase();
1988
+ VALUES["node.require.ext"] = ext.trim().toLowerCase();
1993
1989
  }
1994
1990
  else if (Array.isArray(ext)) {
1995
1991
  const items = ext.map(value => (0, types_1.isString)(value) ? value.trim().toLowerCase() : '').filter(value => value);
1996
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = items.length ? items : '';
1992
+ VALUES["node.require.ext"] = items.length ? items : '';
1997
1993
  }
1998
1994
  else {
1999
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = 'cjs';
1995
+ VALUES["node.require.ext"] = 'cjs';
2000
1996
  }
2001
1997
  if (typeof npm === 'boolean') {
2002
- VALUES["node.require.npm" /* KEY_NAME.NODE_REQUIRE_NPM */] = npm;
1998
+ VALUES["node.require.npm"] = npm;
2003
1999
  }
2004
2000
  if (typeof inline === 'boolean') {
2005
- VALUES["node.require.inline" /* KEY_NAME.NODE_REQUIRE_INLINE */] = inline;
2001
+ VALUES["node.require.inline"] = inline;
2006
2002
  }
2007
2003
  }
2008
2004
  }
2009
2005
  if ((0, types_1.isPlainObject)(settings.process)) {
2010
2006
  const { env, cipher, password: pwd } = settings.process;
2011
2007
  if (env && typeof env.apply === 'boolean') {
2012
- VALUES["process.env.apply" /* KEY_NAME.PROCESS_ENV_APPLY */] = env.apply;
2008
+ VALUES["process.env.apply"] = env.apply;
2013
2009
  }
2014
2010
  if ((0, types_1.isString)(pwd)) {
2015
- VALUES[_h = "process.password" /* KEY_NAME.PROCESS_PASSWORD */] || (VALUES[_h] = encryptMessage(pwd, cipher));
2011
+ VALUES[_h = "process.password"] || (VALUES[_h] = encryptMessage(pwd, cipher));
2016
2012
  }
2017
2013
  }
2018
2014
  if (memory && (0, types_1.isPlainObject)(memory.settings)) {
2019
2015
  const users = memory.settings.users;
2020
2016
  if (typeof users === 'boolean' || Array.isArray(users)) {
2021
- VALUES["memory.settings.users" /* KEY_NAME.MEMORY_SETTINGS_USERS */] = users;
2017
+ VALUES["memory.settings.users"] = users;
2022
2018
  }
2023
2019
  }
2024
2020
  if ((0, types_1.isPlainObject)(logger)) {
@@ -2029,7 +2025,7 @@ class Module extends EventEmitter {
2029
2025
  if (level !== undefined) {
2030
2026
  const value = (0, types_1.isString)(level) ? types_1.STATUS_TYPE[level.trim().toUpperCase()] : level;
2031
2027
  if (value >= -1 && value <= types_1.STATUS_TYPE.TRACE) {
2032
- VALUES["logger.level" /* KEY_NAME.LOGGER_LEVEL */] = value;
2028
+ VALUES["logger.level"] = value;
2033
2029
  }
2034
2030
  }
2035
2031
  if (Array.isArray(production)) {
@@ -2153,7 +2149,7 @@ class Module extends EventEmitter {
2153
2149
  }
2154
2150
  }
2155
2151
  if (broadcast?.out) {
2156
- VALUES["broadcast.out" /* KEY_NAME.BROADCAST_OUT */] = this.parseFunction(broadcast.out, { external: true, absolute: true });
2152
+ VALUES["broadcast.out"] = this.parseFunction(broadcast.out, { external: true, absolute: true });
2157
2153
  }
2158
2154
  if (stack_trace && stack_trace !== true && +stack_trace > 0) {
2159
2155
  Error.stackTraceLimit = +stack_trace;
@@ -2161,23 +2157,32 @@ class Module extends EventEmitter {
2161
2157
  }
2162
2158
  if (error) {
2163
2159
  if (error.out) {
2164
- VALUES["error.out" /* KEY_NAME.ERROR_OUT */] = this.parseFunction(error.out, { external: true, absolute: true });
2160
+ VALUES["error.out"] = this.parseFunction(error.out, { external: true, absolute: true });
2165
2161
  }
2166
2162
  if (typeof error.fatal === 'boolean') {
2167
- VALUES["error.fatal" /* KEY_NAME.ERROR_FATAL */] = error.fatal;
2163
+ VALUES["error.fatal"] = error.fatal;
2168
2164
  }
2169
2165
  }
2170
- if (permission && Array.isArray(permission.process_exec)) {
2171
- 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 => {
2172
- if (typeof exec === 'string') {
2173
- return exec.trim();
2174
- }
2175
- if (typeof exec.warn === 'string') {
2176
- exec.warn = [exec.warn];
2177
- }
2178
- exec.command = exec.command.trim();
2179
- return exec;
2180
- });
2166
+ if (permission) {
2167
+ const { home_read, home_write } = permission;
2168
+ if (typeof home_read === 'boolean') {
2169
+ VALUES["permission.home_read"] = home_read;
2170
+ }
2171
+ if (typeof home_write === 'boolean') {
2172
+ VALUES["permission.home_write"] = home_write;
2173
+ }
2174
+ if (Array.isArray(permission.process_exec)) {
2175
+ VALUES["permission.process_exec"] = permission.process_exec.filter(item => typeof item === 'string' || (0, types_1.isObject)(item) && typeof item.command === 'string').map(exec => {
2176
+ if (typeof exec === 'string') {
2177
+ return exec.trim();
2178
+ }
2179
+ if (typeof exec.warn === 'string') {
2180
+ exec.warn = [exec.warn];
2181
+ }
2182
+ exec.command = exec.command.trim();
2183
+ return exec;
2184
+ });
2185
+ }
2181
2186
  }
2182
2187
  {
2183
2188
  let dir = settings.temp_dir, write;
@@ -2191,16 +2196,16 @@ class Module extends EventEmitter {
2191
2196
  dir = dir.substring(ensureDir(PROCESS_CWD).length);
2192
2197
  }
2193
2198
  else {
2194
- this.formatMessage(1 /* LOG_VALUE.SYSTEM */, 'WARN', 'Temp directory can only be relative', dir, { ...this.LOG_STYLE_WARN, newline: true });
2199
+ this.formatMessage(1, 'WARN', 'Temp directory can only be relative', dir, { ...this.LOG_STYLE_WARN, newline: true });
2195
2200
  dir = undefined;
2196
2201
  }
2197
2202
  }
2198
2203
  if (!(0, types_1.isString)(dir)) {
2199
- dir = VALUES["temp.dir" /* KEY_NAME.TEMP_DIR */];
2204
+ dir = VALUES["temp.dir"];
2200
2205
  }
2201
2206
  if (typeof write === 'boolean') {
2202
- modified = VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */] !== write;
2203
- VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */] = write;
2207
+ modified = VALUES["temp.write"] !== write;
2208
+ VALUES["temp.write"] = write;
2204
2209
  }
2205
2210
  do {
2206
2211
  const [output, index] = tryIncrementDir(path.join(PROCESS_CWD, dir), 5);
@@ -2208,19 +2213,19 @@ class Module extends EventEmitter {
2208
2213
  if (index > 0) {
2209
2214
  dir = trimDir(dir) + '_' + index;
2210
2215
  }
2211
- if (dir !== VALUES["temp.dir" /* KEY_NAME.TEMP_DIR */]) {
2212
- VALUES["temp.dir" /* KEY_NAME.TEMP_DIR */] = dir;
2216
+ if (dir !== VALUES["temp.dir"]) {
2217
+ VALUES["temp.dir"] = dir;
2213
2218
  modified = true;
2214
2219
  }
2215
2220
  (0, types_1.setTempDir)(TEMP_DIR = output);
2216
2221
  break;
2217
2222
  }
2218
2223
  if (output instanceof Error) {
2219
- this.writeFail(["Unable to create temp directory" /* ERR_MESSAGE.TEMP_DIRECTORY */, dir], output, 32 /* LOG_VALUE.FILE */);
2224
+ this.writeFail(["Unable to create temp directory", dir], output, 32);
2220
2225
  }
2221
- } while ((dir !== "tmp" /* INTERNAL.TEMP_DIR */) && (dir = "tmp" /* INTERNAL.TEMP_DIR */));
2226
+ } while ((dir !== "tmp") && (dir = "tmp"));
2222
2227
  if (modified) {
2223
- 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 });
2228
+ this.formatMessage(1, 'TEMP', ["Directory was modified", dir], TEMP_DIR + (VALUES["temp.write"] ? ' - writeable' : ''), { ...this.LOG_STYLE_NOTICE, newline: true });
2224
2229
  }
2225
2230
  settings.temp_dir = dir;
2226
2231
  if ((0, types_1.isPlainObject)(temp)) {
@@ -2273,7 +2278,7 @@ class Module extends EventEmitter {
2273
2278
  const [output] = tryIncrementDir(result, increment);
2274
2279
  if (!(0, types_1.isString)(output)) {
2275
2280
  if (output instanceof Error) {
2276
- this.writeFail(["Unable to create temp directory" /* ERR_MESSAGE.TEMP_DIRECTORY */, result], output, 32 /* LOG_VALUE.FILE */);
2281
+ this.writeFail(["Unable to create temp directory", result], output, 32);
2277
2282
  }
2278
2283
  return '';
2279
2284
  }
@@ -2307,7 +2312,7 @@ class Module extends EventEmitter {
2307
2312
  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()))) {
2308
2313
  return true;
2309
2314
  }
2310
- return VALUES["permission.home_read" /* KEY_NAME.PERMISSION_HOMEREAD */] && withinDir(uri, OS_HOMEDIR);
2315
+ return VALUES["permission.home_read"] && withinDir(uri, OS_HOMEDIR);
2311
2316
  }
2312
2317
  canWrite(uri, options) {
2313
2318
  let permission = this.permission, ownPermissionOnly = false;
@@ -2328,12 +2333,12 @@ class Module extends EventEmitter {
2328
2333
  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()))) {
2329
2334
  return true;
2330
2335
  }
2331
- return VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */] && withinDir(uri, TEMP_DIR) || VALUES["permission.home_write" /* KEY_NAME.PERMISSION_HOMEWRITE */] && withinDir(uri, OS_HOMEDIR);
2336
+ return VALUES["temp.write"] && withinDir(uri, TEMP_DIR) || VALUES["permission.home_write"] && withinDir(uri, OS_HOMEDIR);
2332
2337
  }
2333
2338
  readFile(src, options = {}, callback) {
2334
2339
  let promises, outSrc;
2335
2340
  [options, promises, callback] = parseFileArgs(options, callback);
2336
- if (outSrc = hasFileSystem.call(this, 0 /* FILE_SYSTEM.READ */, src, options)) {
2341
+ if (outSrc = hasFileSystem.call(this, 0, src, options)) {
2337
2342
  const { requireExt, cache } = options;
2338
2343
  const encoding = options.encoding && (0, types_1.getEncoding)(options.encoding);
2339
2344
  const setCache = (data, cjs) => {
@@ -2345,7 +2350,7 @@ class Module extends EventEmitter {
2345
2350
  }
2346
2351
  };
2347
2352
  let result;
2348
- 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))) {
2353
+ if (requireExt && VALUES["node.require.ext"] && hasString(requireExt === true ? VALUES["node.require.ext"] : requireExt, getExtension(src))) {
2349
2354
  if (cache) {
2350
2355
  result = getCacheItem(CACHE_READCJS, outSrc);
2351
2356
  }
@@ -2392,7 +2397,7 @@ class Module extends EventEmitter {
2392
2397
  return result;
2393
2398
  }
2394
2399
  catch (err) {
2395
- this.writeFail(["Unable to read file" /* ERR_MESSAGE.READ_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
2400
+ this.writeFail(["Unable to read file", path.basename(src)], err, 32);
2396
2401
  }
2397
2402
  }
2398
2403
  else if (promises) {
@@ -2405,7 +2410,7 @@ class Module extends EventEmitter {
2405
2410
  writeFile(src, data, options = {}, callback) {
2406
2411
  let promises, outSrc;
2407
2412
  [options, promises, callback] = parseFileArgs(options, callback);
2408
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options, true, options.overwrite)) {
2413
+ if (outSrc = hasFileSystem.call(this, 1, src, options, true, options.overwrite)) {
2409
2414
  if (promises) {
2410
2415
  return fs.promises.writeFile(outSrc, data, options.encoding).then(() => {
2411
2416
  this.emit('file:write', outSrc, options);
@@ -2427,7 +2432,7 @@ class Module extends EventEmitter {
2427
2432
  return true;
2428
2433
  }
2429
2434
  catch (err) {
2430
- this.writeFail(["Unable to write file" /* ERR_MESSAGE.WRITE_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
2435
+ this.writeFail(["Unable to write file", path.basename(src)], err, 32);
2431
2436
  }
2432
2437
  }
2433
2438
  else if (promises) {
@@ -2442,7 +2447,7 @@ class Module extends EventEmitter {
2442
2447
  deleteFile(src, options = {}, callback) {
2443
2448
  let promises, outSrc;
2444
2449
  [options, promises, callback] = parseFileArgs(options, callback);
2445
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options)) {
2450
+ if (outSrc = hasFileSystem.call(this, 1, src, options)) {
2446
2451
  if (promises) {
2447
2452
  return fs.promises.unlink(outSrc).then(() => {
2448
2453
  this.emit('file:delete', outSrc, options);
@@ -2463,7 +2468,7 @@ class Module extends EventEmitter {
2463
2468
  }
2464
2469
  catch (err) {
2465
2470
  if (!Module.isErrorCode(err, 'ENOENT')) {
2466
- this.writeFail(["Unable to delete file" /* ERR_MESSAGE.DELETE_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
2471
+ this.writeFail(["Unable to delete file", path.basename(src)], err, 32);
2467
2472
  return false;
2468
2473
  }
2469
2474
  }
@@ -2482,7 +2487,7 @@ class Module extends EventEmitter {
2482
2487
  copyFile(src, dest, options = {}, callback) {
2483
2488
  let promises, outSrc, outDest;
2484
2489
  [options, promises, callback] = parseFileArgs(options, callback);
2485
- if ((outSrc = hasFileSystem.call(this, 0 /* FILE_SYSTEM.READ */, src, options)) && (outDest = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, dest, options, true, options.overwrite))) {
2490
+ if ((outSrc = hasFileSystem.call(this, 0, src, options)) && (outDest = hasFileSystem.call(this, 1, dest, options, true, options.overwrite))) {
2486
2491
  const destDir = path.dirname(outDest);
2487
2492
  if (!Module.isDir(destDir) && (options.createDir === false || !Module.createDir(destDir))) {
2488
2493
  if (promises) {
@@ -2519,7 +2524,7 @@ class Module extends EventEmitter {
2519
2524
  return true;
2520
2525
  }
2521
2526
  catch (err) {
2522
- this.writeFail(["Unable to copy file" /* ERR_MESSAGE.COPY_FILE */, dest], err, 32 /* LOG_VALUE.FILE */);
2527
+ this.writeFail(["Unable to copy file", dest], err, 32);
2523
2528
  }
2524
2529
  }
2525
2530
  }
@@ -2535,7 +2540,7 @@ class Module extends EventEmitter {
2535
2540
  moveFile(src, dest, options = {}, callback) {
2536
2541
  let promises, outSrc, outDest;
2537
2542
  [options, promises, callback] = parseFileArgs(options, callback);
2538
- if ((outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options)) && (outDest = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, dest, options, true, options.overwrite))) {
2543
+ if ((outSrc = hasFileSystem.call(this, 1, src, options)) && (outDest = hasFileSystem.call(this, 1, dest, options, true, options.overwrite))) {
2539
2544
  const destDir = path.dirname(outDest);
2540
2545
  if (!Module.isDir(destDir) && (options.createDir === false || !Module.createDir(destDir))) {
2541
2546
  if (promises) {
@@ -2602,7 +2607,7 @@ class Module extends EventEmitter {
2602
2607
  this.emit('file:move', outDest, options);
2603
2608
  return true;
2604
2609
  }
2605
- this.writeFail(["Unable to move file" /* ERR_MESSAGE.MOVE_FILE */, dest], err, 32 /* LOG_VALUE.FILE */);
2610
+ this.writeFail(["Unable to move file", dest], err, 32);
2606
2611
  }
2607
2612
  }
2608
2613
  }
@@ -2623,7 +2628,7 @@ class Module extends EventEmitter {
2623
2628
  createDir(src, options = {}, callback) {
2624
2629
  let promises, outSrc;
2625
2630
  [options, promises, callback] = parseFileArgs(options, callback);
2626
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options, true)) {
2631
+ if (outSrc = hasFileSystem.call(this, 1, src, options, true)) {
2627
2632
  if (Module.isDir(outSrc)) {
2628
2633
  if (promises) {
2629
2634
  return Promise.resolve(true);
@@ -2670,7 +2675,7 @@ class Module extends EventEmitter {
2670
2675
  }
2671
2676
  }
2672
2677
  catch (err) {
2673
- this.writeFail(["Unable to create directory" /* ERR_MESSAGE.CREATE_DIRECTORY */, src], err, 32 /* LOG_VALUE.FILE */);
2678
+ this.writeFail(["Unable to create directory", src], err, 32);
2674
2679
  }
2675
2680
  }
2676
2681
  else if (promises) {
@@ -2685,11 +2690,11 @@ class Module extends EventEmitter {
2685
2690
  removeDir(src, options = {}, callback) {
2686
2691
  let promises, outSrc;
2687
2692
  [options, promises, callback] = parseFileArgs(options, callback);
2688
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options, true)) {
2693
+ if (outSrc = hasFileSystem.call(this, 1, src, options, true)) {
2689
2694
  try {
2690
2695
  if (Module.isDir(outSrc)) {
2691
2696
  const { emptyDir = false, recursive = true } = options;
2692
- const errorResponse = (failed) => new Error("Unsupported access" /* ERR_MESSAGE.UNSUPPORTED_ACCESS */ + ':' + (failed.length > 1 ? failed.map(value => `\n- ${value}`) : ' ' + failed[0]));
2697
+ const errorResponse = (failed) => new Error("Unsupported access" + ':' + (failed.length > 1 ? failed.map(value => `\n- ${value}`) : ' ' + failed[0]));
2693
2698
  if (promises || isFunction(callback)) {
2694
2699
  const result = new Promise((resolve, reject) => {
2695
2700
  const failed = tryRemoveDir(outSrc, emptyDir, !!recursive);
@@ -2740,7 +2745,7 @@ class Module extends EventEmitter {
2740
2745
  }
2741
2746
  }
2742
2747
  catch (err) {
2743
- this.writeFail(["Unable to remove directory" /* ERR_MESSAGE.REMOVE_DIRECTORY */, src], err, 32 /* LOG_VALUE.FILE */);
2748
+ this.writeFail(["Unable to remove directory", src], err, 32);
2744
2749
  }
2745
2750
  }
2746
2751
  else if (promises) {
@@ -2752,8 +2757,8 @@ class Module extends EventEmitter {
2752
2757
  }
2753
2758
  return false;
2754
2759
  }
2755
- allSettled(tasks, rejected, options) {
2756
- rejected || (rejected = "Unknown" /* ERR_MESSAGE.UNKNOWN */);
2760
+ async allSettled(tasks, rejected, options) {
2761
+ rejected || (rejected = "Unknown");
2757
2762
  return Promise.allSettled(tasks).then(result => {
2758
2763
  const items = [];
2759
2764
  for (const item of result) {
@@ -2782,16 +2787,16 @@ class Module extends EventEmitter {
2782
2787
  }
2783
2788
  options = {};
2784
2789
  }
2785
- this.formatFail(type || types_1.LOG_TYPE.SYSTEM, "FAIL!" /* ERR_MESSAGE.FAIL */, value, message, options);
2790
+ this.formatFail(type || types_1.LOG_TYPE.SYSTEM, "FAIL!", value, message, options);
2786
2791
  }
2787
2792
  writeTimeProcess(title, value, startTime, options = {}) {
2788
2793
  const { type = 0, statusType = 0 } = options;
2789
- const http = type & 1024 /* LOG_VALUE.HTTP */;
2794
+ const http = type & 1024;
2790
2795
  const meter = SETTINGS.meter;
2791
2796
  const failed = isFailed(options);
2792
2797
  const increment = options.meterIncrement || (http ? meter.http
2793
- : type & 2048 /* LOG_VALUE.IMAGE */ ? meter.image
2794
- : type & 8 /* LOG_VALUE.COMPRESS */ ? meter.compress
2798
+ : type & 2048 ? meter.image
2799
+ : type & 8 ? meter.compress
2795
2800
  : meter.process) || 250;
2796
2801
  const duration = getTimeOffset(startTime);
2797
2802
  let meterTime = duration, delayTime = options.delayTime;
@@ -2810,10 +2815,10 @@ class Module extends EventEmitter {
2810
2815
  }
2811
2816
  }
2812
2817
  if (failed && !http) {
2813
- value = "Failed" /* ERR_MESSAGE.FAILED */ + ' -> ' + value;
2818
+ value = "Failed" + ' -> ' + value;
2814
2819
  }
2815
2820
  const args = [
2816
- (256 /* LOG_VALUE.TIME_PROCESS */ | type),
2821
+ (256 | type),
2817
2822
  title,
2818
2823
  [value, formatTimeHint(duration)],
2819
2824
  (failed ? 'X' : '>').repeat(Math.min(Math.ceil(meterTime / increment), SETTINGS.format.meter.width)),
@@ -2848,10 +2853,10 @@ class Module extends EventEmitter {
2848
2853
  message = value;
2849
2854
  value = '';
2850
2855
  }
2851
- value || (value = isFailed(options) ? "Failed" /* ERR_MESSAGE.FAILED */ : "Success" /* VAL_MESSAGE.SUCCESS */);
2856
+ value || (value = isFailed(options) ? "Failed" : "Success");
2852
2857
  const duration = getTimeOffset(startTime);
2853
2858
  const args = [
2854
- (128 /* LOG_VALUE.TIME_ELAPSED */ | type),
2859
+ (128 | type),
2855
2860
  title,
2856
2861
  [value, formatTimeHint(duration)],
2857
2862
  message,
@@ -2888,10 +2893,10 @@ class Module extends EventEmitter {
2888
2893
  if (options.passThrough) {
2889
2894
  message = null;
2890
2895
  }
2891
- const args = [(type | 512 /* LOG_VALUE.FAIL */), title, value, message, applyStyle(options, Module.LOG_STYLE_FAIL)];
2896
+ const args = [(type | 512), title, value, message, applyStyle(options, Module.LOG_STYLE_FAIL)];
2892
2897
  applyLogId.call(this, options);
2893
2898
  if (options.queue !== false && !options.passThrough && !this._logFlushed) {
2894
- if (VALUES["error.out" /* KEY_NAME.ERROR_OUT */]) {
2899
+ if (VALUES["error.out"]) {
2895
2900
  options.timeStamp = Date.now();
2896
2901
  }
2897
2902
  this._logQueued.push(args);
@@ -2902,9 +2907,9 @@ class Module extends EventEmitter {
2902
2907
  const host = this.host;
2903
2908
  const target = host || this;
2904
2909
  let fatal;
2905
- if (options.exec && (type & 4096 /* LOG_VALUE.EXEC */) && target.willAbort("(exec)" /* ABORT_NAME.EXEC */)) {
2910
+ if (options.exec && (type & 4096) && target.willAbort("(exec)")) {
2906
2911
  const exec = { ...options.exec };
2907
- let output = VALUES["permission.process_exec" /* KEY_NAME.PERMISSION_PROCESS_EXEC */].find(item => exec.command === ((0, types_1.isObject)(item) ? item.command : item));
2912
+ let output = VALUES["permission.process_exec"].find(item => exec.command === ((0, types_1.isObject)(item) ? item.command : item));
2908
2913
  if (output) {
2909
2914
  if ((0, types_1.isPlainObject)(output)) {
2910
2915
  output = { ...output };
@@ -2925,14 +2930,14 @@ class Module extends EventEmitter {
2925
2930
  }
2926
2931
  }
2927
2932
  else {
2928
- this.formatMessage(4096 /* LOG_VALUE.EXEC */, "WARN!" /* ERR_MESSAGE.WARN */, "Exec command not permitted" /* ERR_MESSAGE.EXEC_PERMISSION */, exec.command, { ...Module.LOG_STYLE_WARN });
2933
+ this.formatMessage(4096, "WARN!", "Exec command not permitted", exec.command, { ...Module.LOG_STYLE_WARN });
2929
2934
  }
2930
2935
  }
2931
2936
  if (options.passThrough) {
2932
2937
  return;
2933
2938
  }
2934
2939
  if (options.abortable !== false && (options.fatal !== false || this.isFatal(message))) {
2935
- if (target.willAbort("(unknown)" /* ABORT_NAME.UNKNOWN */)) {
2940
+ if (target.willAbort("(unknown)")) {
2936
2941
  if (host) {
2937
2942
  host.abort();
2938
2943
  }
@@ -2948,18 +2953,18 @@ class Module extends EventEmitter {
2948
2953
  this.abort();
2949
2954
  fatal = true;
2950
2955
  }
2951
- else if ((type & 8192 /* LOG_VALUE.PERMISSION */ && (!host || host.willAbort("(permission)" /* ABORT_NAME.PERMISSION */))) ||
2952
- (type & 1 /* LOG_VALUE.SYSTEM */) && target.willAbort("(system)" /* ABORT_NAME.SYSTEM */) ||
2953
- (type & 2 /* LOG_VALUE.NODE */) && target.willAbort("(node)" /* ABORT_NAME.NODE */) ||
2954
- (type & 8 /* LOG_VALUE.COMPRESS */) && target.willAbort("(compress)" /* ABORT_NAME.COMPRESS */) ||
2955
- (type & 16 /* LOG_VALUE.WATCH */) && target.willAbort("(watch)" /* ABORT_NAME.WATCH */) ||
2956
- (type & 32 /* LOG_VALUE.FILE */) && target.willAbort("(file)" /* ABORT_NAME.FILE */) ||
2957
- (type & 64 /* LOG_VALUE.CLOUD */) && target.willAbort("(cloud)" /* ABORT_NAME.CLOUD */) ||
2958
- (type & 1024 /* LOG_VALUE.HTTP */) && target.willAbort("(http)" /* ABORT_NAME.HTTP */) ||
2959
- (type & 2048 /* LOG_VALUE.IMAGE */) && target.willAbort("(image)" /* ABORT_NAME.IMAGE */) ||
2960
- (type & 4096 /* LOG_VALUE.EXEC */) && target.willAbort("(exec)" /* ABORT_NAME.EXEC */) ||
2961
- (type & 16384 /* LOG_VALUE.TIMEOUT */) && target.willAbort("(timeout)" /* ABORT_NAME.TIMEOUT */) ||
2962
- (type & 65536 /* LOG_VALUE.DB */) && target.willAbort("(db)" /* ABORT_NAME.DB */)) {
2956
+ else if ((type & 8192 && (!host || host.willAbort("(permission)"))) ||
2957
+ (type & 1) && target.willAbort("(system)") ||
2958
+ (type & 2) && target.willAbort("(node)") ||
2959
+ (type & 8) && target.willAbort("(compress)") ||
2960
+ (type & 16) && target.willAbort("(watch)") ||
2961
+ (type & 32) && target.willAbort("(file)") ||
2962
+ (type & 64) && target.willAbort("(cloud)") ||
2963
+ (type & 1024) && target.willAbort("(http)") ||
2964
+ (type & 2048) && target.willAbort("(image)") ||
2965
+ (type & 4096) && target.willAbort("(exec)") ||
2966
+ (type & 16384) && target.willAbort("(timeout)") ||
2967
+ (type & 65536) && target.willAbort("(db)")) {
2963
2968
  if (host) {
2964
2969
  if (host.abortable) {
2965
2970
  host.abort();
@@ -2999,7 +3004,7 @@ class Module extends EventEmitter {
2999
3004
  this.addLog(statusType, message || (Array.isArray(value) ? value[0] : value));
3000
3005
  }
3001
3006
  if (options.queue && !this._logFlushed) {
3002
- if (VALUES["error.out" /* KEY_NAME.ERROR_OUT */] && (type & 512 /* LOG_VALUE.FAIL */)) {
3007
+ if (VALUES["error.out"] && (type & 512)) {
3003
3008
  options.timeStamp = Date.now();
3004
3009
  }
3005
3010
  this._logQueued.push(args);
@@ -3021,7 +3026,7 @@ class Module extends EventEmitter {
3021
3026
  if (typeof options === 'number') {
3022
3027
  options = undefined;
3023
3028
  }
3024
- 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] } });
3029
+ 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] } });
3025
3030
  return true;
3026
3031
  }
3027
3032
  if (value) {
@@ -3049,13 +3054,13 @@ class Module extends EventEmitter {
3049
3054
  }
3050
3055
  session.push(command);
3051
3056
  let type = options.type || 0;
3052
- type |= 4096 /* LOG_VALUE.EXEC */;
3053
- type &= ~1 /* LOG_VALUE.SYSTEM */;
3057
+ type |= 4096;
3058
+ type &= ~1;
3054
3059
  if (options.passThrough) {
3055
3060
  options.passThrough = false;
3056
3061
  message = null;
3057
3062
  }
3058
- return { type, value: ["Install required?" /* ERR_MESSAGE.INSTALL */, command], message };
3063
+ return { type, value: ["Install required?", command], message };
3059
3064
  }
3060
3065
  delete options.exec;
3061
3066
  }
@@ -3143,7 +3148,7 @@ class Module extends EventEmitter {
3143
3148
  message = '';
3144
3149
  }
3145
3150
  }
3146
- this.status.push({ value: message.trim() || "Unknown" /* ERR_MESSAGE.UNKNOWN */, name, duration, timeStamp, type, sessionId: this.sessionId, from: from || this.moduleName, source });
3151
+ this.status.push({ value: message.trim() || "Unknown", name, duration, timeStamp, type, sessionId: this.sessionId, from: from || this.moduleName, source });
3147
3152
  }
3148
3153
  getLog(...type) {
3149
3154
  return this.status.filter(item => type.includes(item.type));
@@ -3203,7 +3208,7 @@ class Module extends EventEmitter {
3203
3208
  }
3204
3209
  isFatal(err) {
3205
3210
  const fatal = this.host?.config.error?.fatal;
3206
- return fatal ?? VALUES["error.fatal" /* KEY_NAME.ERROR_FATAL */];
3211
+ return fatal ?? VALUES["error.fatal"];
3207
3212
  }
3208
3213
  get moduleName() {
3209
3214
  return this._moduleName;