@@ -2,8 +2,8 @@ import { promises as fsPromises, readFileSync, statSync } from 'fs';
22import { createRequire } from 'module' ;
33import { extname , join } from 'path' ;
44import { cwd } from 'process' ;
5- import globby , { GlobbyOptions , sync as globbySync } from 'globby' ;
65import { DocumentNode , parse } from 'graphql' ;
6+ import { GlobOptions , globSync , glob as tinyglobby } from 'tinyglobby' ;
77import unixify from 'unixify' ;
88
99const { readFile, stat } = fsPromises ;
@@ -63,8 +63,8 @@ async function isDirectory(path: string) {
6363 }
6464}
6565
66- function scanForFilesSync ( globStr : string | string [ ] , globOptions : GlobbyOptions = { } ) : string [ ] {
67- return globbySync ( globStr , { absolute : true , ...globOptions } ) ;
66+ function scanForFilesSync ( globStr : string | string [ ] , globOptions : GlobOptions = { } ) : string [ ] {
67+ return globSync ( globStr , { absolute : true , ...globOptions } ) ;
6868}
6969
7070function formatExtension ( extension : string ) : string {
@@ -98,8 +98,8 @@ export interface LoadFilesOptions {
9898 useRequire ?: boolean ;
9999 // An alternative to `require` to use if `require` would be used to load a file
100100 requireMethod ?: any ;
101- // Additional options to pass to globby
102- globOptions ?: GlobbyOptions ;
101+ // Additional options to pass to tinyglobby
102+ globOptions ?: GlobOptions ;
103103 // Named exports to extract from each file. Defaults to ['typeDefs', 'schema']
104104 exportNames ?: string [ ] ;
105105 // Load files from nested directories. Set to `false` to only search the top-level directory.
@@ -138,12 +138,12 @@ export function loadFilesSync<T = any>(
138138 asArray ( pattern ) . map ( path =>
139139 isDirectorySync ( path )
140140 ? buildGlob (
141- unixify ( path ) ,
141+ unixifyWithDriveLetter ( path ) ,
142142 execOptions . extensions ,
143143 execOptions . ignoredExtensions ,
144144 execOptions . recursive ,
145145 )
146- : unixify ( path ) ,
146+ : unixifyWithDriveLetter ( path ) ,
147147 ) ,
148148 options . globOptions ,
149149 ) ;
@@ -181,11 +181,19 @@ export function loadFilesSync<T = any>(
181181 . filter ( v => v ) ;
182182}
183183
184+ function unixifyWithDriveLetter ( path : string ) : string {
185+ if ( path . match ( / ^ [ A - Z ] : \\ / ) ) {
186+ const driveLetter = path [ 0 ] ;
187+ return `${ driveLetter } :${ unixify ( path ) } ` ;
188+ }
189+ return unixify ( path ) ;
190+ }
191+
184192async function scanForFiles (
185193 globStr : string | string [ ] ,
186- globOptions : GlobbyOptions = { } ,
194+ globOptions : GlobOptions = { } ,
187195) : Promise < string [ ] > {
188- return globby ( globStr , { absolute : true , ...globOptions } ) ;
196+ return tinyglobby ( globStr , { absolute : true , ...globOptions } ) ;
189197}
190198
191199const checkExtension = (
0 commit comments