@e-mc/module 0.11.7 → 0.11.8

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 (3) hide show
  1. package/README.md +6 -6
  2. package/index.js +15 -9
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.11.7/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.11.8/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogStatus } from "./squared";
@@ -414,11 +414,11 @@ interface LoggerModule {
414
414
 
415
415
  ## References
416
416
 
417
- - https://www.unpkg.com/@e-mc/types@0.11.7/lib/core.d.ts
418
- - https://www.unpkg.com/@e-mc/types@0.11.7/lib/logger.d.ts
419
- - https://www.unpkg.com/@e-mc/types@0.11.7/lib/module.d.ts
420
- - https://www.unpkg.com/@e-mc/types@0.11.7/lib/node.d.ts
421
- - https://www.unpkg.com/@e-mc/types@0.11.7/lib/settings.d.ts
417
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/core.d.ts
418
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/logger.d.ts
419
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/module.d.ts
420
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/node.d.ts
421
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/settings.d.ts
422
422
 
423
423
  * https://www.npmjs.com/package/@types/node
424
424
 
package/index.js CHANGED
@@ -647,7 +647,7 @@ function getCacheTotal() {
647
647
  return CACHE_READTEXT.size + CACHE_READBUFFER.size + CACHE_READCJS.size;
648
648
  }
649
649
  function isMatch(key, value) {
650
- return pm.isMatch(key, value, { posixSlashes: true, windows: true, nocase: PLATFORM_WIN32, matchBase: value.startsWith('*') });
650
+ return pm.isMatch(key, value, { nocase: PLATFORM_WIN32, matchBase: value.startsWith('*') && !value.includes('/') });
651
651
  }
652
652
  function listDir(src, paths, depth, include, exclude, excludeDir, outFiles) {
653
653
  const srcDir = path.join(src, ...paths);
@@ -984,7 +984,7 @@ class Module extends EventEmitter {
984
984
  this[_g] = null;
985
985
  }
986
986
  static get VERSION() {
987
- return "0.11.7";
987
+ return "0.11.8";
988
988
  }
989
989
  static get LOG_TYPE() {
990
990
  return types_1.LOG_TYPE;
@@ -1559,22 +1559,28 @@ class Module extends EventEmitter {
1559
1559
  filename = undefined;
1560
1560
  }
1561
1561
  if (typeof value === 'string') {
1562
- let pathname = PLATFORM_WIN32 ? value.trim() : value, convert = true;
1562
+ let pathname = PLATFORM_WIN32 ? value.trim() : value;
1563
1563
  if (normalize) {
1564
1564
  pathname = path.normalize(pathname);
1565
- convert = PLATFORM_WIN32;
1566
1565
  }
1567
- if (convert) {
1566
+ if (PLATFORM_WIN32) {
1568
1567
  pathname = pathname.replace(/(?:^\\|\\+)/g, '/');
1569
1568
  }
1570
- if (pathname = pathname.replace(/\/+$/, '')) {
1569
+ if (pathname) {
1570
+ pathname = pathname.replace(/(?<!^)\/+$/, '');
1571
1571
  if (normalize && PLATFORM_WIN32) {
1572
1572
  const match = /^([A-Z]):\//.exec(pathname);
1573
1573
  if (match) {
1574
1574
  pathname = match[1].toLowerCase() + pathname.substring(1);
1575
1575
  }
1576
1576
  }
1577
- return pathname + (filename ? '/' + filename : '');
1577
+ if (!filename) {
1578
+ return pathname;
1579
+ }
1580
+ if (pathname !== '/') {
1581
+ pathname += '/';
1582
+ }
1583
+ return pathname + filename;
1578
1584
  }
1579
1585
  }
1580
1586
  return filename || '';
@@ -1950,7 +1956,7 @@ class Module extends EventEmitter {
1950
1956
  if (!(outDir && this.isDir(outDir))) {
1951
1957
  return Promise.reject(errorDirectory(asFile(src) || "Unknown"));
1952
1958
  }
1953
- const pmOpts = { posixSlashes: true, windows: true, nocase: Module.PLATFORM_WIN32 };
1959
+ const pmOpts = PLATFORM_WIN32 ? { nocase: true, posixSlashes: true, windows: true } : {};
1954
1960
  let exclude, excludeDir, recursive;
1955
1961
  if ((0, types_1.isObject)(options)) {
1956
1962
  if (options.matchBase) {
@@ -1969,7 +1975,7 @@ class Module extends EventEmitter {
1969
1975
  for (const value of items) {
1970
1976
  const dirEnd = value.endsWith('/') ? /^[^/][^*]+\/$/ : value.endsWith('\\') ? /^[^\\][^*]+\\$/ : null;
1971
1977
  if (dirEnd?.test(value) && !(0, types_1.hasGlob)(value)) {
1972
- (excludeDir ||= []).push(this.normalizePath(value, 4));
1978
+ (excludeDir ||= []).push(this.toPosix(value, true));
1973
1979
  }
1974
1980
  else {
1975
1981
  exclude.push(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/module",
3
- "version": "0.11.7",
3
+ "version": "0.11.8",
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": "BSD-3-Clause",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/types": "0.11.7",
23
+ "@e-mc/types": "0.11.8",
24
24
  "chalk": "4.1.2",
25
25
  "file-type": "^18.7.0",
26
26
  "js-yaml": "^4.1.0",