@@ -60,21 +60,21 @@ function getLoadersFromObject(element) {
6060 throw new Error ( "Element from loaders list should have one of the fields 'loader' or 'loaders'" ) ;
6161}
6262
63- LoadersList . prototype . matchPart = function matchPart ( str , test ) {
63+ LoadersList . prototype . matchPart = function matchPart ( str , test , context ) {
6464 if ( ! test ) return true ;
6565 var matcher = asMatcher ( test ) ;
66- return matcher ( str ) ;
66+ return matcher ( str , context ) ;
6767} ;
6868
69- LoadersList . prototype . match = function match ( str ) {
69+ LoadersList . prototype . match = function match ( str , context ) {
7070 return this . list . map ( function ( element ) {
7171 if ( Array . isArray ( element ) ) {
7272 for ( var i = 0 ; i < element . length ; i ++ ) {
73- if ( this . matchObject ( str , element [ i ] ) )
73+ if ( this . matchObject ( str , element [ i ] , context ) )
7474 return getLoadersFromObject ( element [ i ] ) ;
7575 }
7676 } else {
77- if ( this . matchObject ( str , element ) )
77+ if ( this . matchObject ( str , element , context ) )
7878 return getLoadersFromObject ( element ) ;
7979 }
8080 } , this ) . filter ( Boolean ) . reduce ( function ( array , r ) {
@@ -85,12 +85,12 @@ LoadersList.prototype.match = function match(str) {
8585 } , [ ] ) || [ ] ;
8686} ;
8787
88- LoadersList . prototype . matchObject = function matchObject ( str , obj ) {
88+ LoadersList . prototype . matchObject = function matchObject ( str , obj , context ) {
8989 if ( obj . test )
90- if ( ! this . matchPart ( str , obj . test ) ) return false ;
90+ if ( ! this . matchPart ( str , obj . test , context ) ) return false ;
9191 if ( obj . include )
92- if ( ! this . matchPart ( str , obj . include ) ) return false ;
92+ if ( ! this . matchPart ( str , obj . include , context ) ) return false ;
9393 if ( obj . exclude )
94- if ( this . matchPart ( str , obj . exclude ) ) return false ;
94+ if ( this . matchPart ( str , obj . exclude , context ) ) return false ;
9595 return true ;
9696} ;
0 commit comments