Skip to content

Commit d3219cf

Browse files
talentlessguyalcuadrado
authored andcommitted
replace glob with tinyglobby
1 parent f6ac346 commit d3219cf

File tree

3 files changed

+37
-14
lines changed

3 files changed

+37
-14
lines changed

packages/hardhat-core/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
"@types/debug": "^4.1.4",
6969
"@types/find-up": "^2.1.1",
7070
"@types/fs-extra": "^5.1.0",
71-
"@types/glob": "^7.1.1",
7271
"@types/keccak": "^3.0.1",
7372
"@types/lodash": "^4.14.123",
7473
"@types/mocha": ">=9.1.0",
@@ -125,7 +124,6 @@
125124
"find-up": "^2.1.0",
126125
"fp-ts": "1.19.3",
127126
"fs-extra": "^7.0.1",
128-
"glob": "7.2.0",
129127
"immutable": "^4.0.0-rc.12",
130128
"io-ts": "1.10.4",
131129
"json-stream-stringify": "^3.1.4",
@@ -140,6 +138,7 @@
140138
"solc": "0.8.26",
141139
"source-map-support": "^0.5.13",
142140
"stacktrace-parser": "^0.1.10",
141+
"tinyglobby": "^0.2.6",
143142
"tsort": "0.0.1",
144143
"undici": "^5.14.0",
145144
"uuid": "^8.3.2",

packages/hardhat-core/src/internal/util/glob.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import type { IOptions as GlobOptions } from "glob";
2-
1+
import type { GlobOptions } from "tinyglobby";
32
import * as path from "path";
4-
import util from "util";
53

64
/**
75
* DO NOT USE THIS FUNCTION. It's SLOW and its semantics are optimized for
@@ -16,8 +14,7 @@ export async function glob(
1614
pattern: string,
1715
options: GlobOptions = {}
1816
): Promise<string[]> {
19-
const { default: globModule } = await import("glob");
20-
const files = await util.promisify(globModule)(pattern, options);
17+
const files = await (await import('tinyglobby')).glob([pattern], options);
2118
return files.map(path.normalize);
2219
}
2320

@@ -26,6 +23,6 @@ export async function glob(
2623
* @see glob
2724
*/
2825
export function globSync(pattern: string, options: GlobOptions = {}): string[] {
29-
const files = require("glob").sync(pattern, options);
26+
const files = (require('tinyglobby') as typeof import('tinyglobby')).globSync([pattern], options);
3027
return files.map(path.normalize);
3128
}

pnpm-lock.yaml

+33-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)