@stryke/fs 0.6.0 → 0.6.1
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.
|
@@ -4,17 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.listFiles = listFiles;
|
|
7
|
-
var _promises = require("node:fs/promises");
|
|
8
7
|
var _isFile = require("@stryke/path/utilities/is-file");
|
|
9
8
|
var _joinPaths = require("@stryke/path/utilities/join-paths");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
var _promises = require("node:fs/promises");
|
|
10
|
+
var _picomatch = _interopRequireDefault(require("picomatch"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
async function listFiles(e, a = {}) {
|
|
13
|
+
const {
|
|
14
|
+
ignored: t = []
|
|
15
|
+
} = a,
|
|
16
|
+
r = [],
|
|
17
|
+
n = async s => {
|
|
18
|
+
if (!(0, _picomatch.default)(s, t)) {
|
|
19
|
+
const c = await (0, _promises.readdir)(s);
|
|
20
|
+
await Promise.all(c.map(async f => {
|
|
21
|
+
const i = (0, _joinPaths.joinPaths)(s, f);
|
|
22
|
+
(0, _picomatch.default)(i, t) || ((0, _isFile.isDirectory)(i) ? await n(i) : r.push(i));
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
18
25
|
};
|
|
19
|
-
return await
|
|
26
|
+
return await n(e), r;
|
|
20
27
|
}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
export interface ListFilesOptions {
|
|
2
|
+
/**
|
|
3
|
+
* A list of directories/files to ignore
|
|
4
|
+
*
|
|
5
|
+
* @defaultValue []
|
|
6
|
+
*/
|
|
7
|
+
ignored?: string[];
|
|
8
|
+
}
|
|
1
9
|
/**
|
|
2
10
|
* The file listing library used by Storm Software for building TypeScript applications.
|
|
3
11
|
*
|
|
4
12
|
* @param directoryPath - The directory path to list files from
|
|
5
13
|
* @returns A list of file paths
|
|
6
14
|
*/
|
|
7
|
-
export declare function listFiles(directoryPath: string): Promise<string[]>;
|
|
15
|
+
export declare function listFiles(directoryPath: string, options?: ListFilesOptions): Promise<string[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isDirectory as m}from"@stryke/path/utilities/is-file";import{joinPaths as l}from"@stryke/path/utilities/join-paths";import{readdir as p}from"node:fs/promises";import o from"picomatch";export async function listFiles(e,a={}){const{ignored:t=[]}=a,r=[],n=async s=>{if(!o(s,t)){const c=await p(s);await Promise.all(c.map(async f=>{const i=l(s,f);o(i,t)||(m(i)?await n(i):r.push(i))}))}};return await n(e),r}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/fs",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing various file system utilities that expand the functionality of NodeJs's `fs` module.",
|
|
6
6
|
"repository": {
|
|
@@ -16,13 +16,15 @@
|
|
|
16
16
|
"@zkochan/js-yaml": "^0.0.7",
|
|
17
17
|
"chalk": "^5.4.1",
|
|
18
18
|
"nanotar": "^0.2.0",
|
|
19
|
+
"picomatch": "^4.0.2",
|
|
19
20
|
"semver": "7.7.1",
|
|
20
21
|
"@stryke/json": ">=0.4.2",
|
|
21
|
-
"@stryke/path": ">=0.3.
|
|
22
|
+
"@stryke/path": ">=0.3.2",
|
|
22
23
|
"@stryke/types": ">=0.5.1"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@types/node": "^22.13.1",
|
|
27
|
+
"@types/picomatch": "^3.0.2",
|
|
26
28
|
"nx": "^20.4.6",
|
|
27
29
|
"tinyexec": "^0.3.2"
|
|
28
30
|
},
|