@e-mc/module 0.10.11 → 0.10.12

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 +17 -10
  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.10.11/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.10.12/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogStatus } from "./squared";
@@ -407,11 +407,11 @@ interface LoggerModule {
407
407
 
408
408
  ## References
409
409
 
410
- - https://www.unpkg.com/@e-mc/types@0.10.11/lib/core.d.ts
411
- - https://www.unpkg.com/@e-mc/types@0.10.11/lib/logger.d.ts
412
- - https://www.unpkg.com/@e-mc/types@0.10.11/lib/module.d.ts
413
- - https://www.unpkg.com/@e-mc/types@0.10.11/lib/node.d.ts
414
- - https://www.unpkg.com/@e-mc/types@0.10.11/lib/settings.d.ts
410
+ - https://www.unpkg.com/@e-mc/types@0.10.12/lib/core.d.ts
411
+ - https://www.unpkg.com/@e-mc/types@0.10.12/lib/logger.d.ts
412
+ - https://www.unpkg.com/@e-mc/types@0.10.12/lib/module.d.ts
413
+ - https://www.unpkg.com/@e-mc/types@0.10.12/lib/node.d.ts
414
+ - https://www.unpkg.com/@e-mc/types@0.10.12/lib/settings.d.ts
415
415
 
416
416
  * https://www.npmjs.com/package/@types/node
417
417
 
package/index.js CHANGED
@@ -627,7 +627,7 @@ function getCacheTotal() {
627
627
  return CACHE_READTEXT.size + CACHE_READBUFFER.size + CACHE_READCJS.size;
628
628
  }
629
629
  function isMatch(key, value) {
630
- return pm.isMatch(key, value, { nocase: PLATFORM_WIN32, matchBase: value.startsWith('*') });
630
+ return pm.isMatch(key, value, { nocase: PLATFORM_WIN32, matchBase: value.startsWith('*') && !value.includes('/') });
631
631
  }
632
632
  function listDir(src, paths, depth, include, exclude, excludeDir, outFiles) {
633
633
  const srcDir = path.join(src, ...paths);
@@ -960,7 +960,7 @@ class Module extends EventEmitter {
960
960
  this[_g] = null;
961
961
  }
962
962
  static get VERSION() {
963
- return "0.10.11";
963
+ return "0.10.12";
964
964
  }
965
965
  static get LOG_TYPE() {
966
966
  return types_1.LOG_TYPE;
@@ -1533,22 +1533,28 @@ class Module extends EventEmitter {
1533
1533
  filename = undefined;
1534
1534
  }
1535
1535
  if (typeof value === 'string') {
1536
- let pathname = PLATFORM_WIN32 ? value.trim() : value, convert = true;
1536
+ let pathname = PLATFORM_WIN32 ? value.trim() : value;
1537
1537
  if (normalize) {
1538
1538
  pathname = path.normalize(pathname);
1539
- convert = PLATFORM_WIN32;
1540
1539
  }
1541
- if (convert) {
1540
+ if (PLATFORM_WIN32) {
1542
1541
  pathname = pathname.replace(/(?:^\\|\\+)/g, '/');
1543
1542
  }
1544
- if (pathname = pathname.replace(/\/+$/, '')) {
1543
+ if (pathname) {
1544
+ pathname = pathname.replace(/(?<!^)\/+$/, '');
1545
1545
  if (normalize && PLATFORM_WIN32) {
1546
1546
  const match = /^([A-Z]):\//.exec(pathname);
1547
1547
  if (match) {
1548
1548
  pathname = match[1].toLowerCase() + pathname.substring(1);
1549
1549
  }
1550
1550
  }
1551
- return pathname + (filename ? '/' + filename : '');
1551
+ if (!filename) {
1552
+ return pathname;
1553
+ }
1554
+ if (pathname !== '/') {
1555
+ pathname += '/';
1556
+ }
1557
+ return pathname + filename;
1552
1558
  }
1553
1559
  }
1554
1560
  return filename || '';
@@ -1922,7 +1928,7 @@ class Module extends EventEmitter {
1922
1928
  if (!(outDir && this.isDir(outDir))) {
1923
1929
  return Promise.reject(errorDirectory(asFile(src) || "Unknown"));
1924
1930
  }
1925
- const pmOpts = { posixSlashes: true, windows: true, nocase: PLATFORM_WIN32 };
1931
+ const pmOpts = PLATFORM_WIN32 ? { nocase: true, windows: true, posixSlashes: true } : {};
1926
1932
  let exclude, excludeDir, recursive;
1927
1933
  if ((0, types_1.isObject)(options)) {
1928
1934
  if (options.matchBase) {
@@ -1939,8 +1945,9 @@ class Module extends EventEmitter {
1939
1945
  const items = Array.isArray(exclude) ? exclude : [exclude];
1940
1946
  exclude = [];
1941
1947
  for (const value of items) {
1942
- if (/^[^\\/][^*]+[\\/]$/.test(value) && !(0, types_1.hasGlob)(value)) {
1943
- (excludeDir ||= []).push(this.normalizePath(value, 4));
1948
+ const dirEnd = value.endsWith('/') ? /^[^/][^*]+\/$/ : value.endsWith('\\') ? /^[^\\][^*]+\\$/ : null;
1949
+ if (dirEnd?.test(value) && !(0, types_1.hasGlob)(value)) {
1950
+ (excludeDir ||= []).push(this.toPosix(value, true));
1944
1951
  }
1945
1952
  else {
1946
1953
  exclude.push(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/module",
3
- "version": "0.10.11",
3
+ "version": "0.10.12",
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.10.11",
23
+ "@e-mc/types": "0.10.12",
24
24
  "chalk": "4.1.2",
25
25
  "file-type": "^18.7.0",
26
26
  "js-yaml": "^4.1.0",