@sapphire/node-utilities 1.1.0-pr-935.7da5c8bb → 2.0.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/CHANGELOG.md CHANGED
@@ -2,6 +2,51 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ # [@sapphire/node-utilities@2.0.0](https://github.com/sapphiredev/utilities/compare/@sapphire/node-utilities@1.0.2...@sapphire/node-utilities@2.0.0) - (2026-11-15)
6
+
7
+ ## 🏠 Refactor
8
+
9
+ - Update to ESLint v10 ([991c466](https://github.com/sapphiredev/utilities/commit/991c4665ff10d9efa32d34cab134570fa7d2dd22))
10
+ - Set minimal node version to 24 and npm to 12 ([2e4174b](https://github.com/sapphiredev/utilities/commit/2e4174bd3feb97ab1bbd15fd4735d2528c35cc2b))
11
+ - ***:** All round repository upgrade ([44c5c90](https://github.com/sapphiredev/utilities/commit/44c5c900ecd6f9164e073c09630a7800d69f745a))
12
+ - 💥 **BREAKING CHANGE:** Build system has been changed from tsup to tsdown. There may be unexpected changes in the build output.
13
+ - 💥 **BREAKING CHANGE:** CJS support has been entirely dropped, all packages in this repository are now ESM-only.
14
+ - 💥 **BREAKING CHANGE:** The `tslib` dependency has been removed from all packages.
15
+ - 💥 **BREAKING CHANGE:** TypeScript has been internally updated to v7.
16
+ - ***:** All round repository upgrade ([a58424e](https://github.com/sapphiredev/utilities/commit/a58424eadcea4990a730b0f89ce2d45f5d896c65))
17
+ - 💥 **BREAKING CHANGE:** Build system has been changed from tsup to tsdown. There may be unexpected changes in the build output.
18
+ - 💥 **BREAKING CHANGE:** CJS support has been entirely dropped, all packages in this repository are now ESM-only.
19
+ - 💥 **BREAKING CHANGE:** The `tslib` dependency has been removed from all packages.
20
+ - 💥 **BREAKING CHANGE:** TypeScript has been internally updated to v7.
21
+
22
+ ## 🐛 Bug Fixes
23
+
24
+ - **deps:** Update all non-major dependencies ([09c1811](https://github.com/sapphiredev/utilities/commit/09c1811dae117f501f4e03b2015d8288e28734f8)) ([#982](https://github.com/sapphiredev/utilities/pull/982) by @renovate[bot])
25
+ - **deps:** Update all non-major dependencies ([72499d9](https://github.com/sapphiredev/utilities/commit/72499d99a9feb107fd3dccea601da462f1f725c1)) ([#980](https://github.com/sapphiredev/utilities/pull/980) by @renovate[bot])
26
+ - **deps:** Update all non-major dependencies ([e6d4bac](https://github.com/sapphiredev/utilities/commit/e6d4bac47e65e9e0ec95ebaaa1b679cfc01bd107)) ([#953](https://github.com/sapphiredev/utilities/pull/953) by @renovate[bot])
27
+ - **deps:** Update all non-major dependencies ([3f9fe93](https://github.com/sapphiredev/utilities/commit/3f9fe93b770479fd72b7fd56f476244c040fcb41)) ([#952](https://github.com/sapphiredev/utilities/pull/952) by @renovate[bot])
28
+ - **deps:** Update all non-major dependencies ([841436f](https://github.com/sapphiredev/utilities/commit/841436f1b501f468b002790283a25298561768d6)) ([#946](https://github.com/sapphiredev/utilities/pull/946) by @renovate[bot])
29
+ - **deps:** Update all non-major dependencies ([636a5ee](https://github.com/sapphiredev/utilities/commit/636a5eed0939fd96a82213bf8459846aedd54037)) ([#897](https://github.com/sapphiredev/utilities/pull/897) by @renovate[bot])
30
+ - **deps:** Update all non-major dependencies ([4bc5591](https://github.com/sapphiredev/utilities/commit/4bc55911f95456a2caee10a3588c7b5f1542fb00)) ([#879](https://github.com/sapphiredev/utilities/pull/879) by @renovate[bot])
31
+ - **deps:** Update all non-major dependencies ([bc2f01c](https://github.com/sapphiredev/utilities/commit/bc2f01ce7d6932c9a0e02faa7cc081ecbae9640d)) ([#869](https://github.com/sapphiredev/utilities/pull/869) by @renovate[bot])
32
+ - **deps:** Update all non-major dependencies ([083376a](https://github.com/sapphiredev/utilities/commit/083376aac55094dbeddb5194e8a8f0d794b8cceb)) ([#763](https://github.com/sapphiredev/utilities/pull/763) by @renovate[bot])
33
+ - **deps:** Update all non-major dependencies ([e7fdc5d](https://github.com/sapphiredev/utilities/commit/e7fdc5db3632a7f90292ef3978898da32730343a)) ([#752](https://github.com/sapphiredev/utilities/pull/752) by @renovate[bot])
34
+
35
+ ## 📝 Documentation
36
+
37
+ - **readme:** Update feature descriptions across packages ([302730a](https://github.com/sapphiredev/utilities/commit/302730a5b8eccb763b7b9761c3de1db9d3857394))
38
+ - Update typedoc to proper tsdoc ([1d29dd6](https://github.com/sapphiredev/utilities/commit/1d29dd63bc2ffd1ea25093ca2d0a9ab7d6efc9e9))
39
+ - **readme:** Fix readme table of contents ([c60e8bd](https://github.com/sapphiredev/utilities/commit/c60e8bd9fc89156cf973871597ec3f0ef0308c08))
40
+
41
+ ## 🚀 Features
42
+
43
+ - Target es2024 when bundling ([293e6b9](https://github.com/sapphiredev/utilities/commit/293e6b9eddbed5db178017d5ddedaaad0cfb3395))
44
+ - 💥 **BREAKING CHANGE:** if your project is not full ES2024 compatible this new version will not work
45
+ - Update eslint rules ([901aca9](https://github.com/sapphiredev/utilities/commit/901aca995e28bf5f4b343b441ab658d9c6511195))
46
+ - 💥 **BREAKING CHANGE:** ESLint has been updated to v10
47
+ - 💥 **BREAKING CHANGE:** ESLint configuration has been changed to a flat config
48
+ - 💥 **BREAKING CHANGE:** Our ESLint config is now a small layer on top of [eslint-config-neon](https://www.npmjs.com/package/eslint-config-neon) which brings a LOT more rules and stricter linting.
49
+
5
50
  # [@sapphire/node-utilities@1.0.2](https://github.com/sapphiredev/utilities/compare/@sapphire/node-utilities@1.0.2...@sapphire/node-utilities@1.0.2) - (2024-01-19)
6
51
 
7
52
  ## 🐛 Bug Fixes
package/README.md CHANGED
@@ -14,18 +14,17 @@
14
14
 
15
15
  **Table of Contents**
16
16
 
17
- - [Features](#features)
18
- - [Installation](#installation)
19
- - [Usage](#usage)
20
- - [`findFilesRecursively`](#findfilesrecursively)
21
- - [Buy us some doughnuts](#buy-us-some-doughnuts)
22
- - [Contributors](#contributors)
17
+ - [Features](#features)
18
+ - [Installation](#installation)
19
+ - [Usage](#usage)
20
+ - [`findFilesRecursively`](#findfilesrecursively)
21
+ - [Buy us some doughnuts](#buy-us-some-doughnuts)
22
+ - [Contributors](#contributors)
23
23
 
24
24
  ## Features
25
25
 
26
- - Written in TypeScript
27
- - Offers CommonJS, and ESM bundles
28
- - Fully tested
26
+ - Recursively finds files beneath a directory as an async iterable
27
+ - Filters results by filename prefix, suffix, or included text
29
28
 
30
29
  ## Installation
31
30
 
@@ -0,0 +1,55 @@
1
+ import { PathLike } from "node:fs";
2
+ /**
3
+ * @param path - The path in which to find files.
4
+ * @param predicate - A predicate function receives the path as a parameter. Truthy values will have the path included, falsey values will have the file excluded.
5
+ * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursively(path, predicate)) {}`
6
+ * @example
7
+ * ```typescript
8
+ * // Find all files ending with `.ts` in the src directory:
9
+ * import { join } from 'node:path';
10
+ *
11
+ * for await (const file of findFilesRecursively(join(process.cwd(), 'src'), (filePath) => filePath.endsWith('.ts'))) {
12
+ * console.log(file);
13
+ * }
14
+ * ```
15
+ * @example
16
+ * ```typescript
17
+ * // With ESM: To find all files ending with `.ts` in the src directory:
18
+ * for await (const file of findFilesRecursively(new URL('src', import.meta.url), (filePath) => filePath.endsWith('.ts'))) {
19
+ * console.log(file);
20
+ * }
21
+ * ```
22
+ */
23
+ export declare function findFilesRecursively(path: PathLike, predicate?: (filePath: string) => boolean): AsyncIterableIterator<string>;
24
+ /**
25
+ * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.
26
+ * @param fileStartsWith - The string pattern with which the file name must start.
27
+ *
28
+ * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.startsWith}
29
+ * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringStartsWith(path, fileNameEndsWith)) {}`
30
+ */
31
+ export declare function findFilesRecursivelyStringStartsWith(path: PathLike, fileStartsWith: string): AsyncIterableIterator<string>;
32
+ /**
33
+ * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.
34
+ * @param fileEndsWith - The string pattern with which the file name must end.
35
+ * Ideally this is a file extension, however you can also provide more parts of the end of the file.
36
+ *
37
+ * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.endsWith}
38
+ * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringEndsWith(path, fileNameEndsWith)) {}`
39
+ */
40
+ export declare function findFilesRecursivelyStringEndsWith(path: PathLike, fileEndsWith: string): AsyncIterableIterator<string>;
41
+ /**
42
+ * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.
43
+ * @param include - The string pattern which must be present in the file name.
44
+ *
45
+ * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.includes}
46
+ * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringIncludes(path, fileNameEndsWith)) {}`
47
+ */
48
+ export declare function findFilesRecursivelyStringIncludes(path: PathLike, include: string): AsyncIterableIterator<string>;
49
+ /**
50
+ * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.
51
+ * @param regex - The regex pattern that the file name must match.
52
+ * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyRegex(path, fileNameEndsWith)) {}`
53
+ */
54
+ export declare function findFilesRecursivelyRegex(path: PathLike, regex: RegExp): AsyncIterableIterator<string>;
55
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/findFilesRecursively.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;wBAyBuB,qBAAqB,MAAM,UAAU,aAAY,+BAA4C;;;;;;;;wBAmBpG,qCAAqC,MAAM,UAAU,yBAAsB;;;;;;;;;wBAY3E,mCAAmC,MAAM,UAAU,uBAAoB;;;;;;;;wBAWvE,mCAAmC,MAAM,UAAU,kBAAe;;;;;;wBASlE,0BAA0B,MAAM,UAAU,OAAO,SAAM"}
package/dist/index.mjs ADDED
@@ -0,0 +1,72 @@
1
+ import { opendir } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+
4
+ // src/lib/findFilesRecursively.ts
5
+ /**
6
+ * @param path - The path in which to find files.
7
+ * @param predicate - A predicate function receives the path as a parameter. Truthy values will have the path included, falsey values will have the file excluded.
8
+ * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursively(path, predicate)) {}`
9
+ * @example
10
+ * ```typescript
11
+ * // Find all files ending with `.ts` in the src directory:
12
+ * import { join } from 'node:path';
13
+ *
14
+ * for await (const file of findFilesRecursively(join(process.cwd(), 'src'), (filePath) => filePath.endsWith('.ts'))) {
15
+ * console.log(file);
16
+ * }
17
+ * ```
18
+ * @example
19
+ * ```typescript
20
+ * // With ESM: To find all files ending with `.ts` in the src directory:
21
+ * for await (const file of findFilesRecursively(new URL('src', import.meta.url), (filePath) => filePath.endsWith('.ts'))) {
22
+ * console.log(file);
23
+ * }
24
+ * ```
25
+ */
26
+ async function* findFilesRecursively(path, predicate = () => true) {
27
+ const dir = await opendir(path);
28
+ for await (const item of dir) if (item.isFile() && predicate(item.name)) yield join(dir.path, item.name);
29
+ else if (item.isDirectory()) yield* findFilesRecursively(join(dir.path, item.name), predicate);
30
+ }
31
+ /**
32
+ * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.
33
+ * @param fileStartsWith - The string pattern with which the file name must start.
34
+ *
35
+ * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.startsWith}
36
+ * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringStartsWith(path, fileNameEndsWith)) {}`
37
+ */
38
+ function findFilesRecursivelyStringStartsWith(path, fileStartsWith) {
39
+ return findFilesRecursively(path, (filePath) => filePath.startsWith(fileStartsWith));
40
+ }
41
+ /**
42
+ * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.
43
+ * @param fileEndsWith - The string pattern with which the file name must end.
44
+ * Ideally this is a file extension, however you can also provide more parts of the end of the file.
45
+ *
46
+ * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.endsWith}
47
+ * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringEndsWith(path, fileNameEndsWith)) {}`
48
+ */
49
+ function findFilesRecursivelyStringEndsWith(path, fileEndsWith) {
50
+ return findFilesRecursively(path, (filePath) => filePath.endsWith(fileEndsWith));
51
+ }
52
+ /**
53
+ * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.
54
+ * @param include - The string pattern which must be present in the file name.
55
+ *
56
+ * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.includes}
57
+ * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringIncludes(path, fileNameEndsWith)) {}`
58
+ */
59
+ function findFilesRecursivelyStringIncludes(path, include) {
60
+ return findFilesRecursively(path, (filePath) => filePath.includes(include));
61
+ }
62
+ /**
63
+ * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.
64
+ * @param regex - The regex pattern that the file name must match.
65
+ * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyRegex(path, fileNameEndsWith)) {}`
66
+ */
67
+ function findFilesRecursivelyRegex(path, regex) {
68
+ return findFilesRecursively(path, (filePath) => regex.test(filePath));
69
+ }
70
+
71
+ export { findFilesRecursively, findFilesRecursivelyRegex, findFilesRecursivelyStringEndsWith, findFilesRecursivelyStringIncludes, findFilesRecursivelyStringStartsWith };
72
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/lib/findFilesRecursively.ts"],"sourcesContent":["import type { PathLike } from 'node:fs';\nimport { opendir } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * @param path - The path in which to find files.\n * @param predicate - A predicate function receives the path as a parameter. Truthy values will have the path included, falsey values will have the file excluded.\n * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursively(path, predicate)) {}`\n * @example\n * ```typescript\n * // Find all files ending with `.ts` in the src directory:\n * import { join } from 'node:path';\n *\n * for await (const file of findFilesRecursively(join(process.cwd(), 'src'), (filePath) => filePath.endsWith('.ts'))) {\n * console.log(file);\n * }\n * ```\n * @example\n * ```typescript\n * // With ESM: To find all files ending with `.ts` in the src directory:\n * for await (const file of findFilesRecursively(new URL('src', import.meta.url), (filePath) => filePath.endsWith('.ts'))) {\n * console.log(file);\n * }\n * ```\n */\nexport async function* findFilesRecursively(path: PathLike, predicate: (filePath: string) => boolean = () => true): AsyncIterableIterator<string> {\n\tconst dir = await opendir(path);\n\n\tfor await (const item of dir) {\n\t\tif (item.isFile() && predicate(item.name)) {\n\t\t\tyield join(dir.path, item.name);\n\t\t} else if (item.isDirectory()) {\n\t\t\tyield* findFilesRecursively(join(dir.path, item.name), predicate);\n\t\t}\n\t}\n}\n\n/**\n * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param fileStartsWith - The string pattern with which the file name must start.\n *\n * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.startsWith}\n * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringStartsWith(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyStringStartsWith(path: PathLike, fileStartsWith: string) {\n\treturn findFilesRecursively(path, (filePath) => filePath.startsWith(fileStartsWith));\n}\n\n/**\n * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param fileEndsWith - The string pattern with which the file name must end.\n * Ideally this is a file extension, however you can also provide more parts of the end of the file.\n *\n * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.endsWith}\n * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringEndsWith(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyStringEndsWith(path: PathLike, fileEndsWith: string) {\n\treturn findFilesRecursively(path, (filePath) => filePath.endsWith(fileEndsWith));\n}\n\n/**\n * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param include - The string pattern which must be present in the file name.\n *\n * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.includes}\n * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringIncludes(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyStringIncludes(path: PathLike, include: string) {\n\treturn findFilesRecursively(path, (filePath) => filePath.includes(include));\n}\n\n/**\n * @param path - The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param regex - The regex pattern that the file name must match.\n * @returns An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyRegex(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyRegex(path: PathLike, regex: RegExp) {\n\treturn findFilesRecursively(path, (filePath) => regex.test(filePath));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,gBAAuB,qBAAqB,MAAgB,kBAAiD,MAAqC;CACjJ,MAAM,MAAM,MAAM,QAAQ,IAAI;CAE9B,WAAW,MAAM,QAAQ,KACxB,IAAI,KAAK,OAAO,KAAK,UAAU,KAAK,IAAI,GACvC,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI;MACxB,IAAI,KAAK,YAAY,GAC3B,OAAO,qBAAqB,KAAK,IAAI,MAAM,KAAK,IAAI,GAAG,SAAS;AAGnE;;;;;;;;AASA,SAAgB,qCAAqC,MAAgB,gBAAwB;CAC5F,OAAO,qBAAqB,OAAO,aAAa,SAAS,WAAW,cAAc,CAAC;AACpF;;;;;;;;;AAUA,SAAgB,mCAAmC,MAAgB,cAAsB;CACxF,OAAO,qBAAqB,OAAO,aAAa,SAAS,SAAS,YAAY,CAAC;AAChF;;;;;;;;AASA,SAAgB,mCAAmC,MAAgB,SAAiB;CACnF,OAAO,qBAAqB,OAAO,aAAa,SAAS,SAAS,OAAO,CAAC;AAC3E;;;;;;AAOA,SAAgB,0BAA0B,MAAgB,OAAe;CACxE,OAAO,qBAAqB,OAAO,aAAa,MAAM,KAAK,QAAQ,CAAC;AACrE"}
package/package.json CHANGED
@@ -1,34 +1,27 @@
1
1
  {
2
2
  "name": "@sapphire/node-utilities",
3
- "version": "1.1.0-pr-935.7da5c8bb",
3
+ "version": "2.0.0",
4
4
  "description": "Node specific JavaScript utilities for the Sapphire Community",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",
7
- "main": "dist/cjs/index.cjs",
8
- "module": "dist/esm/index.mjs",
9
- "types": "dist/cjs/index.d.cts",
7
+ "type": "module",
8
+ "main": "dist/index.mjs",
9
+ "module": "dist/index.mjs",
10
+ "types": "dist/index.d.mts",
10
11
  "exports": {
11
- "import": {
12
- "types": "./dist/esm/index.d.mts",
13
- "default": "./dist/esm/index.mjs"
14
- },
15
- "require": {
16
- "types": "./dist/cjs/index.d.cts",
17
- "default": "./dist/cjs/index.cjs"
18
- }
12
+ "types": "./dist/index.d.mts",
13
+ "default": "./dist/index.mjs"
19
14
  },
20
15
  "sideEffects": false,
21
16
  "homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/utilities",
22
17
  "scripts": {
23
18
  "test": "vitest run",
24
- "lint": "eslint src tests --ext ts --fix -c ../../.eslintrc",
25
- "build": "yarn gen-index && tsup && yarn build:rename-cjs-index",
26
- "build:rename-cjs-index": "tsx ../../scripts/rename-cjs-index.cts",
27
- "docs": "typedoc-json-parser",
19
+ "lint": "eslint src tests --ext ts --fix",
20
+ "build": "yarn gen-index && tsdown",
28
21
  "prepack": "yarn build",
29
22
  "bump": "cliff-jumper",
30
23
  "check-update": "cliff-jumper --dry-run",
31
- "gen-index": "tsx ../../scripts/gen-index.cts node-utilities --write"
24
+ "gen-index": "node ../../scripts/gen-index.ts node-utilities --write"
32
25
  },
33
26
  "repository": {
34
27
  "type": "git",
@@ -39,8 +32,8 @@
39
32
  "dist/"
40
33
  ],
41
34
  "engines": {
42
- "node": ">=v16.0.0",
43
- "npm": ">=7.0.0"
35
+ "node": ">=v24.0.0",
36
+ "npm": ">=11.0.0"
44
37
  },
45
38
  "keywords": [
46
39
  "@sapphire/utilities",
@@ -60,13 +53,11 @@
60
53
  "access": "public"
61
54
  },
62
55
  "devDependencies": {
63
- "@favware/cliff-jumper": "^6.0.0",
64
- "@vitest/coverage-v8": "^3.2.4",
65
- "tsup": "^8.5.0",
66
- "tsx": "^4.20.6",
67
- "typedoc": "^0.26.11",
68
- "typedoc-json-parser": "^10.2.0",
69
- "typescript": "~5.4.5",
70
- "vitest": "^3.2.4"
56
+ "@favware/cliff-jumper": "^6.1.0",
57
+ "@vitest/coverage-v8": "^5.1.0",
58
+ "eslint": "^10.15.0",
59
+ "tsdown": "^0.23.7",
60
+ "typescript": "~6.0.3",
61
+ "vitest": "^5.1.0"
71
62
  }
72
63
  }
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- var promises = require('fs/promises');
4
- var path = require('path');
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- async function* findFilesRecursively(path$1, predicate = () => true) {
9
- const dir = await promises.opendir(path$1);
10
- for await (const item of dir) {
11
- if (item.isFile() && predicate(item.name)) {
12
- yield path.join(dir.path, item.name);
13
- } else if (item.isDirectory()) {
14
- yield* findFilesRecursively(path.join(dir.path, item.name), predicate);
15
- }
16
- }
17
- }
18
- __name(findFilesRecursively, "findFilesRecursively");
19
- function findFilesRecursivelyStringStartsWith(path, fileStartsWith) {
20
- return findFilesRecursively(path, (filePath) => filePath.startsWith(fileStartsWith));
21
- }
22
- __name(findFilesRecursivelyStringStartsWith, "findFilesRecursivelyStringStartsWith");
23
- function findFilesRecursivelyStringEndsWith(path, fileEndsWith) {
24
- return findFilesRecursively(path, (filePath) => filePath.endsWith(fileEndsWith));
25
- }
26
- __name(findFilesRecursivelyStringEndsWith, "findFilesRecursivelyStringEndsWith");
27
- function findFilesRecursivelyStringIncludes(path, include) {
28
- return findFilesRecursively(path, (filePath) => filePath.includes(include));
29
- }
30
- __name(findFilesRecursivelyStringIncludes, "findFilesRecursivelyStringIncludes");
31
- function findFilesRecursivelyRegex(path, regex) {
32
- return findFilesRecursively(path, (filePath) => regex.test(filePath));
33
- }
34
- __name(findFilesRecursivelyRegex, "findFilesRecursivelyRegex");
35
-
36
- exports.findFilesRecursively = findFilesRecursively;
37
- exports.findFilesRecursivelyRegex = findFilesRecursivelyRegex;
38
- exports.findFilesRecursivelyStringEndsWith = findFilesRecursivelyStringEndsWith;
39
- exports.findFilesRecursivelyStringIncludes = findFilesRecursivelyStringIncludes;
40
- exports.findFilesRecursivelyStringStartsWith = findFilesRecursivelyStringStartsWith;
41
- //# sourceMappingURL=index.cjs.map
42
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/findFilesRecursively.ts"],"names":["path","opendir","join"],"mappings":";;;;;;;AA6BA,gBAAuB,oBAAA,CAAqBA,MAAA,EAAgB,SAAA,GAA2C,MAAM,IAAA,EAAqC;AACjJ,EAAA,MAAM,GAAA,GAAM,MAAMC,gBAAA,CAAQD,MAAI,CAAA;AAE9B,EAAA,WAAA,MAAiB,QAAQ,GAAA,EAAK;AAC7B,IAAA,IAAI,KAAK,MAAA,EAAO,IAAK,SAAA,CAAU,IAAA,CAAK,IAAI,CAAA,EAAG;AAC1C,MAAA,MAAME,SAAA,CAAK,GAAA,CAAI,IAAA,EAAM,IAAA,CAAK,IAAI,CAAA;AAAA,IAC/B,CAAA,MAAA,IAAW,IAAA,CAAK,WAAA,EAAY,EAAG;AAC9B,MAAA,OAAO,qBAAqBA,SAAA,CAAK,GAAA,CAAI,MAAM,IAAA,CAAK,IAAI,GAAG,SAAS,CAAA;AAAA,IACjE;AAAA,EACD;AACD;AAVuB,MAAA,CAAA,oBAAA,EAAA,sBAAA,CAAA;AAqBhB,SAAS,oCAAA,CAAqC,MAAgB,cAAA,EAAwB;AAC5F,EAAA,OAAO,qBAAqB,IAAA,EAAM,CAAC,aAAa,QAAA,CAAS,UAAA,CAAW,cAAc,CAAC,CAAA;AACpF;AAFgB,MAAA,CAAA,oCAAA,EAAA,sCAAA,CAAA;AAcT,SAAS,kCAAA,CAAmC,MAAgB,YAAA,EAAsB;AACxF,EAAA,OAAO,qBAAqB,IAAA,EAAM,CAAC,aAAa,QAAA,CAAS,QAAA,CAAS,YAAY,CAAC,CAAA;AAChF;AAFgB,MAAA,CAAA,kCAAA,EAAA,oCAAA,CAAA;AAYT,SAAS,kCAAA,CAAmC,MAAgB,OAAA,EAAiB;AACnF,EAAA,OAAO,qBAAqB,IAAA,EAAM,CAAC,aAAa,QAAA,CAAS,QAAA,CAAS,OAAO,CAAC,CAAA;AAC3E;AAFgB,MAAA,CAAA,kCAAA,EAAA,oCAAA,CAAA;AAUT,SAAS,yBAAA,CAA0B,MAAgB,KAAA,EAAe;AACxE,EAAA,OAAO,qBAAqB,IAAA,EAAM,CAAC,aAAa,KAAA,CAAM,IAAA,CAAK,QAAQ,CAAC,CAAA;AACrE;AAFgB,MAAA,CAAA,yBAAA,EAAA,2BAAA,CAAA","file":"index.cjs","sourcesContent":["import type { PathLike } from 'node:fs';\nimport { opendir } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n *\n * @param path The path in which to find files.\n * @param predicate A predicate function receives the path as a parameter. Truthy values will have the path included, falsey values will have the file excluded.\n *\n * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursively(path, predicate)) {}`\n *\n * @example\n * ```typescript\n * // With CommonJS: To find all files ending with `.ts` in the src directory:\n * const path = require('node:path');\n *\n * for await (const file of findFilesRecursively(path.join(__dirname, 'src'), (filePath) => filePath.endsWith('.ts'))) {\n * console.log(file);\n * }\n * ```\n *\n * @example\n * ```typescript\n * // With ESM: To find all files ending with `.ts` in the src directory:\n * for await (const file of findFilesRecursively(new URL('src', import.meta.url), (filePath) => filePath.endsWith('.ts'))) {\n * console.log(file);\n * }\n * ```\n */\nexport async function* findFilesRecursively(path: PathLike, predicate: (filePath: string) => boolean = () => true): AsyncIterableIterator<string> {\n\tconst dir = await opendir(path);\n\n\tfor await (const item of dir) {\n\t\tif (item.isFile() && predicate(item.name)) {\n\t\t\tyield join(dir.path, item.name);\n\t\t} else if (item.isDirectory()) {\n\t\t\tyield* findFilesRecursively(join(dir.path, item.name), predicate);\n\t\t}\n\t}\n}\n\n/**\n *\n * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param fileStartsWith The string pattern with which the file name must start.\n *\n * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.startsWith}\n *\n * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringStartsWith(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyStringStartsWith(path: PathLike, fileStartsWith: string) {\n\treturn findFilesRecursively(path, (filePath) => filePath.startsWith(fileStartsWith));\n}\n\n/**\n *\n * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param fileEndsWith The string pattern with which the file name must end.\n * Ideally this is a file extension, however you can also provide more parts of the end of the file.\n *\n * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.endsWith}\n *\n * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringEndsWith(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyStringEndsWith(path: PathLike, fileEndsWith: string) {\n\treturn findFilesRecursively(path, (filePath) => filePath.endsWith(fileEndsWith));\n}\n\n/**\n * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param include The string pattern which must be present in the file name.\n *\n * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.includes}\n *\n * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringIncludes(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyStringIncludes(path: PathLike, include: string) {\n\treturn findFilesRecursively(path, (filePath) => filePath.includes(include));\n}\n\n/**\n * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param regex The regex pattern that the file name must match.\n *\n * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyRegex(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyRegex(path: PathLike, regex: RegExp) {\n\treturn findFilesRecursively(path, (filePath) => regex.test(filePath));\n}\n"]}
@@ -1,67 +0,0 @@
1
- import { PathLike } from 'node:fs';
2
-
3
- /**
4
- *
5
- * @param path The path in which to find files.
6
- * @param predicate A predicate function receives the path as a parameter. Truthy values will have the path included, falsey values will have the file excluded.
7
- *
8
- * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursively(path, predicate)) {}`
9
- *
10
- * @example
11
- * ```typescript
12
- * // With CommonJS: To find all files ending with `.ts` in the src directory:
13
- * const path = require('node:path');
14
- *
15
- * for await (const file of findFilesRecursively(path.join(__dirname, 'src'), (filePath) => filePath.endsWith('.ts'))) {
16
- * console.log(file);
17
- * }
18
- * ```
19
- *
20
- * @example
21
- * ```typescript
22
- * // With ESM: To find all files ending with `.ts` in the src directory:
23
- * for await (const file of findFilesRecursively(new URL('src', import.meta.url), (filePath) => filePath.endsWith('.ts'))) {
24
- * console.log(file);
25
- * }
26
- * ```
27
- */
28
- declare function findFilesRecursively(path: PathLike, predicate?: (filePath: string) => boolean): AsyncIterableIterator<string>;
29
- /**
30
- *
31
- * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.
32
- * @param fileStartsWith The string pattern with which the file name must start.
33
- *
34
- * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.startsWith}
35
- *
36
- * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringStartsWith(path, fileNameEndsWith)) {}`
37
- */
38
- declare function findFilesRecursivelyStringStartsWith(path: PathLike, fileStartsWith: string): AsyncIterableIterator<string>;
39
- /**
40
- *
41
- * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.
42
- * @param fileEndsWith The string pattern with which the file name must end.
43
- * Ideally this is a file extension, however you can also provide more parts of the end of the file.
44
- *
45
- * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.endsWith}
46
- *
47
- * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringEndsWith(path, fileNameEndsWith)) {}`
48
- */
49
- declare function findFilesRecursivelyStringEndsWith(path: PathLike, fileEndsWith: string): AsyncIterableIterator<string>;
50
- /**
51
- * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.
52
- * @param include The string pattern which must be present in the file name.
53
- *
54
- * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.includes}
55
- *
56
- * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringIncludes(path, fileNameEndsWith)) {}`
57
- */
58
- declare function findFilesRecursivelyStringIncludes(path: PathLike, include: string): AsyncIterableIterator<string>;
59
- /**
60
- * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.
61
- * @param regex The regex pattern that the file name must match.
62
- *
63
- * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyRegex(path, fileNameEndsWith)) {}`
64
- */
65
- declare function findFilesRecursivelyRegex(path: PathLike, regex: RegExp): AsyncIterableIterator<string>;
66
-
67
- export { findFilesRecursively, findFilesRecursivelyRegex, findFilesRecursivelyStringEndsWith, findFilesRecursivelyStringIncludes, findFilesRecursivelyStringStartsWith };
@@ -1,67 +0,0 @@
1
- import { PathLike } from 'node:fs';
2
-
3
- /**
4
- *
5
- * @param path The path in which to find files.
6
- * @param predicate A predicate function receives the path as a parameter. Truthy values will have the path included, falsey values will have the file excluded.
7
- *
8
- * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursively(path, predicate)) {}`
9
- *
10
- * @example
11
- * ```typescript
12
- * // With CommonJS: To find all files ending with `.ts` in the src directory:
13
- * const path = require('node:path');
14
- *
15
- * for await (const file of findFilesRecursively(path.join(__dirname, 'src'), (filePath) => filePath.endsWith('.ts'))) {
16
- * console.log(file);
17
- * }
18
- * ```
19
- *
20
- * @example
21
- * ```typescript
22
- * // With ESM: To find all files ending with `.ts` in the src directory:
23
- * for await (const file of findFilesRecursively(new URL('src', import.meta.url), (filePath) => filePath.endsWith('.ts'))) {
24
- * console.log(file);
25
- * }
26
- * ```
27
- */
28
- declare function findFilesRecursively(path: PathLike, predicate?: (filePath: string) => boolean): AsyncIterableIterator<string>;
29
- /**
30
- *
31
- * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.
32
- * @param fileStartsWith The string pattern with which the file name must start.
33
- *
34
- * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.startsWith}
35
- *
36
- * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringStartsWith(path, fileNameEndsWith)) {}`
37
- */
38
- declare function findFilesRecursivelyStringStartsWith(path: PathLike, fileStartsWith: string): AsyncIterableIterator<string>;
39
- /**
40
- *
41
- * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.
42
- * @param fileEndsWith The string pattern with which the file name must end.
43
- * Ideally this is a file extension, however you can also provide more parts of the end of the file.
44
- *
45
- * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.endsWith}
46
- *
47
- * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringEndsWith(path, fileNameEndsWith)) {}`
48
- */
49
- declare function findFilesRecursivelyStringEndsWith(path: PathLike, fileEndsWith: string): AsyncIterableIterator<string>;
50
- /**
51
- * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.
52
- * @param include The string pattern which must be present in the file name.
53
- *
54
- * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.includes}
55
- *
56
- * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringIncludes(path, fileNameEndsWith)) {}`
57
- */
58
- declare function findFilesRecursivelyStringIncludes(path: PathLike, include: string): AsyncIterableIterator<string>;
59
- /**
60
- * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.
61
- * @param regex The regex pattern that the file name must match.
62
- *
63
- * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyRegex(path, fileNameEndsWith)) {}`
64
- */
65
- declare function findFilesRecursivelyRegex(path: PathLike, regex: RegExp): AsyncIterableIterator<string>;
66
-
67
- export { findFilesRecursively, findFilesRecursivelyRegex, findFilesRecursivelyStringEndsWith, findFilesRecursivelyStringIncludes, findFilesRecursivelyStringStartsWith };
@@ -1,36 +0,0 @@
1
- import { opendir } from 'fs/promises';
2
- import { join } from 'path';
3
-
4
- var __defProp = Object.defineProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- async function* findFilesRecursively(path, predicate = () => true) {
7
- const dir = await opendir(path);
8
- for await (const item of dir) {
9
- if (item.isFile() && predicate(item.name)) {
10
- yield join(dir.path, item.name);
11
- } else if (item.isDirectory()) {
12
- yield* findFilesRecursively(join(dir.path, item.name), predicate);
13
- }
14
- }
15
- }
16
- __name(findFilesRecursively, "findFilesRecursively");
17
- function findFilesRecursivelyStringStartsWith(path, fileStartsWith) {
18
- return findFilesRecursively(path, (filePath) => filePath.startsWith(fileStartsWith));
19
- }
20
- __name(findFilesRecursivelyStringStartsWith, "findFilesRecursivelyStringStartsWith");
21
- function findFilesRecursivelyStringEndsWith(path, fileEndsWith) {
22
- return findFilesRecursively(path, (filePath) => filePath.endsWith(fileEndsWith));
23
- }
24
- __name(findFilesRecursivelyStringEndsWith, "findFilesRecursivelyStringEndsWith");
25
- function findFilesRecursivelyStringIncludes(path, include) {
26
- return findFilesRecursively(path, (filePath) => filePath.includes(include));
27
- }
28
- __name(findFilesRecursivelyStringIncludes, "findFilesRecursivelyStringIncludes");
29
- function findFilesRecursivelyRegex(path, regex) {
30
- return findFilesRecursively(path, (filePath) => regex.test(filePath));
31
- }
32
- __name(findFilesRecursivelyRegex, "findFilesRecursivelyRegex");
33
-
34
- export { findFilesRecursively, findFilesRecursivelyRegex, findFilesRecursivelyStringEndsWith, findFilesRecursivelyStringIncludes, findFilesRecursivelyStringStartsWith };
35
- //# sourceMappingURL=index.mjs.map
36
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/findFilesRecursively.ts"],"names":[],"mappings":";;;;;AA6BA,gBAAuB,oBAAA,CAAqB,IAAA,EAAgB,SAAA,GAA2C,MAAM,IAAA,EAAqC;AACjJ,EAAA,MAAM,GAAA,GAAM,MAAM,OAAA,CAAQ,IAAI,CAAA;AAE9B,EAAA,WAAA,MAAiB,QAAQ,GAAA,EAAK;AAC7B,IAAA,IAAI,KAAK,MAAA,EAAO,IAAK,SAAA,CAAU,IAAA,CAAK,IAAI,CAAA,EAAG;AAC1C,MAAA,MAAM,IAAA,CAAK,GAAA,CAAI,IAAA,EAAM,IAAA,CAAK,IAAI,CAAA;AAAA,IAC/B,CAAA,MAAA,IAAW,IAAA,CAAK,WAAA,EAAY,EAAG;AAC9B,MAAA,OAAO,qBAAqB,IAAA,CAAK,GAAA,CAAI,MAAM,IAAA,CAAK,IAAI,GAAG,SAAS,CAAA;AAAA,IACjE;AAAA,EACD;AACD;AAVuB,MAAA,CAAA,oBAAA,EAAA,sBAAA,CAAA;AAqBhB,SAAS,oCAAA,CAAqC,MAAgB,cAAA,EAAwB;AAC5F,EAAA,OAAO,qBAAqB,IAAA,EAAM,CAAC,aAAa,QAAA,CAAS,UAAA,CAAW,cAAc,CAAC,CAAA;AACpF;AAFgB,MAAA,CAAA,oCAAA,EAAA,sCAAA,CAAA;AAcT,SAAS,kCAAA,CAAmC,MAAgB,YAAA,EAAsB;AACxF,EAAA,OAAO,qBAAqB,IAAA,EAAM,CAAC,aAAa,QAAA,CAAS,QAAA,CAAS,YAAY,CAAC,CAAA;AAChF;AAFgB,MAAA,CAAA,kCAAA,EAAA,oCAAA,CAAA;AAYT,SAAS,kCAAA,CAAmC,MAAgB,OAAA,EAAiB;AACnF,EAAA,OAAO,qBAAqB,IAAA,EAAM,CAAC,aAAa,QAAA,CAAS,QAAA,CAAS,OAAO,CAAC,CAAA;AAC3E;AAFgB,MAAA,CAAA,kCAAA,EAAA,oCAAA,CAAA;AAUT,SAAS,yBAAA,CAA0B,MAAgB,KAAA,EAAe;AACxE,EAAA,OAAO,qBAAqB,IAAA,EAAM,CAAC,aAAa,KAAA,CAAM,IAAA,CAAK,QAAQ,CAAC,CAAA;AACrE;AAFgB,MAAA,CAAA,yBAAA,EAAA,2BAAA,CAAA","file":"index.mjs","sourcesContent":["import type { PathLike } from 'node:fs';\nimport { opendir } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n *\n * @param path The path in which to find files.\n * @param predicate A predicate function receives the path as a parameter. Truthy values will have the path included, falsey values will have the file excluded.\n *\n * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursively(path, predicate)) {}`\n *\n * @example\n * ```typescript\n * // With CommonJS: To find all files ending with `.ts` in the src directory:\n * const path = require('node:path');\n *\n * for await (const file of findFilesRecursively(path.join(__dirname, 'src'), (filePath) => filePath.endsWith('.ts'))) {\n * console.log(file);\n * }\n * ```\n *\n * @example\n * ```typescript\n * // With ESM: To find all files ending with `.ts` in the src directory:\n * for await (const file of findFilesRecursively(new URL('src', import.meta.url), (filePath) => filePath.endsWith('.ts'))) {\n * console.log(file);\n * }\n * ```\n */\nexport async function* findFilesRecursively(path: PathLike, predicate: (filePath: string) => boolean = () => true): AsyncIterableIterator<string> {\n\tconst dir = await opendir(path);\n\n\tfor await (const item of dir) {\n\t\tif (item.isFile() && predicate(item.name)) {\n\t\t\tyield join(dir.path, item.name);\n\t\t} else if (item.isDirectory()) {\n\t\t\tyield* findFilesRecursively(join(dir.path, item.name), predicate);\n\t\t}\n\t}\n}\n\n/**\n *\n * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param fileStartsWith The string pattern with which the file name must start.\n *\n * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.startsWith}\n *\n * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringStartsWith(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyStringStartsWith(path: PathLike, fileStartsWith: string) {\n\treturn findFilesRecursively(path, (filePath) => filePath.startsWith(fileStartsWith));\n}\n\n/**\n *\n * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param fileEndsWith The string pattern with which the file name must end.\n * Ideally this is a file extension, however you can also provide more parts of the end of the file.\n *\n * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.endsWith}\n *\n * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringEndsWith(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyStringEndsWith(path: PathLike, fileEndsWith: string) {\n\treturn findFilesRecursively(path, (filePath) => filePath.endsWith(fileEndsWith));\n}\n\n/**\n * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param include The string pattern which must be present in the file name.\n *\n * Note that we do **not** support a full globby pattern using asterisk for wildcards. It has to be an exact match with {@link String.includes}\n *\n * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyStringIncludes(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyStringIncludes(path: PathLike, include: string) {\n\treturn findFilesRecursively(path, (filePath) => filePath.includes(include));\n}\n\n/**\n * @param path The path in which to find files. This can be a string, buffer, or {@link URL}.\n * @param regex The regex pattern that the file name must match.\n *\n * @return An {@link AsyncIterableIterator} of all the files. To loop over these use `for await (const file of findFilesRecursivelyRegex(path, fileNameEndsWith)) {}`\n */\nexport function findFilesRecursivelyRegex(path: PathLike, regex: RegExp) {\n\treturn findFilesRecursively(path, (filePath) => regex.test(filePath));\n}\n"]}