@@ -8,7 +8,6 @@ import { promisify } from 'node:util'
88const readFile = promisify ( fs . readFile )
99const readdir = promisify ( fs . readdir )
1010
11- const GlobOptions = { dot : true , silent : false }
1211const IncludeRegex = / ^ - { 2 , 3 } [ \t ] * @ i n c l u d e [ \t ] + ( [ " ' ] ) ( .+ ?) \1[ ; \t \n ] * $ / m
1312const EmptyLineRegex = / ^ \s * [ \r \n ] / gm
1413
@@ -195,41 +194,17 @@ export class ScriptLoader {
195194 throw new ScriptLoaderError ( msg , file . path , stack , pos . line , pos . column )
196195 }
197196
198- const minimatch = await import ( 'minimatch' )
199-
200- if ( ! minimatch ) {
201- console . warn ( 'Install minimatch as dev-dependency' )
202- }
203-
204- const Minimatch = minimatch . Minimatch || class Empty { }
205-
206- const fg = await import ( 'fast-glob' )
207-
208- if ( ! fg ) {
209- console . warn ( 'Install fast-glob as dev-dependency' )
210- }
211-
212- const nonOp = ( ) => {
213- return [ '' ]
197+ const hasFilenamePattern = ( filePath : string ) : boolean => {
198+ return / [ * ? [ \] { } ] / . test ( filePath )
214199 }
215- const glob = ( fg as any ) ?. default . glob || nonOp
216-
217- const hasMagic = ( pattern : string | string [ ] ) : boolean => {
218- if ( ! Array . isArray ( pattern ) ) {
219- pattern = [ pattern ]
220- }
221- for ( const p of pattern ) {
222- if ( ( new Minimatch ( p , GlobOptions ) as any ) . hasMagic ( ) ) {
223- return true
224- }
225- }
226- return false
227- }
228-
229- const hasFilenamePattern = ( path : string ) => hasMagic ( path )
230200
231201 async function getFilenamesByPattern ( pattern : string ) : Promise < string [ ] > {
232- return glob ( pattern , { dot : true } )
202+ const glob = new Bun . Glob ( pattern )
203+ const results : string [ ] = [ ]
204+ for await ( const match of glob . scan ( { dot : true } ) ) {
205+ results . push ( match )
206+ }
207+ return results
233208 }
234209
235210 let res
0 commit comments