@stryke/fs 0.10.7 → 0.11.0

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/install.cjs CHANGED
@@ -11,11 +11,11 @@ const install = async (t, a) => (0, _installPkg.installPackage)(t, a),
11
11
  packageExists = async (t, a) => {
12
12
  const r = await (0, _resolve.resolve)(a?.cwd || process.cwd());
13
13
  try {
14
- (0, _resolve.resolve)(t, {
14
+ await (0, _resolve.resolve)(t, {
15
15
  paths: [r]
16
16
  });
17
17
  } catch {
18
- install(t, a);
18
+ await install(t, a);
19
19
  }
20
20
  };
21
21
  exports.packageExists = packageExists;
package/dist/install.mjs CHANGED
@@ -1 +1 @@
1
- import{installPackage as n}from"@antfu/install-pkg";import{resolve as s}from"@stryke/path/resolve";import"tinyexec";export const install=async(t,a)=>n(t,a),packageExists=async(t,a)=>{const r=await s(a?.cwd||process.cwd());try{s(t,{paths:[r]})}catch{install(t,a)}};
1
+ import{installPackage as n}from"@antfu/install-pkg";import{resolve as s}from"@stryke/path/resolve";import"tinyexec";export const install=async(t,a)=>n(t,a),packageExists=async(t,a)=>{const r=await s(a?.cwd||process.cwd());try{await s(t,{paths:[r]})}catch{await install(t,a)}};
@@ -9,19 +9,16 @@ 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(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));
12
+ async function listFiles(e, s = {}) {
13
+ const o = [],
14
+ r = async t => {
15
+ if (!(0, _picomatch.default)(t, s)) {
16
+ const n = await (0, _promises.readdir)(t);
17
+ await Promise.all(n.map(async m => {
18
+ const i = (0, _joinPaths.joinPaths)(t, m);
19
+ (0, _picomatch.default)(i, s) || ((0, _isFile.isDirectory)(i) ? await r(i) : o.push(i));
23
20
  }));
24
21
  }
25
22
  };
26
- return await n(e), r;
23
+ return await r(e), o;
27
24
  }
@@ -1,11 +1,5 @@
1
- export interface ListFilesOptions {
2
- /**
3
- * A list of directories/files to ignore
4
- *
5
- * @defaultValue []
6
- */
7
- ignored?: string[];
8
- }
1
+ import type { PicomatchOptions } from "picomatch";
2
+ export type ListFilesOptions = PicomatchOptions;
9
3
  /**
10
4
  * The file listing library used by Storm Software for building TypeScript applications.
11
5
  *
@@ -1 +1 @@
1
- import{isDirectory as m}from"@stryke/path/is-file";import{joinPaths as l}from"@stryke/path/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}
1
+ import{isDirectory as c}from"@stryke/path/is-file";import{joinPaths as p}from"@stryke/path/join-paths";import{readdir as f}from"node:fs/promises";import a from"picomatch";export async function listFiles(e,s={}){const o=[],r=async t=>{if(!a(t,s)){const n=await f(t);await Promise.all(n.map(async m=>{const i=p(t,m);a(i,s)||(c(i)?await r(i):o.push(i))}))}};return await r(e),o}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/fs",
3
- "version": "0.10.7",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "description": "A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.",
6
6
  "repository": {
@@ -18,10 +18,10 @@
18
18
  "nanotar": "^0.2.0",
19
19
  "picomatch": "^4.0.2",
20
20
  "semver": "7.7.1",
21
- "@stryke/json": "^0.5.4",
21
+ "@stryke/json": "^0.7.0",
22
22
  "@stryke/path": "^0.4.7",
23
- "@stryke/type-checks": "^0.1.4",
24
- "@stryke/types": "^0.7.4"
23
+ "@stryke/type-checks": "^0.3.0",
24
+ "@stryke/types": "^0.8.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "^22.13.1",