@e-mc/module 0.7.19 → 0.7.20

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.7.19"; }
591
+ static get VERSION() { return "0.7.20"; }
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"];
@@ -1172,7 +1172,7 @@ class Module extends EventEmitter {
1172
1172
  filename = undefined;
1173
1173
  }
1174
1174
  if (typeof value === 'string') {
1175
- let pathname = value.trim(), convert = true;
1175
+ let pathname = PLATFORM_WIN32 ? value.trim() : value, convert = true;
1176
1176
  if (normalize) {
1177
1177
  pathname = path.normalize(pathname);
1178
1178
  convert = PLATFORM_WIN32;
@@ -1279,7 +1279,7 @@ class Module extends EventEmitter {
1279
1279
  return false;
1280
1280
  }
1281
1281
  static resolveFile(value) {
1282
- if (isFileURL(value = value instanceof URL ? value.toString() : value.trim())) {
1282
+ if (isFileURL(value = value instanceof URL ? value.toString() : value)) {
1283
1283
  try {
1284
1284
  return url.fileURLToPath(value);
1285
1285
  }
@@ -1294,7 +1294,7 @@ class Module extends EventEmitter {
1294
1294
  }
1295
1295
  static resolvePath(value, base) {
1296
1296
  try {
1297
- if (this.isURL(value = value.trim())) {
1297
+ if (this.isURL(value)) {
1298
1298
  return isFileURL(value) ? url.fileURLToPath(value) : new URL(value).href;
1299
1299
  }
1300
1300
  if (base instanceof URL || this.isURL(base)) {
@@ -1326,7 +1326,7 @@ class Module extends EventEmitter {
1326
1326
  if (typeof flags === 'boolean') {
1327
1327
  flags = flags ? 2 : 0;
1328
1328
  }
1329
- let result = value.trim();
1329
+ let result = PLATFORM_WIN32 ? value.trim() : value;
1330
1330
  result = flags & 1 ? path.resolve(result) : path.normalize(result);
1331
1331
  if ((flags & 3) && result.length) {
1332
1332
  result = ensureDir(result);
@@ -3117,12 +3117,12 @@ class Module extends EventEmitter {
3117
3117
  }
3118
3118
  }
3119
3119
  writeLog(type, value, timeStamp, duration) {
3120
- let queue;
3120
+ let queue = false;
3121
3121
  if ((0, types_1.isObject)(type)) {
3122
3122
  if (typeof value === 'boolean') {
3123
3123
  queue = value;
3124
3124
  }
3125
- ({ type = types_1.STATUS_TYPE.UNKNOWN, value, timeStamp, duration } = type);
3125
+ value = type.value;
3126
3126
  }
3127
3127
  const output = Module.asString(value);
3128
3128
  if (output) {
@@ -3150,7 +3150,7 @@ class Module extends EventEmitter {
3150
3150
  from = timeStamp;
3151
3151
  timeStamp = 0;
3152
3152
  }
3153
- else if ((0, types_1.isObject)(timeStamp)) {
3153
+ else if ((0, types_1.isPlainObject)(timeStamp)) {
3154
3154
  ({ timeStamp, duration, from, source } = timeStamp);
3155
3155
  }
3156
3156
  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.7.19",
3
+ "version": "0.7.20",
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.7.19",
23
+ "@e-mc/types": "0.7.20",
24
24
  "abort-controller": "^3.0.0",
25
25
  "chalk": "4.1.2",
26
26
  "event-target-shim": "^5.0.1",