@e-mc/module 0.7.21 → 0.7.22

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.7.21"; }
592
+ static get VERSION() { return "0.7.22"; }
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; }
@@ -1173,22 +1173,28 @@ class Module extends EventEmitter {
1173
1173
  filename = undefined;
1174
1174
  }
1175
1175
  if (typeof value === 'string') {
1176
- let pathname = PLATFORM_WIN32 ? value.trim() : value, convert = true;
1176
+ let pathname = PLATFORM_WIN32 ? value.trim() : value;
1177
1177
  if (normalize) {
1178
1178
  pathname = path.normalize(pathname);
1179
- convert = PLATFORM_WIN32;
1180
1179
  }
1181
- if (convert) {
1180
+ if (PLATFORM_WIN32) {
1182
1181
  pathname = pathname.replace(/(?:^\\|\\+)/g, '/');
1183
1182
  }
1184
- if (pathname = pathname.replace(/\/+$/, '')) {
1183
+ if (pathname) {
1184
+ pathname = pathname.replace(/(?<!^)\/+$/, '');
1185
1185
  if (normalize && PLATFORM_WIN32) {
1186
1186
  const match = /^([A-Z]):\//.exec(pathname);
1187
1187
  if (match) {
1188
1188
  pathname = match[1].toLowerCase() + pathname.substring(1);
1189
1189
  }
1190
1190
  }
1191
- return pathname + (filename ? '/' + filename : '');
1191
+ if (!filename) {
1192
+ return pathname;
1193
+ }
1194
+ if (pathname !== '/') {
1195
+ pathname += '/';
1196
+ }
1197
+ return pathname + filename;
1192
1198
  }
1193
1199
  }
1194
1200
  return filename || '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/module",
3
- "version": "0.7.21",
3
+ "version": "0.7.22",
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.21",
23
+ "@e-mc/types": "0.7.22",
24
24
  "abort-controller": "^3.0.0",
25
25
  "chalk": "4.1.2",
26
26
  "event-target-shim": "^5.0.1",