@e-mc/module 0.10.3 → 0.10.5
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.
- package/README.md +6 -6
- package/index.js +22 -6
- 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.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.5/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.
|
|
411
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
412
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
413
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
414
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
410
|
+
- https://www.unpkg.com/@e-mc/types@0.10.5/lib/core.d.ts
|
|
411
|
+
- https://www.unpkg.com/@e-mc/types@0.10.5/lib/logger.d.ts
|
|
412
|
+
- https://www.unpkg.com/@e-mc/types@0.10.5/lib/module.d.ts
|
|
413
|
+
- https://www.unpkg.com/@e-mc/types@0.10.5/lib/node.d.ts
|
|
414
|
+
- https://www.unpkg.com/@e-mc/types@0.10.5/lib/settings.d.ts
|
|
415
415
|
|
|
416
416
|
* https://www.npmjs.com/package/@types/node
|
|
417
417
|
|
package/index.js
CHANGED
|
@@ -629,17 +629,21 @@ function getCacheTotal() {
|
|
|
629
629
|
function isMatch(key, value) {
|
|
630
630
|
return pm.isMatch(key, value, { nocase: PLATFORM_WIN32, matchBase: value.startsWith('*') });
|
|
631
631
|
}
|
|
632
|
-
function listDir(src, paths, depth, include, exclude, outFiles) {
|
|
632
|
+
function listDir(src, paths, depth, include, exclude, excludeDir, outFiles) {
|
|
633
633
|
const srcDir = path.join(src, ...paths);
|
|
634
634
|
fs.readdirSync(srcDir, { withFileTypes: true }).forEach(file => {
|
|
635
635
|
if (file.isFile()) {
|
|
636
636
|
const pathname = path.join(srcDir, file.name);
|
|
637
|
-
|
|
637
|
+
const pathglob = pathname.substring(src.length);
|
|
638
|
+
if (include(pathglob) && !exclude?.(pathglob)) {
|
|
638
639
|
outFiles.push(pathname);
|
|
639
640
|
}
|
|
640
641
|
}
|
|
641
642
|
else if (depth > 0 && file.isDirectory()) {
|
|
642
|
-
|
|
643
|
+
const subDirs = paths.concat(file.name);
|
|
644
|
+
if (!excludeDir?.includes(subDirs.join('/') + '/')) {
|
|
645
|
+
listDir(src, subDirs, depth - 1, include, exclude, excludeDir, outFiles);
|
|
646
|
+
}
|
|
643
647
|
}
|
|
644
648
|
});
|
|
645
649
|
}
|
|
@@ -957,7 +961,7 @@ class Module extends EventEmitter {
|
|
|
957
961
|
this[_g] = null;
|
|
958
962
|
}
|
|
959
963
|
static get VERSION() {
|
|
960
|
-
return "0.10.
|
|
964
|
+
return "0.10.5";
|
|
961
965
|
}
|
|
962
966
|
static get LOG_TYPE() {
|
|
963
967
|
return types_1.LOG_TYPE;
|
|
@@ -1924,7 +1928,7 @@ class Module extends EventEmitter {
|
|
|
1924
1928
|
return Promise.reject(errorDirectory(asFile(src) || "Unknown"));
|
|
1925
1929
|
}
|
|
1926
1930
|
const pmOpts = { posixSlashes: true, windows: true, nocase: PLATFORM_WIN32 };
|
|
1927
|
-
let exclude, recursive;
|
|
1931
|
+
let exclude, excludeDir, recursive;
|
|
1928
1932
|
if ((0, types_1.isObject)(options)) {
|
|
1929
1933
|
if (options.matchBase) {
|
|
1930
1934
|
pmOpts.matchBase = true;
|
|
@@ -1936,13 +1940,25 @@ class Module extends EventEmitter {
|
|
|
1936
1940
|
pmOpts.dot = true;
|
|
1937
1941
|
}
|
|
1938
1942
|
({ exclude, recursive } = options);
|
|
1943
|
+
if (exclude) {
|
|
1944
|
+
const items = Array.isArray(exclude) ? exclude : [exclude];
|
|
1945
|
+
exclude = [];
|
|
1946
|
+
for (const value of items) {
|
|
1947
|
+
if (/^[^\\/][^*]+[\\/]$/.test(value) && !(0, types_1.hasGlob)(value)) {
|
|
1948
|
+
(excludeDir ||= []).push(this.normalizePath(value, 4));
|
|
1949
|
+
}
|
|
1950
|
+
else {
|
|
1951
|
+
exclude.push(value);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1939
1955
|
}
|
|
1940
1956
|
else {
|
|
1941
1957
|
recursive = options;
|
|
1942
1958
|
}
|
|
1943
1959
|
recursive ??= true;
|
|
1944
1960
|
const result = [];
|
|
1945
|
-
listDir(outDir, [], !recursive ? 0 : typeof recursive === 'number' ? recursive : Infinity, pm(pattern, pmOpts), exclude ? pm(exclude, pmOpts) : undefined, result);
|
|
1961
|
+
listDir(ensureDir(outDir), [], !recursive ? 0 : typeof recursive === 'number' ? recursive : Infinity, pm(pattern, pmOpts), exclude?.length ? pm(exclude, pmOpts) : undefined, excludeDir, result);
|
|
1946
1962
|
return result;
|
|
1947
1963
|
}
|
|
1948
1964
|
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.10.
|
|
3
|
+
"version": "0.10.5",
|
|
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.
|
|
23
|
+
"@e-mc/types": "0.10.5",
|
|
24
24
|
"chalk": "4.1.2",
|
|
25
25
|
"file-type": "^18.7.0",
|
|
26
26
|
"js-yaml": "^4.1.0",
|