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