@e-mc/module 0.7.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.7.1" /* INTERNAL.VERSION */; }
560
+ static get VERSION() { return "0.7.3"; }
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-*._~]*\/|node:)?[a-z\d-~][a-z\d-._~]*(?:\/.*)?$/.test(location)) {
1002
+ if (external && !pathname && VALUES["node.require.npm"] && /^(?:@[a-z\d-*~][a-z\d-*._~]*\/|node:)?[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,13 +1059,13 @@ 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
  }
1070
1066
  static asHash(data, algorithm, minLength = 0) {
1071
1067
  if (!algorithm && !minLength) {
1072
- return crypto.createHash("sha256" /* HASH_OUTPUT.ALGORITHM */).update(data).digest("hex" /* HASH_OUTPUT.DIGEST */);
1068
+ return crypto.createHash("sha256").update(data).digest("hex");
1073
1069
  }
1074
1070
  let options, digest;
1075
1071
  if (typeof minLength !== 'number') {
@@ -1103,17 +1099,17 @@ class Module extends EventEmitter {
1103
1099
  return data;
1104
1100
  }
1105
1101
  try {
1106
- return crypto.createHash(algorithm || "sha256" /* HASH_OUTPUT.ALGORITHM */, options).update(data).digest(digest || "hex" /* HASH_OUTPUT.DIGEST */);
1102
+ return crypto.createHash(algorithm || "sha256", options).update(data).digest(digest || "hex");
1107
1103
  }
1108
1104
  catch {
1109
1105
  return '';
1110
1106
  }
1111
1107
  }
1112
1108
  static async readHash(value, options = {}) {
1113
- const { algorithm = "sha256" /* HASH_OUTPUT.ALGORITHM */, digest = "hex" /* HASH_OUTPUT.DIGEST */, minStreamSize = 0, chunkSize = 2097152000 /* HASH_OUTPUT.CHUNK_SIZE */ } = options;
1109
+ const { algorithm = "sha256", digest = "hex", minStreamSize = 0, chunkSize = 2097152000 } = options;
1114
1110
  const hash = crypto.createHash(algorithm);
1115
1111
  try {
1116
- if (fs.statSync(value).size <= Math.min(minStreamSize > 0 ? minStreamSize : Infinity, 2097152000 /* HASH_OUTPUT.CHUNK_SIZE */)) {
1112
+ if (fs.statSync(value).size <= Math.min(minStreamSize > 0 ? minStreamSize : Infinity, 2097152000)) {
1117
1113
  return hash.update(fs.readFileSync(value)).digest(digest);
1118
1114
  }
1119
1115
  }
@@ -1291,7 +1287,7 @@ class Module extends EventEmitter {
1291
1287
  let result = paths[0] || '';
1292
1288
  for (let i = 1; i < paths.length; ++i) {
1293
1289
  const trailing = paths[i];
1294
- result += (trailing[0] !== '/' && result[result.length - 1] !== '/' ? '/' : '') + trailing;
1290
+ result += (!trailing.startsWith('/') && !result.endsWith('/') ? '/' : '') + trailing;
1295
1291
  }
1296
1292
  return result;
1297
1293
  }
@@ -1315,7 +1311,7 @@ class Module extends EventEmitter {
1315
1311
  return path.join(PROCESS_CWD, value);
1316
1312
  }
1317
1313
  if (ch === '~' && value[1] === '/') {
1318
- return VALUES["permission.home_read" /* KEY_NAME.PERMISSION_HOMEREAD */] ? path.join(OS_HOMEDIR, value.substring(2)) : '';
1314
+ return VALUES["permission.home_read"] ? path.join(OS_HOMEDIR, value.substring(2)) : '';
1319
1315
  }
1320
1316
  try {
1321
1317
  if (fs.existsSync(value = path.join(PROCESS_CWD, value))) {
@@ -1339,7 +1335,7 @@ class Module extends EventEmitter {
1339
1335
  fs.unlinkSync(outDir);
1340
1336
  }
1341
1337
  catch {
1342
- this.formatMessage(32 /* LOG_VALUE.FILE */, 'WARN', "Unable to overwrite file" /* ERR_MESSAGE.OVERWRITE_FILE */, value, { ...this.LOG_STYLE_WARN });
1338
+ this.formatMessage(32, 'WARN', "Unable to overwrite file", value, { ...this.LOG_STYLE_WARN });
1343
1339
  return false;
1344
1340
  }
1345
1341
  }
@@ -1356,7 +1352,7 @@ class Module extends EventEmitter {
1356
1352
  return tryCreateDir(outDir);
1357
1353
  }
1358
1354
  catch (err) {
1359
- this.writeFail(["Unable to create directory" /* ERR_MESSAGE.CREATE_DIRECTORY */, value], err, 32 /* LOG_VALUE.FILE */);
1355
+ this.writeFail(["Unable to create directory", value], err, 32);
1360
1356
  }
1361
1357
  }
1362
1358
  return false;
@@ -1378,19 +1374,19 @@ class Module extends EventEmitter {
1378
1374
  }
1379
1375
  }
1380
1376
  catch (err) {
1381
- this.writeFail(["Unable to remove directory" /* ERR_MESSAGE.REMOVE_DIRECTORY */, value], err, 32 /* LOG_VALUE.FILE */);
1377
+ this.writeFail(["Unable to remove directory", value], err, 32);
1382
1378
  }
1383
1379
  }
1384
1380
  return false;
1385
1381
  }
1386
- static copyDir(src, dest, move, recursive = true) {
1382
+ static async copyDir(src, dest, move, recursive = true) {
1387
1383
  const srcOut = sanitizePath(asFile(src));
1388
1384
  if (!srcOut || !this.isDir(srcOut)) {
1389
- return Promise.reject(errorDirectory(asFile(src) || "Unknown" /* ERR_MESSAGE.UNKNOWN */));
1385
+ return Promise.reject(errorDirectory(asFile(src) || "Unknown"));
1390
1386
  }
1391
1387
  const destOut = sanitizePath(asFile(dest));
1392
1388
  if (!destOut || !this.createDir(destOut)) {
1393
- return Promise.reject(errorDirectory(asFile(dest) || "Unknown" /* ERR_MESSAGE.UNKNOWN */));
1389
+ return Promise.reject(errorDirectory(asFile(dest) || "Unknown"));
1394
1390
  }
1395
1391
  let symFile, symDir, ignoreFile, ignoreDir, silent, overwrite;
1396
1392
  if ((0, types_1.isObject)(move)) {
@@ -1461,7 +1457,7 @@ class Module extends EventEmitter {
1461
1457
  .catch(err => {
1462
1458
  failed.push(srcPath);
1463
1459
  if (!silent) {
1464
- 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 */);
1460
+ this.writeFail([move ? "Unable to move file" : "Unable to copy file", path.basename(srcPath)], err, 32);
1465
1461
  }
1466
1462
  }));
1467
1463
  }
@@ -1476,7 +1472,7 @@ class Module extends EventEmitter {
1476
1472
  catch (err) {
1477
1473
  failed.push(srcDir);
1478
1474
  if (!silent) {
1479
- this.writeFail(["Unable to read directory" /* ERR_MESSAGE.READ_DIRECTORY */, path.basename(srcDir)], err, 32 /* LOG_VALUE.FILE */);
1475
+ this.writeFail(["Unable to read directory", path.basename(srcDir)], err, 32);
1480
1476
  }
1481
1477
  }
1482
1478
  }
@@ -1528,7 +1524,7 @@ class Module extends EventEmitter {
1528
1524
  }
1529
1525
  catch (error) {
1530
1526
  if (copied) {
1531
- 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 });
1527
+ this.formatMessage(32, 'WARN', ["Unable to delete file", path.basename(src instanceof URL ? url.fileURLToPath(src) : src)], error, { ...this.LOG_STYLE_WARN });
1532
1528
  throws = false;
1533
1529
  }
1534
1530
  }
@@ -1558,7 +1554,7 @@ class Module extends EventEmitter {
1558
1554
  return result;
1559
1555
  }
1560
1556
  catch (err) {
1561
- this.writeFail(["Unable to read file" /* ERR_MESSAGE.READ_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
1557
+ this.writeFail(["Unable to read file", path.basename(src)], err, 32);
1562
1558
  }
1563
1559
  }
1564
1560
  return '';
@@ -1578,19 +1574,19 @@ class Module extends EventEmitter {
1578
1574
  return result;
1579
1575
  }
1580
1576
  catch (err) {
1581
- this.writeFail(["Unable to read file" /* ERR_MESSAGE.READ_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
1577
+ this.writeFail(["Unable to read file", path.basename(src)], err, 32);
1582
1578
  }
1583
1579
  }
1584
1580
  return null;
1585
1581
  }
1586
- static resolveMime(data) {
1582
+ static async resolveMime(data) {
1587
1583
  return typeof data === 'string' ? filetype.fromFile(data) : filetype.fromBuffer(data);
1588
1584
  }
1589
1585
  static lookupMime(value, extension) {
1590
1586
  return (extension ? mime.extension(value) : mime.lookup(value)) || '';
1591
1587
  }
1592
1588
  static initCpuUsage(instance) {
1593
- if (!VALUES["node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */]) {
1589
+ if (!VALUES["node.process.cpu_usage"]) {
1594
1590
  return { user: 0, system: 0 };
1595
1591
  }
1596
1592
  const result = process.cpuUsage();
@@ -1601,7 +1597,7 @@ class Module extends EventEmitter {
1601
1597
  return result;
1602
1598
  }
1603
1599
  static getCpuUsage(start, format) {
1604
- if (VALUES["node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */]) {
1600
+ if (VALUES["node.process.cpu_usage"]) {
1605
1601
  let value = CACHE_CPU.get(start);
1606
1602
  if (value === undefined) {
1607
1603
  CACHE_CPU.set(start, getCpuTimes());
@@ -1619,7 +1615,7 @@ class Module extends EventEmitter {
1619
1615
  return format ? '' : 0;
1620
1616
  }
1621
1617
  static getMemUsage(format) {
1622
- if (!VALUES["node.process.memory_usage" /* KEY_NAME.NODE_PROCESS_MEMORYUSAGE */]) {
1618
+ if (!VALUES["node.process.memory_usage"]) {
1623
1619
  return format ? '' : 0;
1624
1620
  }
1625
1621
  const usage = process.memoryUsage();
@@ -1657,24 +1653,24 @@ class Module extends EventEmitter {
1657
1653
  if (!cpu_single_core) {
1658
1654
  usage /= CPU_CORETOTAL;
1659
1655
  }
1660
- if (usage + 0.005 /* CPU_MEM.BAR_100_OFFSET */ >= 1) {
1656
+ if (usage + 0.005 >= 1) {
1661
1657
  usage = 1;
1662
1658
  }
1663
- let bar = 20 /* CPU_MEM.BAR_LENGTH */, red = 0.9 /* CPU_MEM.BAR_RED */, yellow = 0.75 /* CPU_MEM.BAR_YELLOW */;
1659
+ let bar = 20, red = 0.9, yellow = 0.75;
1664
1660
  if (typeof cpu_bar === 'number') {
1665
1661
  bar = cpu_bar;
1666
1662
  }
1667
- else if (Array.isArray(cpu_bar) && cpu_bar[0] >= 10 /* CPU_MEM.BAR_MIN_LENGTH */) {
1663
+ else if (Array.isArray(cpu_bar) && cpu_bar[0] >= 10) {
1668
1664
  let r, y;
1669
- [bar, r = 0.9 /* CPU_MEM.BAR_RED */, y = 0.75 /* CPU_MEM.BAR_YELLOW */] = cpu_bar;
1665
+ [bar, r = 0.9, y = 0.75] = cpu_bar;
1670
1666
  if (r > 0 && r < 1 && y > 0 && y < 1 && y < r) {
1671
1667
  red = r;
1672
1668
  yellow = y;
1673
1669
  }
1674
1670
  }
1675
- const unit = Math.max(bar, 10 /* CPU_MEM.BAR_MIN_LENGTH */);
1671
+ const unit = Math.max(bar, 10);
1676
1672
  const length = Math.floor(usage * unit);
1677
- const hint = usage === 1 ? "MAX" /* CPU_MEM.BAR_100 */ : usage < 0 ? "N/A" /* CPU_MEM.BAR_UNDER */ : formatPercent(usage, 2);
1673
+ const hint = usage === 1 ? "MAX" : usage < 0 ? "N/A" : formatPercent(usage, 2);
1678
1674
  result += chalk[usage >= red ? 'bgRed' : usage >= yellow ? 'bgYellow' : 'bgBlue'].white(':'.repeat(length)) + chalk.bgGrey.white(':'.repeat(unit - length)) + (hint ? chalk.bgWhite.grey(` ${hint} `) : '');
1679
1675
  }
1680
1676
  else if (usage) {
@@ -1869,7 +1865,7 @@ class Module extends EventEmitter {
1869
1865
  return true;
1870
1866
  }
1871
1867
  static sanitizeCmd(value) {
1872
- if (value.indexOf(' ') !== -1) {
1868
+ if (value.includes(' ')) {
1873
1869
  return PLATFORM_WIN32 ? wrapQuote(value) : value.replace(/[ ]/g, '\\ ');
1874
1870
  }
1875
1871
  return value;
@@ -1900,7 +1896,7 @@ class Module extends EventEmitter {
1900
1896
  }
1901
1897
  value = quoted[2];
1902
1898
  }
1903
- if (value.indexOf(' ') !== -1) {
1899
+ if (value.includes(' ')) {
1904
1900
  value = wrapQuote(value);
1905
1901
  }
1906
1902
  }
@@ -1935,7 +1931,7 @@ class Module extends EventEmitter {
1935
1931
  }
1936
1932
  return (typeof values === 'string' ? result[0] : result);
1937
1933
  }
1938
- static purgeMemory(percent = 1, limit = 0) {
1934
+ static async purgeMemory(percent = 1, limit = 0) {
1939
1935
  if (typeof limit === 'boolean') {
1940
1936
  limit = 0;
1941
1937
  }
@@ -1973,22 +1969,22 @@ class Module extends EventEmitter {
1973
1969
  static canWrite(name) {
1974
1970
  switch (name) {
1975
1971
  case 'temp':
1976
- return VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */];
1972
+ return VALUES["temp.write"];
1977
1973
  case 'home':
1978
- return VALUES["permission.home_write" /* KEY_NAME.PERMISSION_HOMEWRITE */];
1974
+ return VALUES["permission.home_write"];
1979
1975
  default:
1980
1976
  return false;
1981
1977
  }
1982
1978
  }
1983
1979
  static loadSettings(settings, password) {
1984
1980
  var _h;
1985
- const current = VALUES["process.password" /* KEY_NAME.PROCESS_PASSWORD */];
1981
+ const current = VALUES["process.password"];
1986
1982
  if (current) {
1987
1983
  const proc = settings.process || {};
1988
1984
  if (!password && !(password = proc.password)) {
1989
1985
  return false;
1990
1986
  }
1991
- const algorithm = VALUES["process.cipher.algorithm" /* KEY_NAME.PROCESS_CIPHER_ALGORITHM */];
1987
+ const algorithm = VALUES["process.cipher.algorithm"];
1992
1988
  if (algorithm) {
1993
1989
  password = encryptMessage(password, proc.cipher, algorithm);
1994
1990
  }
@@ -1997,7 +1993,7 @@ class Module extends EventEmitter {
1997
1993
  }
1998
1994
  }
1999
1995
  else if ((0, types_1.isString)(password)) {
2000
- VALUES["process.password" /* KEY_NAME.PROCESS_PASSWORD */] = encryptMessage(password, settings.process?.cipher);
1996
+ VALUES["process.password"] = encryptMessage(password, settings.process?.cipher);
2001
1997
  }
2002
1998
  const { temp, node, permission, memory, error, logger } = settings;
2003
1999
  if ((0, types_1.isPlainObject)(node)) {
@@ -2005,51 +2001,51 @@ class Module extends EventEmitter {
2005
2001
  if ((0, types_1.isPlainObject)(proc)) {
2006
2002
  const { cpu_usage, memory_usage, inline } = proc;
2007
2003
  if (typeof cpu_usage === 'boolean') {
2008
- VALUES["node.process.cpu_usage" /* KEY_NAME.NODE_PROCESS_CPUUSAGE */] = cpu_usage;
2004
+ VALUES["node.process.cpu_usage"] = cpu_usage;
2009
2005
  }
2010
2006
  if (typeof memory_usage === 'boolean') {
2011
- VALUES["node.process.memory_usage" /* KEY_NAME.NODE_PROCESS_MEMORYUSAGE */] = memory_usage;
2007
+ VALUES["node.process.memory_usage"] = memory_usage;
2012
2008
  }
2013
2009
  if (typeof inline === 'boolean') {
2014
- VALUES["node.process.inline" /* KEY_NAME.NODE_PROCESS_INLINE */] = inline;
2010
+ VALUES["node.process.inline"] = inline;
2015
2011
  }
2016
2012
  }
2017
2013
  if ((0, types_1.isPlainObject)(req)) {
2018
2014
  const { ext, npm, inline } = req;
2019
2015
  if (!ext) {
2020
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = '';
2016
+ VALUES["node.require.ext"] = '';
2021
2017
  }
2022
2018
  else if (typeof ext === 'string') {
2023
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = ext.trim().toLowerCase();
2019
+ VALUES["node.require.ext"] = ext.trim().toLowerCase();
2024
2020
  }
2025
2021
  else if (Array.isArray(ext)) {
2026
2022
  const items = ext.map(value => (0, types_1.isString)(value) ? value.trim().toLowerCase() : '').filter(value => value);
2027
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = items.length ? items : '';
2023
+ VALUES["node.require.ext"] = items.length ? items : '';
2028
2024
  }
2029
2025
  else {
2030
- VALUES["node.require.ext" /* KEY_NAME.NODE_REQUIRE_EXT */] = 'cjs';
2026
+ VALUES["node.require.ext"] = 'cjs';
2031
2027
  }
2032
2028
  if (typeof npm === 'boolean') {
2033
- VALUES["node.require.npm" /* KEY_NAME.NODE_REQUIRE_NPM */] = npm;
2029
+ VALUES["node.require.npm"] = npm;
2034
2030
  }
2035
2031
  if (typeof inline === 'boolean') {
2036
- VALUES["node.require.inline" /* KEY_NAME.NODE_REQUIRE_INLINE */] = inline;
2032
+ VALUES["node.require.inline"] = inline;
2037
2033
  }
2038
2034
  }
2039
2035
  }
2040
2036
  if ((0, types_1.isPlainObject)(settings.process)) {
2041
2037
  const { env, cipher, password: pwd } = settings.process;
2042
2038
  if (env && typeof env.apply === 'boolean') {
2043
- VALUES["process.env.apply" /* KEY_NAME.PROCESS_ENV_APPLY */] = env.apply;
2039
+ VALUES["process.env.apply"] = env.apply;
2044
2040
  }
2045
2041
  if ((0, types_1.isString)(pwd)) {
2046
- VALUES[_h = "process.password" /* KEY_NAME.PROCESS_PASSWORD */] || (VALUES[_h] = encryptMessage(pwd, cipher));
2042
+ VALUES[_h = "process.password"] || (VALUES[_h] = encryptMessage(pwd, cipher));
2047
2043
  }
2048
2044
  }
2049
2045
  if (memory && (0, types_1.isPlainObject)(memory.settings)) {
2050
2046
  const users = memory.settings.users;
2051
2047
  if (typeof users === 'boolean' || Array.isArray(users)) {
2052
- VALUES["memory.settings.users" /* KEY_NAME.MEMORY_SETTINGS_USERS */] = users;
2048
+ VALUES["memory.settings.users"] = users;
2053
2049
  }
2054
2050
  }
2055
2051
  if ((0, types_1.isPlainObject)(logger)) {
@@ -2060,7 +2056,7 @@ class Module extends EventEmitter {
2060
2056
  if (level !== undefined) {
2061
2057
  const value = (0, types_1.isString)(level) ? types_1.STATUS_TYPE[level.trim().toUpperCase()] : level;
2062
2058
  if (value >= -1 && value <= types_1.STATUS_TYPE.TRACE) {
2063
- VALUES["logger.level" /* KEY_NAME.LOGGER_LEVEL */] = value;
2059
+ VALUES["logger.level"] = value;
2064
2060
  }
2065
2061
  }
2066
2062
  if (Array.isArray(production)) {
@@ -2184,7 +2180,7 @@ class Module extends EventEmitter {
2184
2180
  }
2185
2181
  }
2186
2182
  if (broadcast?.out) {
2187
- VALUES["broadcast.out" /* KEY_NAME.BROADCAST_OUT */] = this.parseFunction(broadcast.out, { external: true, absolute: true });
2183
+ VALUES["broadcast.out"] = this.parseFunction(broadcast.out, { external: true, absolute: true });
2188
2184
  }
2189
2185
  if (stack_trace && stack_trace !== true && +stack_trace > 0) {
2190
2186
  Error.stackTraceLimit = +stack_trace;
@@ -2192,23 +2188,32 @@ class Module extends EventEmitter {
2192
2188
  }
2193
2189
  if (error) {
2194
2190
  if (error.out) {
2195
- VALUES["error.out" /* KEY_NAME.ERROR_OUT */] = this.parseFunction(error.out, { external: true, absolute: true });
2191
+ VALUES["error.out"] = this.parseFunction(error.out, { external: true, absolute: true });
2196
2192
  }
2197
2193
  if (typeof error.fatal === 'boolean') {
2198
- VALUES["error.fatal" /* KEY_NAME.ERROR_FATAL */] = error.fatal;
2194
+ VALUES["error.fatal"] = error.fatal;
2199
2195
  }
2200
2196
  }
2201
- if (permission && Array.isArray(permission.process_exec)) {
2202
- 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 => {
2203
- if (typeof exec === 'string') {
2204
- return exec.trim();
2205
- }
2206
- if (typeof exec.warn === 'string') {
2207
- exec.warn = [exec.warn];
2208
- }
2209
- exec.command = exec.command.trim();
2210
- return exec;
2211
- });
2197
+ if (permission) {
2198
+ const { home_read, home_write } = permission;
2199
+ if (typeof home_read === 'boolean') {
2200
+ VALUES["permission.home_read"] = home_read;
2201
+ }
2202
+ if (typeof home_write === 'boolean') {
2203
+ VALUES["permission.home_write"] = home_write;
2204
+ }
2205
+ if (Array.isArray(permission.process_exec)) {
2206
+ VALUES["permission.process_exec"] = permission.process_exec.filter(item => typeof item === 'string' || (0, types_1.isObject)(item) && typeof item.command === 'string').map(exec => {
2207
+ if (typeof exec === 'string') {
2208
+ return exec.trim();
2209
+ }
2210
+ if (typeof exec.warn === 'string') {
2211
+ exec.warn = [exec.warn];
2212
+ }
2213
+ exec.command = exec.command.trim();
2214
+ return exec;
2215
+ });
2216
+ }
2212
2217
  }
2213
2218
  {
2214
2219
  let dir = settings.temp_dir, write;
@@ -2222,16 +2227,16 @@ class Module extends EventEmitter {
2222
2227
  dir = dir.substring(ensureDir(PROCESS_CWD).length);
2223
2228
  }
2224
2229
  else {
2225
- this.formatMessage(1 /* LOG_VALUE.SYSTEM */, 'WARN', 'Temp directory can only be relative', dir, { ...this.LOG_STYLE_WARN, newline: true });
2230
+ this.formatMessage(1, 'WARN', 'Temp directory can only be relative', dir, { ...this.LOG_STYLE_WARN, newline: true });
2226
2231
  dir = undefined;
2227
2232
  }
2228
2233
  }
2229
2234
  if (!(0, types_1.isString)(dir)) {
2230
- dir = VALUES["temp.dir" /* KEY_NAME.TEMP_DIR */];
2235
+ dir = VALUES["temp.dir"];
2231
2236
  }
2232
2237
  if (typeof write === 'boolean') {
2233
- modified = VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */] !== write;
2234
- VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */] = write;
2238
+ modified = VALUES["temp.write"] !== write;
2239
+ VALUES["temp.write"] = write;
2235
2240
  }
2236
2241
  do {
2237
2242
  const [output, index] = tryIncrementDir(path.join(PROCESS_CWD, dir), 5);
@@ -2239,19 +2244,19 @@ class Module extends EventEmitter {
2239
2244
  if (index > 0) {
2240
2245
  dir = trimDir(dir) + '_' + index;
2241
2246
  }
2242
- if (dir !== VALUES["temp.dir" /* KEY_NAME.TEMP_DIR */]) {
2243
- VALUES["temp.dir" /* KEY_NAME.TEMP_DIR */] = dir;
2247
+ if (dir !== VALUES["temp.dir"]) {
2248
+ VALUES["temp.dir"] = dir;
2244
2249
  modified = true;
2245
2250
  }
2246
2251
  (0, types_1.setTempDir)(TEMP_DIR = output);
2247
2252
  break;
2248
2253
  }
2249
2254
  if (output instanceof Error) {
2250
- this.writeFail(["Unable to create temp directory" /* ERR_MESSAGE.TEMP_DIRECTORY */, dir], output, 32 /* LOG_VALUE.FILE */);
2255
+ this.writeFail(["Unable to create temp directory", dir], output, 32);
2251
2256
  }
2252
- } while ((dir !== "tmp" /* INTERNAL.TEMP_DIR */) && (dir = "tmp" /* INTERNAL.TEMP_DIR */));
2257
+ } while ((dir !== "tmp") && (dir = "tmp"));
2253
2258
  if (modified) {
2254
- 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 });
2259
+ this.formatMessage(1, 'TEMP', ["Directory was modified", dir], TEMP_DIR + (VALUES["temp.write"] ? ' - writeable' : ''), { ...this.LOG_STYLE_NOTICE, newline: true });
2255
2260
  }
2256
2261
  settings.temp_dir = dir;
2257
2262
  if ((0, types_1.isPlainObject)(temp)) {
@@ -2304,7 +2309,7 @@ class Module extends EventEmitter {
2304
2309
  const [output] = tryIncrementDir(result, increment);
2305
2310
  if (!(0, types_1.isString)(output)) {
2306
2311
  if (output instanceof Error) {
2307
- this.writeFail(["Unable to create temp directory" /* ERR_MESSAGE.TEMP_DIRECTORY */, result], output, 32 /* LOG_VALUE.FILE */);
2312
+ this.writeFail(["Unable to create temp directory", result], output, 32);
2308
2313
  }
2309
2314
  return '';
2310
2315
  }
@@ -2338,7 +2343,7 @@ class Module extends EventEmitter {
2338
2343
  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()))) {
2339
2344
  return true;
2340
2345
  }
2341
- return VALUES["permission.home_read" /* KEY_NAME.PERMISSION_HOMEREAD */] && withinDir(uri, OS_HOMEDIR);
2346
+ return VALUES["permission.home_read"] && withinDir(uri, OS_HOMEDIR);
2342
2347
  }
2343
2348
  canWrite(uri, options) {
2344
2349
  let permission = this.permission, ownPermissionOnly = false;
@@ -2359,12 +2364,12 @@ class Module extends EventEmitter {
2359
2364
  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()))) {
2360
2365
  return true;
2361
2366
  }
2362
- return VALUES["temp.write" /* KEY_NAME.TEMP_WRITE */] && withinDir(uri, TEMP_DIR) || VALUES["permission.home_write" /* KEY_NAME.PERMISSION_HOMEWRITE */] && withinDir(uri, OS_HOMEDIR);
2367
+ return VALUES["temp.write"] && withinDir(uri, TEMP_DIR) || VALUES["permission.home_write"] && withinDir(uri, OS_HOMEDIR);
2363
2368
  }
2364
2369
  readFile(src, options = {}, callback) {
2365
2370
  let promises, outSrc;
2366
2371
  [options, promises, callback] = parseFileArgs(options, callback);
2367
- if (outSrc = hasFileSystem.call(this, 0 /* FILE_SYSTEM.READ */, src, options)) {
2372
+ if (outSrc = hasFileSystem.call(this, 0, src, options)) {
2368
2373
  const { requireExt, cache } = options;
2369
2374
  const encoding = options.encoding && (0, types_1.getEncoding)(options.encoding);
2370
2375
  const setCache = (data, cjs) => {
@@ -2376,7 +2381,7 @@ class Module extends EventEmitter {
2376
2381
  }
2377
2382
  };
2378
2383
  let result;
2379
- 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))) {
2384
+ if (requireExt && VALUES["node.require.ext"] && hasString(requireExt === true ? VALUES["node.require.ext"] : requireExt, getExtension(src))) {
2380
2385
  if (cache) {
2381
2386
  result = getCacheItem(CACHE_READCJS, outSrc);
2382
2387
  }
@@ -2423,7 +2428,7 @@ class Module extends EventEmitter {
2423
2428
  return result;
2424
2429
  }
2425
2430
  catch (err) {
2426
- this.writeFail(["Unable to read file" /* ERR_MESSAGE.READ_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
2431
+ this.writeFail(["Unable to read file", path.basename(src)], err, 32);
2427
2432
  }
2428
2433
  }
2429
2434
  else if (promises) {
@@ -2436,7 +2441,7 @@ class Module extends EventEmitter {
2436
2441
  writeFile(src, data, options = {}, callback) {
2437
2442
  let promises, outSrc;
2438
2443
  [options, promises, callback] = parseFileArgs(options, callback);
2439
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options, true, options.overwrite)) {
2444
+ if (outSrc = hasFileSystem.call(this, 1, src, options, true, options.overwrite)) {
2440
2445
  if (promises) {
2441
2446
  return fs.promises.writeFile(outSrc, data, options.encoding).then(() => {
2442
2447
  this.emit('file:write', outSrc, options);
@@ -2458,7 +2463,7 @@ class Module extends EventEmitter {
2458
2463
  return true;
2459
2464
  }
2460
2465
  catch (err) {
2461
- this.writeFail(["Unable to write file" /* ERR_MESSAGE.WRITE_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
2466
+ this.writeFail(["Unable to write file", path.basename(src)], err, 32);
2462
2467
  }
2463
2468
  }
2464
2469
  else if (promises) {
@@ -2473,7 +2478,7 @@ class Module extends EventEmitter {
2473
2478
  deleteFile(src, options = {}, callback) {
2474
2479
  let promises, outSrc;
2475
2480
  [options, promises, callback] = parseFileArgs(options, callback);
2476
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options)) {
2481
+ if (outSrc = hasFileSystem.call(this, 1, src, options)) {
2477
2482
  if (promises) {
2478
2483
  return fs.promises.unlink(outSrc).then(() => {
2479
2484
  this.emit('file:delete', outSrc, options);
@@ -2494,7 +2499,7 @@ class Module extends EventEmitter {
2494
2499
  }
2495
2500
  catch (err) {
2496
2501
  if (!Module.isErrorCode(err, 'ENOENT')) {
2497
- this.writeFail(["Unable to delete file" /* ERR_MESSAGE.DELETE_FILE */, path.basename(src)], err, 32 /* LOG_VALUE.FILE */);
2502
+ this.writeFail(["Unable to delete file", path.basename(src)], err, 32);
2498
2503
  return false;
2499
2504
  }
2500
2505
  }
@@ -2513,7 +2518,7 @@ class Module extends EventEmitter {
2513
2518
  copyFile(src, dest, options = {}, callback) {
2514
2519
  let promises, outSrc, outDest;
2515
2520
  [options, promises, callback] = parseFileArgs(options, callback);
2516
- if ((outSrc = hasFileSystem.call(this, 0 /* FILE_SYSTEM.READ */, src, options)) && (outDest = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, dest, options, true, options.overwrite))) {
2521
+ if ((outSrc = hasFileSystem.call(this, 0, src, options)) && (outDest = hasFileSystem.call(this, 1, dest, options, true, options.overwrite))) {
2517
2522
  const destDir = path.dirname(outDest);
2518
2523
  if (!Module.isDir(destDir) && (options.createDir === false || !Module.createDir(destDir))) {
2519
2524
  if (promises) {
@@ -2550,7 +2555,7 @@ class Module extends EventEmitter {
2550
2555
  return true;
2551
2556
  }
2552
2557
  catch (err) {
2553
- this.writeFail(["Unable to copy file" /* ERR_MESSAGE.COPY_FILE */, dest], err, 32 /* LOG_VALUE.FILE */);
2558
+ this.writeFail(["Unable to copy file", dest], err, 32);
2554
2559
  }
2555
2560
  }
2556
2561
  }
@@ -2566,7 +2571,7 @@ class Module extends EventEmitter {
2566
2571
  moveFile(src, dest, options = {}, callback) {
2567
2572
  let promises, outSrc, outDest;
2568
2573
  [options, promises, callback] = parseFileArgs(options, callback);
2569
- if ((outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options)) && (outDest = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, dest, options, true, options.overwrite))) {
2574
+ if ((outSrc = hasFileSystem.call(this, 1, src, options)) && (outDest = hasFileSystem.call(this, 1, dest, options, true, options.overwrite))) {
2570
2575
  const destDir = path.dirname(outDest);
2571
2576
  if (!Module.isDir(destDir) && (options.createDir === false || !Module.createDir(destDir))) {
2572
2577
  if (promises) {
@@ -2633,7 +2638,7 @@ class Module extends EventEmitter {
2633
2638
  this.emit('file:move', outDest, options);
2634
2639
  return true;
2635
2640
  }
2636
- this.writeFail(["Unable to move file" /* ERR_MESSAGE.MOVE_FILE */, dest], err, 32 /* LOG_VALUE.FILE */);
2641
+ this.writeFail(["Unable to move file", dest], err, 32);
2637
2642
  }
2638
2643
  }
2639
2644
  }
@@ -2654,7 +2659,7 @@ class Module extends EventEmitter {
2654
2659
  createDir(src, options = {}, callback) {
2655
2660
  let promises, outSrc;
2656
2661
  [options, promises, callback] = parseFileArgs(options, callback);
2657
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options, true)) {
2662
+ if (outSrc = hasFileSystem.call(this, 1, src, options, true)) {
2658
2663
  if (Module.isDir(outSrc)) {
2659
2664
  if (promises) {
2660
2665
  return Promise.resolve(true);
@@ -2701,7 +2706,7 @@ class Module extends EventEmitter {
2701
2706
  }
2702
2707
  }
2703
2708
  catch (err) {
2704
- this.writeFail(["Unable to create directory" /* ERR_MESSAGE.CREATE_DIRECTORY */, src], err, 32 /* LOG_VALUE.FILE */);
2709
+ this.writeFail(["Unable to create directory", src], err, 32);
2705
2710
  }
2706
2711
  }
2707
2712
  else if (promises) {
@@ -2716,11 +2721,11 @@ class Module extends EventEmitter {
2716
2721
  removeDir(src, options = {}, callback) {
2717
2722
  let promises, outSrc;
2718
2723
  [options, promises, callback] = parseFileArgs(options, callback);
2719
- if (outSrc = hasFileSystem.call(this, 1 /* FILE_SYSTEM.WRITE */, src, options, true)) {
2724
+ if (outSrc = hasFileSystem.call(this, 1, src, options, true)) {
2720
2725
  try {
2721
2726
  if (Module.isDir(outSrc)) {
2722
2727
  const { emptyDir = false, recursive = true } = options;
2723
- const errorResponse = (failed) => new Error("Unsupported access" /* ERR_MESSAGE.UNSUPPORTED_ACCESS */ + ':' + (failed.length > 1 ? failed.map(value => `\n- ${value}`) : ' ' + failed[0]));
2728
+ const errorResponse = (failed) => new Error("Unsupported access" + ':' + (failed.length > 1 ? failed.map(value => `\n- ${value}`) : ' ' + failed[0]));
2724
2729
  if (promises || isFunction(callback)) {
2725
2730
  const result = new Promise((resolve, reject) => {
2726
2731
  const failed = tryRemoveDir(outSrc, emptyDir, !!recursive);
@@ -2771,7 +2776,7 @@ class Module extends EventEmitter {
2771
2776
  }
2772
2777
  }
2773
2778
  catch (err) {
2774
- this.writeFail(["Unable to remove directory" /* ERR_MESSAGE.REMOVE_DIRECTORY */, src], err, 32 /* LOG_VALUE.FILE */);
2779
+ this.writeFail(["Unable to remove directory", src], err, 32);
2775
2780
  }
2776
2781
  }
2777
2782
  else if (promises) {
@@ -2783,8 +2788,8 @@ class Module extends EventEmitter {
2783
2788
  }
2784
2789
  return false;
2785
2790
  }
2786
- allSettled(tasks, rejected, options) {
2787
- rejected || (rejected = "Unknown" /* ERR_MESSAGE.UNKNOWN */);
2791
+ async allSettled(tasks, rejected, options) {
2792
+ rejected || (rejected = "Unknown");
2788
2793
  return Promise.allSettled(tasks).then(result => {
2789
2794
  const items = [];
2790
2795
  for (const item of result) {
@@ -2813,16 +2818,16 @@ class Module extends EventEmitter {
2813
2818
  }
2814
2819
  options = {};
2815
2820
  }
2816
- this.formatFail(type || types_1.LOG_TYPE.SYSTEM, "FAIL!" /* ERR_MESSAGE.FAIL */, value, message, options);
2821
+ this.formatFail(type || types_1.LOG_TYPE.SYSTEM, "FAIL!", value, message, options);
2817
2822
  }
2818
2823
  writeTimeProcess(title, value, startTime, options = {}) {
2819
2824
  const { type = 0, statusType = 0 } = options;
2820
- const http = type & 1024 /* LOG_VALUE.HTTP */;
2825
+ const http = type & 1024;
2821
2826
  const meter = SETTINGS.meter;
2822
2827
  const failed = isFailed(options);
2823
2828
  const increment = options.meterIncrement || (http ? meter.http
2824
- : type & 2048 /* LOG_VALUE.IMAGE */ ? meter.image
2825
- : type & 8 /* LOG_VALUE.COMPRESS */ ? meter.compress
2829
+ : type & 2048 ? meter.image
2830
+ : type & 8 ? meter.compress
2826
2831
  : meter.process) || 250;
2827
2832
  const duration = getTimeOffset(startTime);
2828
2833
  let meterTime = duration, delayTime = options.delayTime;
@@ -2841,10 +2846,10 @@ class Module extends EventEmitter {
2841
2846
  }
2842
2847
  }
2843
2848
  if (failed && !http) {
2844
- value = "Failed" /* ERR_MESSAGE.FAILED */ + ' -> ' + value;
2849
+ value = "Failed" + ' -> ' + value;
2845
2850
  }
2846
2851
  const args = [
2847
- (256 /* LOG_VALUE.TIME_PROCESS */ | type),
2852
+ (256 | type),
2848
2853
  title,
2849
2854
  [value, formatTimeHint(duration)],
2850
2855
  (failed ? 'X' : '>').repeat(Math.min(Math.ceil(meterTime / increment), SETTINGS.format.meter.width)),
@@ -2879,10 +2884,10 @@ class Module extends EventEmitter {
2879
2884
  message = value;
2880
2885
  value = '';
2881
2886
  }
2882
- value || (value = isFailed(options) ? "Failed" /* ERR_MESSAGE.FAILED */ : "Success" /* VAL_MESSAGE.SUCCESS */);
2887
+ value || (value = isFailed(options) ? "Failed" : "Success");
2883
2888
  const duration = getTimeOffset(startTime);
2884
2889
  const args = [
2885
- (128 /* LOG_VALUE.TIME_ELAPSED */ | type),
2890
+ (128 | type),
2886
2891
  title,
2887
2892
  [value, formatTimeHint(duration)],
2888
2893
  message,
@@ -2919,10 +2924,10 @@ class Module extends EventEmitter {
2919
2924
  if (options.passThrough) {
2920
2925
  message = null;
2921
2926
  }
2922
- const args = [(type | 512 /* LOG_VALUE.FAIL */), title, value, message, applyStyle(options, Module.LOG_STYLE_FAIL)];
2927
+ const args = [(type | 512), title, value, message, applyStyle(options, Module.LOG_STYLE_FAIL)];
2923
2928
  applyLogId.call(this, options);
2924
2929
  if (options.queue !== false && !options.passThrough && !this._logFlushed) {
2925
- if (VALUES["error.out" /* KEY_NAME.ERROR_OUT */]) {
2930
+ if (VALUES["error.out"]) {
2926
2931
  options.timeStamp = Date.now();
2927
2932
  }
2928
2933
  this._logQueued.push(args);
@@ -2933,9 +2938,9 @@ class Module extends EventEmitter {
2933
2938
  const host = this.host;
2934
2939
  const target = host || this;
2935
2940
  let fatal;
2936
- if (options.exec && (type & 4096 /* LOG_VALUE.EXEC */) && target.willAbort("(exec)" /* ABORT_NAME.EXEC */)) {
2941
+ if (options.exec && (type & 4096) && target.willAbort("(exec)")) {
2937
2942
  const exec = { ...options.exec };
2938
- let output = VALUES["permission.process_exec" /* KEY_NAME.PERMISSION_PROCESS_EXEC */].find(item => exec.command === ((0, types_1.isObject)(item) ? item.command : item));
2943
+ let output = VALUES["permission.process_exec"].find(item => exec.command === ((0, types_1.isObject)(item) ? item.command : item));
2939
2944
  if (output) {
2940
2945
  if ((0, types_1.isPlainObject)(output)) {
2941
2946
  output = { ...output };
@@ -2956,14 +2961,14 @@ class Module extends EventEmitter {
2956
2961
  }
2957
2962
  }
2958
2963
  else {
2959
- this.formatMessage(4096 /* LOG_VALUE.EXEC */, "WARN!" /* ERR_MESSAGE.WARN */, "Exec command not permitted" /* ERR_MESSAGE.EXEC_PERMISSION */, exec.command, { ...Module.LOG_STYLE_WARN });
2964
+ this.formatMessage(4096, "WARN!", "Exec command not permitted", exec.command, { ...Module.LOG_STYLE_WARN });
2960
2965
  }
2961
2966
  }
2962
2967
  if (options.passThrough) {
2963
2968
  return;
2964
2969
  }
2965
2970
  if (options.abortable !== false && (options.fatal !== false || this.isFatal(message))) {
2966
- if (target.willAbort("(unknown)" /* ABORT_NAME.UNKNOWN */)) {
2971
+ if (target.willAbort("(unknown)")) {
2967
2972
  if (host) {
2968
2973
  host.abort();
2969
2974
  }
@@ -2979,18 +2984,18 @@ class Module extends EventEmitter {
2979
2984
  this.abort();
2980
2985
  fatal = true;
2981
2986
  }
2982
- else if ((type & 8192 /* LOG_VALUE.PERMISSION */ && (!host || host.willAbort("(permission)" /* ABORT_NAME.PERMISSION */))) ||
2983
- (type & 1 /* LOG_VALUE.SYSTEM */) && target.willAbort("(system)" /* ABORT_NAME.SYSTEM */) ||
2984
- (type & 2 /* LOG_VALUE.NODE */) && target.willAbort("(node)" /* ABORT_NAME.NODE */) ||
2985
- (type & 8 /* LOG_VALUE.COMPRESS */) && target.willAbort("(compress)" /* ABORT_NAME.COMPRESS */) ||
2986
- (type & 16 /* LOG_VALUE.WATCH */) && target.willAbort("(watch)" /* ABORT_NAME.WATCH */) ||
2987
- (type & 32 /* LOG_VALUE.FILE */) && target.willAbort("(file)" /* ABORT_NAME.FILE */) ||
2988
- (type & 64 /* LOG_VALUE.CLOUD */) && target.willAbort("(cloud)" /* ABORT_NAME.CLOUD */) ||
2989
- (type & 1024 /* LOG_VALUE.HTTP */) && target.willAbort("(http)" /* ABORT_NAME.HTTP */) ||
2990
- (type & 2048 /* LOG_VALUE.IMAGE */) && target.willAbort("(image)" /* ABORT_NAME.IMAGE */) ||
2991
- (type & 4096 /* LOG_VALUE.EXEC */) && target.willAbort("(exec)" /* ABORT_NAME.EXEC */) ||
2992
- (type & 16384 /* LOG_VALUE.TIMEOUT */) && target.willAbort("(timeout)" /* ABORT_NAME.TIMEOUT */) ||
2993
- (type & 65536 /* LOG_VALUE.DB */) && target.willAbort("(db)" /* ABORT_NAME.DB */)) {
2987
+ else if ((type & 8192 && (!host || host.willAbort("(permission)"))) ||
2988
+ (type & 1) && target.willAbort("(system)") ||
2989
+ (type & 2) && target.willAbort("(node)") ||
2990
+ (type & 8) && target.willAbort("(compress)") ||
2991
+ (type & 16) && target.willAbort("(watch)") ||
2992
+ (type & 32) && target.willAbort("(file)") ||
2993
+ (type & 64) && target.willAbort("(cloud)") ||
2994
+ (type & 1024) && target.willAbort("(http)") ||
2995
+ (type & 2048) && target.willAbort("(image)") ||
2996
+ (type & 4096) && target.willAbort("(exec)") ||
2997
+ (type & 16384) && target.willAbort("(timeout)") ||
2998
+ (type & 65536) && target.willAbort("(db)")) {
2994
2999
  if (host) {
2995
3000
  if (host.abortable) {
2996
3001
  host.abort();
@@ -3030,7 +3035,7 @@ class Module extends EventEmitter {
3030
3035
  this.addLog(statusType, message || (Array.isArray(value) ? value[0] : value));
3031
3036
  }
3032
3037
  if (options.queue && !this._logFlushed) {
3033
- if (VALUES["error.out" /* KEY_NAME.ERROR_OUT */] && (type & 512 /* LOG_VALUE.FAIL */)) {
3038
+ if (VALUES["error.out"] && (type & 512)) {
3034
3039
  options.timeStamp = Date.now();
3035
3040
  }
3036
3041
  this._logQueued.push(args);
@@ -3052,7 +3057,7 @@ class Module extends EventEmitter {
3052
3057
  if (typeof options === 'number') {
3053
3058
  options = undefined;
3054
3059
  }
3055
- 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] } });
3060
+ 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] } });
3056
3061
  return true;
3057
3062
  }
3058
3063
  if (value) {
@@ -3080,13 +3085,13 @@ class Module extends EventEmitter {
3080
3085
  }
3081
3086
  session.push(command);
3082
3087
  let type = options.type || 0;
3083
- type |= 4096 /* LOG_VALUE.EXEC */;
3084
- type &= ~1 /* LOG_VALUE.SYSTEM */;
3088
+ type |= 4096;
3089
+ type &= ~1;
3085
3090
  if (options.passThrough) {
3086
3091
  options.passThrough = false;
3087
3092
  message = null;
3088
3093
  }
3089
- return { type, value: ["Install required?" /* ERR_MESSAGE.INSTALL */, command], message };
3094
+ return { type, value: ["Install required?", command], message };
3090
3095
  }
3091
3096
  delete options.exec;
3092
3097
  }
@@ -3174,7 +3179,7 @@ class Module extends EventEmitter {
3174
3179
  message = '';
3175
3180
  }
3176
3181
  }
3177
- this.status.push({ value: message.trim() || "Unknown" /* ERR_MESSAGE.UNKNOWN */, name, duration, timeStamp, type, sessionId: this.sessionId, from: from || this.moduleName, source });
3182
+ this.status.push({ value: message.trim() || "Unknown", name, duration, timeStamp, type, sessionId: this.sessionId, from: from || this.moduleName, source });
3178
3183
  }
3179
3184
  getLog(...type) {
3180
3185
  return this.status.filter(item => type.includes(item.type));
@@ -3234,7 +3239,7 @@ class Module extends EventEmitter {
3234
3239
  }
3235
3240
  isFatal(err) {
3236
3241
  const fatal = this.host?.config.error?.fatal;
3237
- return fatal ?? VALUES["error.fatal" /* KEY_NAME.ERROR_FATAL */];
3242
+ return fatal ?? VALUES["error.fatal"];
3238
3243
  }
3239
3244
  get moduleName() {
3240
3245
  return this._moduleName;