@stryke/fs 0.11.2 → 0.11.3
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/dist/list-files.cjs +11 -7
- package/dist/list-files.mjs +1 -1
- package/package.json +1 -1
package/dist/list-files.cjs
CHANGED
|
@@ -9,16 +9,20 @@ var _joinPaths = require("@stryke/path/join-paths");
|
|
|
9
9
|
var _promises = require("node:fs/promises");
|
|
10
10
|
var _picomatch = _interopRequireDefault(require("picomatch"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
async function listFiles(
|
|
12
|
+
async function listFiles(s, a) {
|
|
13
13
|
const o = [],
|
|
14
|
+
n = (0, _picomatch.default)(s, {
|
|
15
|
+
dot: !0,
|
|
16
|
+
...a
|
|
17
|
+
}),
|
|
14
18
|
r = async t => {
|
|
15
|
-
if (!(
|
|
16
|
-
const
|
|
17
|
-
await Promise.all(
|
|
18
|
-
const i = (0, _joinPaths.joinPaths)(t,
|
|
19
|
-
(
|
|
19
|
+
if (!n(t)) {
|
|
20
|
+
const e = await (0, _promises.readdir)(t);
|
|
21
|
+
await Promise.all(e.map(async c => {
|
|
22
|
+
const i = (0, _joinPaths.joinPaths)(t, c);
|
|
23
|
+
n(i) || ((0, _isFile.isDirectory)(i) ? await r(i) : o.push(i));
|
|
20
24
|
}));
|
|
21
25
|
}
|
|
22
26
|
};
|
|
23
|
-
return await r(
|
|
27
|
+
return await r(s), o;
|
|
24
28
|
}
|
package/dist/list-files.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isDirectory as
|
|
1
|
+
import{isDirectory as m}from"@stryke/path/is-file";import{joinPaths as p}from"@stryke/path/join-paths";import{readdir as f}from"node:fs/promises";import l from"picomatch";export async function listFiles(s,a){const o=[],n=l(s,{dot:!0,...a}),r=async t=>{if(!n(t)){const e=await f(t);await Promise.all(e.map(async c=>{const i=p(t,c);n(i)||(m(i)?await r(i):o.push(i))}))}};return await r(s),o}
|
package/package.json
CHANGED