1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
diff --git a/packages/tailwindcss-class-names/src/index.js b/packages/tailwindcss-class-names/src/index.js
index 4b55f764d6dcd4cc0fcd94de0eb57d01dfdf3a6e..e7a78ef2631705cd256f89f1009e49e20ab74eaa 100644
--- a/packages/tailwindcss-class-names/src/index.js
+++ b/packages/tailwindcss-class-names/src/index.js
@@ -3,8 +3,6 @@ import Hook from './hook.mjs'
import dlv from 'dlv'
import dset from 'dset'
import importFrom from 'import-from'
-import nodeGlob from 'glob'
-import * as path from 'path'
import chokidar from 'chokidar'
import semver from 'semver'
import invariant from 'tiny-invariant'
@@ -12,6 +10,8 @@ import getPlugins from './getPlugins'
import getVariants from './getVariants'
import resolveConfig from './resolveConfig'
import * as util from 'util'
+import { glob } from './glob'
+import { getUtilityConfigMap } from './getUtilityConfigMap'
function TailwindConfigError(error) {
Error.call(this)
@@ -23,25 +23,6 @@ this.stack = error.stack
}
util.inherits(TailwindConfigError, Error)
-
-function glob(pattern, options = {}) {
- return new Promise((resolve, reject) => {
- let g = new nodeGlob.Glob(pattern, options)
- let matches = []
- let max = dlv(options, 'max', Infinity)
- g.on('match', (match) => {
- matches.push(path.resolve(options.cwd || process.cwd(), match))
- if (matches.length === max) {
- g.abort()
- resolve(matches)
- }
- })
- g.on('end', () => {
- resolve(matches)
- })
- g.on('error', reject)
- })
-}
function arraysEqual(arr1, arr2) {
return (
@@ -109,14 +90,21 @@ } else {
delete config[sepLocation]
}
+ const resolvedConfig = resolveConfig({ cwd, config })
+
return {
configPath,
- config: resolveConfig({ cwd, config }),
+ config: resolvedConfig,
separator: typeof userSeperator === 'undefined' ? ':' : userSeperator,
classNames: await extractClassNames(ast),
dependencies: hook.deps,
plugins: getPlugins(config),
variants: getVariants({ config, version, postcss }),
+ utilityConfigMap: await getUtilityConfigMap({
+ cwd,
+ resolvedConfig,
+ postcss,
+ }),
}
}
|