@stryke/fs 0.28.6 → 0.29.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.
@@ -5,7 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.list = list;
7
7
  exports.listDirectories = listDirectories;
8
+ exports.listDirectoriesSync = listDirectoriesSync;
8
9
  exports.listFiles = listFiles;
10
+ exports.listFilesSync = listFilesSync;
11
+ exports.listSync = listSync;
9
12
  var _defu = _interopRequireDefault(require("defu"));
10
13
  var _glob = require("glob");
11
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -15,15 +18,30 @@ const p = {
15
18
  async function list(i, t) {
16
19
  return (0, _glob.glob)(i, (0, _defu.default)(t ?? {}, p));
17
20
  }
21
+ function listSync(i, t) {
22
+ return _glob.glob.sync(i, (0, _defu.default)(t ?? {}, p));
23
+ }
18
24
  async function listFiles(i, t) {
19
25
  const s = (await list(i, (0, _defu.default)({
20
26
  withFileTypes: !0
21
27
  }, t ?? {}))).filter(e => e.isFile());
22
28
  return t?.withFileTypes ? s : s.map(e => e.fullpath());
23
29
  }
30
+ function listFilesSync(i, t) {
31
+ const s = listSync(i, (0, _defu.default)({
32
+ withFileTypes: !0
33
+ }, t ?? {})).filter(e => e.isFile());
34
+ return t?.withFileTypes ? s : s.map(e => e.fullpath());
35
+ }
24
36
  async function listDirectories(i, t) {
25
37
  const s = (await list(i, (0, _defu.default)({
26
38
  withFileTypes: !0
27
39
  }, t ?? {}))).filter(e => e.isDirectory());
28
40
  return t?.withFileTypes ? s : s.map(e => e.fullpath());
41
+ }
42
+ function listDirectoriesSync(i, t) {
43
+ const s = listSync(i, (0, _defu.default)({
44
+ withFileTypes: !0
45
+ }, t ?? {})).filter(e => e.isDirectory());
46
+ return t?.withFileTypes ? s : s.map(e => e.fullpath());
29
47
  }
@@ -8,6 +8,13 @@ export type InferListReturnType<TOptions extends GlobOptions> = TOptions["withFi
8
8
  * @returns A list of file paths
9
9
  */
10
10
  export declare function list<TOptions extends ListOptions>(filesGlob: string, options?: TOptions): Promise<InferListReturnType<TOptions>>;
11
+ /**
12
+ * A synchronous files and directories listing helper function
13
+ *
14
+ * @param filesGlob - A glob pattern to match files
15
+ * @returns A list of file paths
16
+ */
17
+ export declare function listSync<TOptions extends ListOptions>(filesGlob: string, options?: TOptions): InferListReturnType<TOptions>;
11
18
  /**
12
19
  * A file listing helper function
13
20
  *
@@ -15,6 +22,13 @@ export declare function list<TOptions extends ListOptions>(filesGlob: string, op
15
22
  * @returns A list of file paths
16
23
  */
17
24
  export declare function listFiles<TOptions extends ListOptions>(filesGlob: string, options?: TOptions): Promise<InferListReturnType<TOptions>>;
25
+ /**
26
+ * A synchronous file listing helper function
27
+ *
28
+ * @param filesGlob - A glob pattern to match files
29
+ * @returns A list of file paths
30
+ */
31
+ export declare function listFilesSync<TOptions extends ListOptions>(filesGlob: string, options?: TOptions): InferListReturnType<TOptions>;
18
32
  /**
19
33
  * A directories listing helper function
20
34
  *
@@ -22,3 +36,10 @@ export declare function listFiles<TOptions extends ListOptions>(filesGlob: strin
22
36
  * @returns A list of file paths
23
37
  */
24
38
  export declare function listDirectories<TOptions extends ListOptions>(filesGlob: string, options?: TOptions): Promise<InferListReturnType<TOptions>>;
39
+ /**
40
+ * A synchronous directories listing helper function
41
+ *
42
+ * @param filesGlob - A glob pattern to match files
43
+ * @returns A list of file paths
44
+ */
45
+ export declare function listDirectoriesSync<TOptions extends ListOptions>(filesGlob: string, options?: TOptions): InferListReturnType<TOptions>;
@@ -1 +1 @@
1
- import n from"defu";import{glob as r}from"glob";const p={dot:!0};export async function list(i,t){return r(i,n(t??{},p))}export async function listFiles(i,t){const s=(await list(i,n({withFileTypes:!0},t??{}))).filter(e=>e.isFile());return t?.withFileTypes?s:s.map(e=>e.fullpath())}export async function listDirectories(i,t){const s=(await list(i,n({withFileTypes:!0},t??{}))).filter(e=>e.isDirectory());return t?.withFileTypes?s:s.map(e=>e.fullpath())}
1
+ import n from"defu";import{glob as r}from"glob";const p={dot:!0};export async function list(i,t){return r(i,n(t??{},p))}export function listSync(i,t){return r.sync(i,n(t??{},p))}export async function listFiles(i,t){const s=(await list(i,n({withFileTypes:!0},t??{}))).filter(e=>e.isFile());return t?.withFileTypes?s:s.map(e=>e.fullpath())}export function listFilesSync(i,t){const s=listSync(i,n({withFileTypes:!0},t??{})).filter(e=>e.isFile());return t?.withFileTypes?s:s.map(e=>e.fullpath())}export async function listDirectories(i,t){const s=(await list(i,n({withFileTypes:!0},t??{}))).filter(e=>e.isDirectory());return t?.withFileTypes?s:s.map(e=>e.fullpath())}export function listDirectoriesSync(i,t){const s=listSync(i,n({withFileTypes:!0},t??{})).filter(e=>e.isDirectory());return t?.withFileTypes?s:s.map(e=>e.fullpath())}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/fs",
3
- "version": "0.28.6",
3
+ "version": "0.29.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": {
@@ -16,8 +16,8 @@
16
16
  "@ltd/j-toml": "^1.38.0",
17
17
  "@storm-software/config-tools": "latest",
18
18
  "@stryke/convert": "^0.6.0",
19
- "@stryke/path": "^0.15.2",
20
- "@stryke/string-format": "^0.11.0",
19
+ "@stryke/path": "^0.15.3",
20
+ "@stryke/string-format": "^0.12.0",
21
21
  "chalk": "^5.4.1",
22
22
  "defu": "^6.1.4",
23
23
  "glob": "^11.0.1",
@@ -27,7 +27,7 @@
27
27
  "yaml": "^2.8.1",
28
28
  "@stryke/json": "^0.9.3",
29
29
  "@stryke/type-checks": "^0.3.10",
30
- "@stryke/types": "^0.9.0"
30
+ "@stryke/types": "^0.9.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^22.14.0",
@@ -395,5 +395,5 @@
395
395
  "main": "./dist/index.cjs",
396
396
  "module": "./dist/index.mjs",
397
397
  "types": "./dist/index.d.ts",
398
- "gitHead": "e16d8342cedeaa690117587b41cfc439b61b38bb"
398
+ "gitHead": "de2c2a0130fd7d91ac5e94b47ee1addd8dd09a65"
399
399
  }