1
1
import type { GetFilesOptions , OptimizeResult } from './types'
2
- import { Glob } from 'bun'
3
2
import { stat } from 'node:fs/promises'
4
3
import { relative , resolve } from 'node:path'
5
4
import { config } from './config'
@@ -25,7 +24,7 @@ export async function getFiles(
25
24
26
25
// Process include patterns
27
26
for ( const pattern of patterns ) {
28
- const glob = new Glob ( pattern )
27
+ const glob = new Bun . Glob ( pattern )
29
28
for await ( const file of glob . scan ( {
30
29
...scanOptions ,
31
30
cwd : path ,
@@ -39,7 +38,7 @@ export async function getFiles(
39
38
// Process ignore patterns
40
39
if ( ignore . length > 0 ) {
41
40
for ( const pattern of ignore ) {
42
- const glob = new Glob ( pattern )
41
+ const glob = new Bun . Glob ( pattern )
43
42
for await ( const file of glob . scan ( {
44
43
...scanOptions ,
45
44
cwd : path ,
@@ -94,15 +93,15 @@ export async function watchFiles(
94
93
95
94
export function isPathMatching ( path : string , patterns : string [ ] ) : boolean {
96
95
return patterns . some ( ( pattern ) => {
97
- const glob = new Glob ( pattern )
96
+ const glob = new Bun . Glob ( pattern )
98
97
return glob . match ( path )
99
98
} )
100
99
}
101
100
102
101
export function filterPaths ( paths : string [ ] , include : string [ ] , exclude : string [ ] = [ ] ) : string [ ] {
103
102
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 ) ) ,
106
105
)
107
106
}
108
107
0 commit comments