@e-mc/module 0.6.15 → 0.6.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +10 -10
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -555,7 +555,7 @@ function tryIncrementDir(value, increment) {
555
555
  } while (increment-- > 0);
556
556
  return [outErr, -1];
557
557
  }
558
- const asFile = (value) => value instanceof URL ? value.protocol === 'file:' ? url.fileURLToPath(value) : '' : value;
558
+ const asFile = (value) => typeof value === 'string' ? PLATFORM_WIN32 ? value.trim() : value : value instanceof URL && value.protocol === 'file:' ? url.fileURLToPath(value) : '';
559
559
  const wrapQuote = (value) => '"' + value.replace(/"/g, '\\"') + '"';
560
560
  const isFunction = (value) => typeof value === 'function';
561
561
  const isFileURL = (value) => /^file:\/\//i.test(value);
@@ -588,7 +588,7 @@ class Module extends EventEmitter {
588
588
  this[_f] = new AbortController();
589
589
  this[_g] = null;
590
590
  }
591
- static get VERSION() { return "0.6.15"; }
591
+ static get VERSION() { return "0.6.16"; }
592
592
  static get LOG_TYPE() { return types_1.LOG_TYPE; }
593
593
  static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
594
594
  static get MAX_TIMEOUT() { return 2147483647; }
@@ -668,7 +668,7 @@ class Module extends EventEmitter {
668
668
  }
669
669
  static formatMessage(type, title, value, message, options = {}) {
670
670
  var _h, _j, _k, _l;
671
- if (options.type) {
671
+ if (typeof options.type === 'number') {
672
672
  type |= options.type;
673
673
  }
674
674
  const BROADCAST_OUT = VALUES["broadcast.out"];
@@ -1141,7 +1141,7 @@ class Module extends EventEmitter {
1141
1141
  filename = undefined;
1142
1142
  }
1143
1143
  if (typeof value === 'string') {
1144
- let pathname = value.trim(), convert = true;
1144
+ let pathname = PLATFORM_WIN32 ? value.trim() : value, convert = true;
1145
1145
  if (normalize) {
1146
1146
  pathname = path.normalize(pathname);
1147
1147
  convert = PLATFORM_WIN32;
@@ -1248,7 +1248,7 @@ class Module extends EventEmitter {
1248
1248
  return false;
1249
1249
  }
1250
1250
  static resolveFile(value) {
1251
- if (isFileURL(value = value instanceof URL ? value.toString() : value.trim())) {
1251
+ if (isFileURL(value = value instanceof URL ? value.toString() : value)) {
1252
1252
  try {
1253
1253
  return url.fileURLToPath(value);
1254
1254
  }
@@ -1263,7 +1263,7 @@ class Module extends EventEmitter {
1263
1263
  }
1264
1264
  static resolvePath(value, base) {
1265
1265
  try {
1266
- if (this.isURL(value = value.trim())) {
1266
+ if (this.isURL(value)) {
1267
1267
  return isFileURL(value) ? url.fileURLToPath(value) : new URL(value).href;
1268
1268
  }
1269
1269
  if (base instanceof URL || this.isURL(base)) {
@@ -1295,7 +1295,7 @@ class Module extends EventEmitter {
1295
1295
  if (typeof flags === 'boolean') {
1296
1296
  flags = flags ? 2 : 0;
1297
1297
  }
1298
- let result = value.trim();
1298
+ let result = PLATFORM_WIN32 ? value.trim() : value;
1299
1299
  result = flags & 1 ? path.resolve(result) : path.normalize(result);
1300
1300
  if ((flags & 3) && result.length) {
1301
1301
  result = ensureDir(result);
@@ -3085,12 +3085,12 @@ class Module extends EventEmitter {
3085
3085
  }
3086
3086
  }
3087
3087
  writeLog(type, value, timeStamp, duration) {
3088
- let queue;
3088
+ let queue = false;
3089
3089
  if ((0, types_1.isObject)(type)) {
3090
3090
  if (typeof value === 'boolean') {
3091
3091
  queue = value;
3092
3092
  }
3093
- ({ type = types_1.STATUS_TYPE.UNKNOWN, value, timeStamp, duration } = type);
3093
+ value = type.value;
3094
3094
  }
3095
3095
  const output = Module.asString(value);
3096
3096
  if (output) {
@@ -3118,7 +3118,7 @@ class Module extends EventEmitter {
3118
3118
  from = timeStamp;
3119
3119
  timeStamp = 0;
3120
3120
  }
3121
- else if ((0, types_1.isObject)(timeStamp)) {
3121
+ else if ((0, types_1.isPlainObject)(timeStamp)) {
3122
3122
  ({ timeStamp, duration, from, source } = timeStamp);
3123
3123
  }
3124
3124
  const name = types_1.STATUS_TYPE[type] || types_1.STATUS_TYPE[type = 0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/module",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
4
4
  "description": "Module base class for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,7 +20,7 @@
20
20
  "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/types": "0.6.15",
23
+ "@e-mc/types": "0.6.16",
24
24
  "abort-controller": "^3.0.0",
25
25
  "chalk": "4.1.2",
26
26
  "event-target-shim": "^5.0.1",