@@ -88,26 +88,46 @@ class StylelintWebpackPlugin {
8888 compiler . hooks . thisCompilation . tap ( this . key , ( compilation ) => {
8989 /** @type {import('./linter').Linter } */
9090 let lint ;
91+
92+ /** @type {import('stylelint').InternalApi } */
93+ let api ;
94+
9195 /** @type {import('./linter').Reporter } */
9296 let report ;
97+
9398 /** @type number */
9499 let threads ;
95100
96101 try {
97- ( { lint, report, threads } = linter ( this . key , options , compilation ) ) ;
102+ ( { lint, api, report, threads } = linter (
103+ this . key ,
104+ options ,
105+ compilation
106+ ) ) ;
98107 } catch ( e ) {
99108 compilation . errors . push ( e ) ;
100109 return ;
101110 }
102111
103- compilation . hooks . finishModules . tap ( this . key , ( ) => {
104- const files = compiler . modifiedFiles
105- ? Array . from ( compiler . modifiedFiles ) . filter (
106- ( file ) =>
107- isMatch ( file , wanted , { dot : true } ) &&
108- ! isMatch ( file , exclude , { dot : true } )
109- )
110- : globby . sync ( wanted , { dot : true , ignore : exclude } ) ;
112+ compilation . hooks . finishModules . tapPromise ( this . key , async ( ) => {
113+ const files = (
114+ await Promise . all (
115+ ( compiler . modifiedFiles
116+ ? Array . from ( compiler . modifiedFiles ) . filter (
117+ ( file ) =>
118+ isMatch ( file , wanted , { dot : true } ) &&
119+ ! isMatch ( file , exclude , { dot : true } )
120+ )
121+ : globby . sync ( wanted , { dot : true , ignore : exclude } )
122+ ) . map ( async ( /** @type {string | undefined } */ file ) => {
123+ try {
124+ return ( await api . isPathIgnored ( file ) ) ? false : file ;
125+ } catch ( e ) {
126+ return file ;
127+ }
128+ } )
129+ )
130+ ) . filter ( ( file ) => file !== false ) ;
111131
112132 if ( threads > 1 ) {
113133 for ( const file of files ) {
0 commit comments