@e-mc/module 0.9.14 → 0.9.16

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 +4 -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.9.14/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.9.16/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogStatus } from "./squared";
@@ -394,11 +394,11 @@ type ForegroundColor = typeof IForegroundColor | `#${string}`;
394
394
 
395
395
  ## References
396
396
 
397
- - https://www.unpkg.com/@e-mc/types@0.9.14/lib/core.d.ts
398
- - https://www.unpkg.com/@e-mc/types@0.9.14/lib/logger.d.ts
399
- - https://www.unpkg.com/@e-mc/types@0.9.14/lib/module.d.ts
400
- - https://www.unpkg.com/@e-mc/types@0.9.14/lib/node.d.ts
401
- - https://www.unpkg.com/@e-mc/types@0.9.14/lib/settings.d.ts
397
+ - https://www.unpkg.com/@e-mc/types@0.9.16/lib/core.d.ts
398
+ - https://www.unpkg.com/@e-mc/types@0.9.16/lib/logger.d.ts
399
+ - https://www.unpkg.com/@e-mc/types@0.9.16/lib/module.d.ts
400
+ - https://www.unpkg.com/@e-mc/types@0.9.16/lib/node.d.ts
401
+ - https://www.unpkg.com/@e-mc/types@0.9.16/lib/settings.d.ts
402
402
 
403
403
  * https://www.npmjs.com/package/@types/node
404
404
 
package/index.js CHANGED
@@ -553,7 +553,8 @@ function listDir(src, paths, depth, include, exclude, excludeDir, outFiles) {
553
553
  fs.readdirSync(srcDir, { withFileTypes: true }).forEach(file => {
554
554
  if (file.isFile()) {
555
555
  const pathname = path.join(srcDir, file.name);
556
- if (include(pathname) && !exclude?.(pathname)) {
556
+ const pathglob = pathname.substring(src.length);
557
+ if (include(pathglob) && !exclude?.(pathglob)) {
557
558
  outFiles.push(pathname);
558
559
  }
559
560
  }
@@ -737,7 +738,7 @@ class Module extends EventEmitter {
737
738
  this[_f] = new AbortController();
738
739
  this[_g] = null;
739
740
  }
740
- static get VERSION() { return "0.9.14"; }
741
+ static get VERSION() { return "0.9.16"; }
741
742
  static get LOG_TYPE() { return types_1.LOG_TYPE; }
742
743
  static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
743
744
  static get MAX_TIMEOUT() { return 2147483647; }
@@ -1708,12 +1709,6 @@ class Module extends EventEmitter {
1708
1709
  return Promise.reject(errorDirectory(asFile(src) || "Unknown"));
1709
1710
  }
1710
1711
  const pmOpts = { posixSlashes: true, windows: true, nocase: PLATFORM_WIN32 };
1711
- const prependSrc = (value) => {
1712
- if (pmOpts.matchBase) {
1713
- return value;
1714
- }
1715
- return (Array.isArray(value) ? value : [value]).map(item => path.join(outDir, item));
1716
- };
1717
1712
  let exclude, excludeDir, recursive;
1718
1713
  if ((0, types_1.isObject)(options)) {
1719
1714
  if (options.matchBase) {
@@ -1744,7 +1739,7 @@ class Module extends EventEmitter {
1744
1739
  }
1745
1740
  recursive ??= true;
1746
1741
  const result = [];
1747
- listDir(outDir, [], !recursive ? 0 : typeof recursive === 'number' ? recursive : Infinity, pm(prependSrc(pattern), pmOpts), exclude?.length ? pm(prependSrc(exclude), pmOpts) : undefined, excludeDir, result);
1742
+ listDir(ensureDir(outDir), [], !recursive ? 0 : typeof recursive === 'number' ? recursive : Infinity, pm(pattern, pmOpts), exclude?.length ? pm(exclude, pmOpts) : undefined, excludeDir, result);
1748
1743
  return result;
1749
1744
  }
1750
1745
  static renameFile(src, dest, throws = true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/module",
3
- "version": "0.9.14",
3
+ "version": "0.9.16",
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.9.14",
23
+ "@e-mc/types": "0.9.16",
24
24
  "chalk": "4.1.2",
25
25
  "file-type": "16.5.4",
26
26
  "js-yaml": "^4.1.0",