Skip to content

Commit 8c5b11c

Browse files
committed
chore: use Bun.Glob
1 parent f4bcd27 commit 8c5b11c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

packages/imgx/src/utils.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { GetFilesOptions, OptimizeResult } from './types'
2-
import { Glob } from 'bun'
32
import { stat } from 'node:fs/promises'
43
import { relative, resolve } from 'node:path'
54
import { config } from './config'
@@ -25,7 +24,7 @@ export async function getFiles(
2524

2625
// Process include patterns
2726
for (const pattern of patterns) {
28-
const glob = new Glob(pattern)
27+
const glob = new Bun.Glob(pattern)
2928
for await (const file of glob.scan({
3029
...scanOptions,
3130
cwd: path,
@@ -39,7 +38,7 @@ export async function getFiles(
3938
// Process ignore patterns
4039
if (ignore.length > 0) {
4140
for (const pattern of ignore) {
42-
const glob = new Glob(pattern)
41+
const glob = new Bun.Glob(pattern)
4342
for await (const file of glob.scan({
4443
...scanOptions,
4544
cwd: path,
@@ -94,15 +93,15 @@ export async function watchFiles(
9493

9594
export function isPathMatching(path: string, patterns: string[]): boolean {
9695
return patterns.some((pattern) => {
97-
const glob = new Glob(pattern)
96+
const glob = new Bun.Glob(pattern)
9897
return glob.match(path)
9998
})
10099
}
101100

102101
export function filterPaths(paths: string[], include: string[], exclude: string[] = []): string[] {
103102
return paths.filter(path =>
104-
include.some(pattern => new Glob(pattern).match(path))
105-
&& !exclude.some(pattern => new Glob(pattern).match(path)),
103+
include.some(pattern => new Bun.Glob(pattern).match(path))
104+
&& !exclude.some(pattern => new Bun.Glob(pattern).match(path)),
106105
)
107106
}
108107

0 commit comments

Comments
 (0)