@e-mc/module 0.5.19 → 0.5.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 +12 -6
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -589,7 +589,7 @@ class Module extends EventEmitter {
589
589
  this[_f] = new AbortController();
590
590
  this[_g] = null;
591
591
  }
592
- static get VERSION() { return "0.5.19"; }
592
+ static get VERSION() { return "0.5.20"; }
593
593
  static get LOG_TYPE() { return types_1.LOG_TYPE; }
594
594
  static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
595
595
  static get MAX_TIMEOUT() { return 2147483647; }
@@ -1142,22 +1142,28 @@ class Module extends EventEmitter {
1142
1142
  filename = undefined;
1143
1143
  }
1144
1144
  if (typeof value === 'string') {
1145
- let pathname = PLATFORM_WIN32 ? value.trim() : value, convert = true;
1145
+ let pathname = PLATFORM_WIN32 ? value.trim() : value;
1146
1146
  if (normalize) {
1147
1147
  pathname = path.normalize(pathname);
1148
- convert = PLATFORM_WIN32;
1149
1148
  }
1150
- if (convert) {
1149
+ if (PLATFORM_WIN32) {
1151
1150
  pathname = pathname.replace(/(?:^\\|\\+)/g, '/');
1152
1151
  }
1153
- if (pathname = pathname.replace(/\/+$/, '')) {
1152
+ if (pathname) {
1153
+ pathname = pathname.replace(/(?<!^)\/+$/, '');
1154
1154
  if (normalize && PLATFORM_WIN32) {
1155
1155
  const match = /^([A-Z]):\//.exec(pathname);
1156
1156
  if (match) {
1157
1157
  pathname = match[1].toLowerCase() + pathname.substring(1);
1158
1158
  }
1159
1159
  }
1160
- return pathname + (filename ? '/' + filename : '');
1160
+ if (!filename) {
1161
+ return pathname;
1162
+ }
1163
+ if (pathname !== '/') {
1164
+ pathname += '/';
1165
+ }
1166
+ return pathname + filename;
1161
1167
  }
1162
1168
  }
1163
1169
  return filename || '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/module",
3
- "version": "0.5.19",
3
+ "version": "0.5.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.5.19",
23
+ "@e-mc/types": "0.5.20",
24
24
  "abort-controller": "^3.0.0",
25
25
  "chalk": "4.1.2",
26
26
  "event-target-shim": "^5.0.1",