diff --git a/package-lock.json b/package-lock.json index 53df9958f..10c1ff95f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,6 @@ "@swc/core": "1.15.3", "@swc/jest": "0.2.39", "@types/eslint-config-prettier": "6.11.3", - "@types/glob": "9.0.0", "@types/json5": "2.2.0", "@types/lodash": "4.17.21", "@types/minimatch": "5.1.2", @@ -1587,16 +1586,6 @@ "integrity": "sha512-3wXCiM8croUnhg9LdtZUJQwNcQYGWxxdOWDjPe1ykCqJFPVpzAKfs/2dgSoCtAvdPeaponcWPI7mPcGGp9dkKQ==", "dev": true }, - "node_modules/@types/glob": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-9.0.0.tgz", - "integrity": "sha512-00UxlRaIUvYm4R4W9WYkN8/J+kV8fmOQ7okeH6YFtGWFMt3odD45tpG5yA5wnL7HE6lLgjaTW5n14ju2hl2NNA==", - "deprecated": "This is a stub types definition. glob provides its own type definitions, so you do not need this installed.", - "dev": true, - "dependencies": { - "glob": "*" - } - }, "node_modules/@types/graceful-fs": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", @@ -8316,15 +8305,6 @@ "integrity": "sha512-3wXCiM8croUnhg9LdtZUJQwNcQYGWxxdOWDjPe1ykCqJFPVpzAKfs/2dgSoCtAvdPeaponcWPI7mPcGGp9dkKQ==", "dev": true }, - "@types/glob": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-9.0.0.tgz", - "integrity": "sha512-00UxlRaIUvYm4R4W9WYkN8/J+kV8fmOQ7okeH6YFtGWFMt3odD45tpG5yA5wnL7HE6lLgjaTW5n14ju2hl2NNA==", - "dev": true, - "requires": { - "glob": "*" - } - }, "@types/graceful-fs": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", diff --git a/package.json b/package.json index 9c2fae3f8..367fc5680 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "@swc/core": "1.15.3", "@swc/jest": "0.2.39", "@types/eslint-config-prettier": "6.11.3", - "@types/glob": "9.0.0", "@types/json5": "2.2.0", "@types/lodash": "4.17.21", "@types/minimatch": "5.1.2", diff --git a/src/adapters/globAsync.ts b/src/adapters/globAsync.ts deleted file mode 100644 index 3f1c7dae2..000000000 --- a/src/adapters/globAsync.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { glob } from "glob"; - -export const globAsync = async (pattern: string) => { - return new Promise((resolve) => { - /* eslint-disable */ - // @ts-expect-error -- Will be removed in #1886. - glob(pattern, (error, matches) => { - resolve(error ?? matches); - }); - /* eslint-enable */ - }); -}; - -export type GlobAsync = typeof globAsync; diff --git a/src/api/dependencies.ts b/src/api/dependencies.ts index a9fd55454..b74d8add2 100644 --- a/src/api/dependencies.ts +++ b/src/api/dependencies.ts @@ -1,6 +1,7 @@ +import { glob } from "glob"; + import { childProcessExec } from "../adapters/childProcessExec"; import { fsFileSystem } from "../adapters/fsFileSystem"; -import { globAsync } from "../adapters/globAsync"; import { nativeImporter } from "../adapters/nativeImporter"; import { processLogger } from "../adapters/processLogger"; import { bind } from "../binding"; @@ -125,7 +126,7 @@ export const collectCommentFileNamesDependencies: CollectCommentFileNamesDepende }; export const extractGlobPathsDependencies: ExtractGlobPathsDependencies = { - globAsync, + globAsync: glob, }; export const convertCommentsDependencies: ConvertCommentsDependencies = { diff --git a/src/converters/comments/extractGlobPaths.ts b/src/converters/comments/extractGlobPaths.ts index 99bb6fac8..b2d1bd08c 100644 --- a/src/converters/comments/extractGlobPaths.ts +++ b/src/converters/comments/extractGlobPaths.ts @@ -1,12 +1,11 @@ import minimatch from "minimatch"; -import { GlobAsync } from "../../adapters/globAsync"; import { CommentFileNames } from "../../comments/collectCommentFileNames"; import { ResultStatus, ResultWithDataStatus } from "../../types"; import { separateErrors, uniqueFromSources } from "../../utils"; export type ExtractGlobPathsDependencies = { - globAsync: GlobAsync; + globAsync: (pattern: string) => Promise; }; export const extractGlobPaths = async ( @@ -14,7 +13,7 @@ export const extractGlobPaths = async ( { exclude, include }: CommentFileNames, ): Promise> => { const [fileGlobErrors, globbedFilePaths] = separateErrors( - await Promise.all(include.map(dependencies.globAsync)), + await Promise.all(include.map(async (pattern) => dependencies.globAsync(pattern))), ); if (fileGlobErrors.length !== 0) {