@@ -52,13 +52,12 @@ const {
5252} = require ( 'internal/validators' ) ;
5353
5454const {
55- getLazy,
5655 emitExperimentalWarning,
5756 isWindows,
58- isMacOS ,
57+ getLazy ,
5958} = require ( 'internal/util' ) ;
6059
61- const lazyMinimatch = getLazy ( ( ) => require ( 'internal/deps/minimatch/index' ) ) ;
60+ const lazyGlob = getLazy ( ( ) => require ( 'internal/fs/glob' ) . glob ) ;
6261
6362function isPathSeparator ( code ) {
6463 return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH ;
@@ -164,22 +163,6 @@ function _format(sep, pathObject) {
164163 return dir === pathObject . root ? `${ dir } ${ base } ` : `${ dir } ${ sep } ${ base } ` ;
165164}
166165
167- function glob ( path , pattern , windows ) {
168- emitExperimentalWarning ( 'glob' ) ;
169- validateString ( path , 'path' ) ;
170- validateString ( pattern , 'pattern' ) ;
171- return lazyMinimatch ( ) . minimatch ( path , pattern , {
172- __proto__ : null ,
173- nocase : isMacOS || isWindows ,
174- windowsPathsNoEscape : true ,
175- nonegate : true ,
176- nocomment : true ,
177- optimizationLevel : 2 ,
178- platform : windows ? 'win32' : 'posix' ,
179- nocaseMagicOnly : true ,
180- } ) ;
181- }
182-
183166const win32 = {
184167 /**
185168 * path.resolve([from ...], to)
@@ -1140,7 +1123,8 @@ const win32 = {
11401123 } ,
11411124
11421125 matchesGlob ( path , pattern ) {
1143- return glob ( path , pattern , true ) ;
1126+ emitExperimentalWarning ( 'glob' ) ;
1127+ return lazyGlob ( ) ( path , pattern , true ) ;
11441128 } ,
11451129
11461130 sep : '\\' ,
@@ -1616,7 +1600,8 @@ const posix = {
16161600 } ,
16171601
16181602 matchesGlob ( path , pattern ) {
1619- return glob ( path , pattern , false ) ;
1603+ emitExperimentalWarning ( 'glob' ) ;
1604+ return lazyGlob ( ) ( path , pattern , false ) ;
16201605 } ,
16211606
16221607 sep : '/' ,
0 commit comments