Skip to content

Commit 906e0bf

Browse files
chore: natively use Node Glob v10 async support (#1886)
* fix(glob): no longer need custom async adapter. Also bump its types to v9 * Correct types --------- Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
1 parent 713c55e commit 906e0bf

File tree

5 files changed

+5
-40
lines changed

5 files changed

+5
-40
lines changed

package-lock.json

Lines changed: 0 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"@swc/core": "1.15.3",
2626
"@swc/jest": "0.2.39",
2727
"@types/eslint-config-prettier": "6.11.3",
28-
"@types/glob": "9.0.0",
2928
"@types/json5": "2.2.0",
3029
"@types/lodash": "4.17.21",
3130
"@types/minimatch": "5.1.2",

src/adapters/globAsync.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/api/dependencies.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import { glob } from "glob";
2+
13
import { childProcessExec } from "../adapters/childProcessExec";
24
import { fsFileSystem } from "../adapters/fsFileSystem";
3-
import { globAsync } from "../adapters/globAsync";
45
import { nativeImporter } from "../adapters/nativeImporter";
56
import { processLogger } from "../adapters/processLogger";
67
import { bind } from "../binding";
@@ -125,7 +126,7 @@ export const collectCommentFileNamesDependencies: CollectCommentFileNamesDepende
125126
};
126127

127128
export const extractGlobPathsDependencies: ExtractGlobPathsDependencies = {
128-
globAsync,
129+
globAsync: glob,
129130
};
130131

131132
export const convertCommentsDependencies: ConvertCommentsDependencies = {

src/converters/comments/extractGlobPaths.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import minimatch from "minimatch";
22

3-
import { GlobAsync } from "../../adapters/globAsync";
43
import { CommentFileNames } from "../../comments/collectCommentFileNames";
54
import { ResultStatus, ResultWithDataStatus } from "../../types";
65
import { separateErrors, uniqueFromSources } from "../../utils";
76

87
export type ExtractGlobPathsDependencies = {
9-
globAsync: GlobAsync;
8+
globAsync: (pattern: string) => Promise<Error | string[]>;
109
};
1110

1211
export const extractGlobPaths = async (
1312
dependencies: ExtractGlobPathsDependencies,
1413
{ exclude, include }: CommentFileNames,
1514
): Promise<ResultWithDataStatus<string[]>> => {
1615
const [fileGlobErrors, globbedFilePaths] = separateErrors(
17-
await Promise.all(include.map(dependencies.globAsync)),
16+
await Promise.all(include.map(async (pattern) => dependencies.globAsync(pattern))),
1817
);
1918

2019
if (fileGlobErrors.length !== 0) {

0 commit comments

Comments
 (0)