@@ -3,15 +3,15 @@ import Hook from './hook.mjs'
33import dlv from 'dlv'
44import dset from 'dset'
55import importFrom from 'import-from'
6- import nodeGlob from 'glob'
7- import * as path from 'path'
86import chokidar from 'chokidar'
97import semver from 'semver'
108import invariant from 'tiny-invariant'
119import getPlugins from './getPlugins'
1210import getVariants from './getVariants'
1311import resolveConfig from './resolveConfig'
1412import * as util from 'util'
13+ import { glob } from './glob'
14+ import { getUtilityConfigMap } from './getUtilityConfigMap'
1515
1616function TailwindConfigError ( error ) {
1717 Error . call ( this )
@@ -24,25 +24,6 @@ function TailwindConfigError(error) {
2424
2525util . inherits ( TailwindConfigError , Error )
2626
27- function glob ( pattern , options = { } ) {
28- return new Promise ( ( resolve , reject ) => {
29- let g = new nodeGlob . Glob ( pattern , options )
30- let matches = [ ]
31- let max = dlv ( options , 'max' , Infinity )
32- g . on ( 'match' , ( match ) => {
33- matches . push ( path . resolve ( options . cwd || process . cwd ( ) , match ) )
34- if ( matches . length === max ) {
35- g . abort ( )
36- resolve ( matches )
37- }
38- } )
39- g . on ( 'end' , ( ) => {
40- resolve ( matches )
41- } )
42- g . on ( 'error' , reject )
43- } )
44- }
45-
4627function arraysEqual ( arr1 , arr2 ) {
4728 return (
4829 JSON . stringify ( arr1 . concat ( [ ] ) . sort ( ) ) ===
@@ -109,14 +90,21 @@ export default async function getClassNames(
10990 delete config [ sepLocation ]
11091 }
11192
93+ const resolvedConfig = resolveConfig ( { cwd, config } )
94+
11295 return {
11396 configPath,
114- config : resolveConfig ( { cwd , config } ) ,
97+ config : resolvedConfig ,
11598 separator : typeof userSeperator === 'undefined' ? ':' : userSeperator ,
11699 classNames : await extractClassNames ( ast ) ,
117100 dependencies : hook . deps ,
118101 plugins : getPlugins ( config ) ,
119102 variants : getVariants ( { config, version, postcss } ) ,
103+ utilityConfigMap : await getUtilityConfigMap ( {
104+ cwd,
105+ resolvedConfig,
106+ postcss,
107+ } ) ,
120108 }
121109 }
122110
0 commit comments