@@ -20,7 +20,7 @@ const DEBUG = env.DEBUG
2020
2121interface CacheEntry {
2222 mtimes : Map < string , number >
23- compiler : null | Awaited < ReturnType < typeof compileAst > >
23+ compiler : null | ReturnType < typeof compileAst >
2424 scanner : null | Scanner
2525 tailwindCssAst : AstNode [ ]
2626 cachedPostCssAst : postcss . Root
@@ -138,9 +138,9 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin {
138138
139139 // Setup the compiler if it doesn't exist yet. This way we can
140140 // guarantee a `build()` function is available.
141- context . compiler ??= await createCompiler ( )
141+ context . compiler ??= createCompiler ( )
142142
143- if ( context . compiler . features === Features . None ) {
143+ if ( ( await context . compiler ) . features === Features . None ) {
144144 return
145145 }
146146
@@ -188,25 +188,26 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin {
188188 // initial build. If it wasn't, we need to create a new one.
189189 ! isInitialBuild
190190 ) {
191- context . compiler = await createCompiler ( )
191+ context . compiler = createCompiler ( )
192192 }
193193
194194 if ( context . scanner === null || rebuildStrategy === 'full' ) {
195195 DEBUG && I . start ( 'Setup scanner' )
196+ let compiler = await context . compiler
196197 let sources = ( ( ) => {
197198 // Disable auto source detection
198- if ( context . compiler . root === 'none' ) {
199+ if ( compiler . root === 'none' ) {
199200 return [ ]
200201 }
201202
202203 // No root specified, use the base directory
203- if ( context . compiler . root === null ) {
204+ if ( compiler . root === null ) {
204205 return [ { base, pattern : '**/*' , negated : false } ]
205206 }
206207
207208 // Use the specified root
208- return [ { ...context . compiler . root , negated : false } ]
209- } ) ( ) . concat ( context . compiler . sources )
209+ return [ { ...compiler . root , negated : false } ]
210+ } ) ( ) . concat ( compiler . sources )
210211
211212 // Look for candidates used to generate the CSS
212213 context . scanner = new Scanner ( { sources } )
@@ -215,10 +216,10 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin {
215216
216217 DEBUG && I . start ( 'Scan for candidates' )
217218 let candidates =
218- context . compiler . features & Features . Utilities ? context . scanner . scan ( ) : [ ]
219+ ( await context . compiler ) . features & Features . Utilities ? context . scanner . scan ( ) : [ ]
219220 DEBUG && I . end ( 'Scan for candidates' )
220221
221- if ( context . compiler . features & Features . Utilities ) {
222+ if ( ( await context . compiler ) . features & Features . Utilities ) {
222223 DEBUG && I . start ( 'Register dependency messages' )
223224 // Add all found files as direct dependencies
224225 for ( let file of context . scanner . files ) {
@@ -267,7 +268,7 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin {
267268 }
268269
269270 DEBUG && I . start ( 'Build utilities' )
270- let tailwindCssAst = context . compiler . build ( candidates )
271+ let tailwindCssAst = ( await context . compiler ) . build ( candidates )
271272 DEBUG && I . end ( 'Build utilities' )
272273
273274 if ( context . tailwindCssAst !== tailwindCssAst ) {
0 commit comments