@@ -44,43 +44,52 @@ class AbstractAdapter extends AbstractReaderWriter {
4444 * @param {module:@ui5/fs.tracing.Trace } trace Trace instance
4545 * @returns {Promise<module:@ui5/fs.Resource[]> } Promise resolving to list of resources
4646 */
47- _byGlob ( virPattern , options = { nodir : true } , trace ) {
48- const excludes = this . _excludesNegated ;
49-
47+ async _byGlob ( virPattern , options = { nodir : true } , trace ) {
5048 if ( ! ( virPattern instanceof Array ) ) {
5149 virPattern = [ virPattern ] ;
5250 }
5351
54- // Append static exclude patterns
55- virPattern = Array . prototype . concat . apply ( virPattern , excludes ) ;
52+ let patterns = await Promise . all ( virPattern . map ( this . _normalizePattern , this ) ) ;
53+ patterns = Array . prototype . concat . apply ( [ ] , patterns ) ;
54+ if ( patterns . length === 0 ) {
55+ return [ ] ;
56+ }
5657
57- return Promise . all ( virPattern . map ( this . _normalizePattern , this ) ) . then ( ( patterns ) => {
58- patterns = Array . prototype . concat . apply ( [ ] , patterns ) ;
59- if ( patterns . length === 0 ) {
60- return [ ] ;
61- }
58+ const excludePatterns = await this . _getExcludePattern ( ) ;
6259
63- if ( ! options . nodir ) {
64- for ( let i = patterns . length - 1 ; i >= 0 ; i -- ) {
65- const idx = this . _virBaseDir . indexOf ( patterns [ i ] ) ;
66- if ( patterns [ i ] && idx !== - 1 && idx < this . _virBaseDir . length ) {
67- const subPath = patterns [ i ] ;
68- return Promise . resolve ( [
69- new Resource ( {
70- project : this . project ,
71- statInfo : { // TODO: make closer to fs stat info
72- isDirectory : function ( ) {
73- return true ;
74- }
75- } ,
76- path : subPath
77- } )
78- ] ) ;
79- }
60+ if ( ! options . nodir ) {
61+ for ( let i = patterns . length - 1 ; i >= 0 ; i -- ) {
62+ const idx = this . _virBaseDir . indexOf ( patterns [ i ] ) ;
63+ if ( patterns [ i ] && idx !== - 1 && idx < this . _virBaseDir . length ) {
64+ const subPath = patterns [ i ] ;
65+ return Promise . resolve ( [
66+ new Resource ( {
67+ project : this . project ,
68+ statInfo : { // TODO: make closer to fs stat info
69+ isDirectory : function ( ) {
70+ return true ;
71+ }
72+ } ,
73+ path : subPath
74+ } )
75+ ] ) ;
8076 }
8177 }
82- return this . _runGlob ( patterns , options , trace ) ;
83- } ) ;
78+ }
79+ return this . _runGlob ( patterns , {
80+ nodir : options . nodir ,
81+ ignore : excludePatterns
82+ } , trace ) ;
83+ }
84+
85+ async _getExcludePattern ( ) {
86+ if ( this . _normalizedExcludes ) {
87+ return this . _normalizedExcludes ;
88+ }
89+ return this . _normalizedExcludes = Promise . all ( this . _excludes . map ( this . _normalizePattern , this ) )
90+ . then ( ( excludePatterns ) => {
91+ return Array . prototype . concat . apply ( [ ] , excludePatterns ) ;
92+ } ) ;
8493 }
8594
8695 /**
0 commit comments