tailwindcss 0.0.0-insiders.c8b2b9a → 0.0.0-insiders.c8bf2d4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +13 -9
  3. package/colors.d.ts +3 -0
  4. package/defaultConfig.d.ts +3 -0
  5. package/defaultTheme.d.ts +4 -0
  6. package/lib/cli/build/deps.js +54 -0
  7. package/lib/cli/build/index.js +48 -0
  8. package/lib/cli/build/plugin.js +367 -0
  9. package/lib/cli/build/utils.js +78 -0
  10. package/lib/cli/build/watching.js +178 -0
  11. package/lib/cli/help/index.js +71 -0
  12. package/lib/cli/index.js +239 -0
  13. package/lib/cli/init/index.js +46 -0
  14. package/lib/cli-peer-dependencies.js +20 -7
  15. package/lib/cli.js +4 -732
  16. package/lib/constants.js +27 -20
  17. package/lib/corePluginList.js +8 -3
  18. package/lib/corePlugins.js +2239 -1677
  19. package/lib/css/preflight.css +7 -5
  20. package/lib/featureFlags.js +40 -24
  21. package/lib/index.js +4 -28
  22. package/lib/lib/cacheInvalidation.js +90 -0
  23. package/lib/lib/collapseAdjacentRules.js +28 -10
  24. package/lib/lib/collapseDuplicateDeclarations.js +14 -11
  25. package/lib/lib/content.js +177 -0
  26. package/lib/lib/defaultExtractor.js +230 -31
  27. package/lib/lib/detectNesting.js +19 -10
  28. package/lib/lib/evaluateTailwindFunctions.js +118 -55
  29. package/lib/lib/expandApplyAtRules.js +439 -190
  30. package/lib/lib/expandTailwindAtRules.js +147 -109
  31. package/lib/lib/findAtConfigPath.js +44 -0
  32. package/lib/lib/generateRules.js +525 -202
  33. package/lib/lib/getModuleDependencies.js +11 -8
  34. package/lib/lib/normalizeTailwindDirectives.js +36 -32
  35. package/lib/lib/offsets.js +304 -0
  36. package/lib/lib/partitionApplyAtRules.js +11 -8
  37. package/lib/lib/regex.js +60 -0
  38. package/lib/lib/remap-bitfield.js +87 -0
  39. package/lib/lib/resolveDefaultsAtRules.js +89 -67
  40. package/lib/lib/setupContextUtils.js +714 -310
  41. package/lib/lib/setupTrackingContext.js +60 -68
  42. package/lib/lib/sharedState.js +44 -14
  43. package/lib/lib/substituteScreenAtRules.js +11 -9
  44. package/lib/oxide/cli/build/deps.js +81 -0
  45. package/lib/oxide/cli/build/index.js +47 -0
  46. package/lib/oxide/cli/build/plugin.js +364 -0
  47. package/lib/oxide/cli/build/utils.js +77 -0
  48. package/lib/oxide/cli/build/watching.js +177 -0
  49. package/lib/oxide/cli/help/index.js +70 -0
  50. package/lib/oxide/cli/index.js +220 -0
  51. package/lib/oxide/cli/init/index.js +35 -0
  52. package/lib/oxide/cli.js +5 -0
  53. package/lib/oxide/postcss-plugin.js +2 -0
  54. package/lib/plugin.js +98 -0
  55. package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
  56. package/lib/postcss-plugins/nesting/index.js +19 -0
  57. package/lib/postcss-plugins/nesting/plugin.js +87 -0
  58. package/lib/processTailwindFeatures.js +35 -27
  59. package/lib/public/colors.js +247 -245
  60. package/lib/public/create-plugin.js +6 -4
  61. package/lib/public/default-config.js +7 -5
  62. package/lib/public/default-theme.js +7 -5
  63. package/lib/public/resolve-config.js +8 -5
  64. package/lib/util/bigSign.js +4 -1
  65. package/lib/util/buildMediaQuery.js +11 -6
  66. package/lib/util/cloneDeep.js +7 -6
  67. package/lib/util/cloneNodes.js +21 -3
  68. package/lib/util/color.js +64 -51
  69. package/lib/util/configurePlugins.js +5 -2
  70. package/lib/util/createPlugin.js +6 -5
  71. package/lib/util/createUtilityPlugin.js +10 -8
  72. package/lib/util/dataTypes.js +143 -110
  73. package/lib/util/defaults.js +8 -5
  74. package/lib/util/escapeClassName.js +9 -6
  75. package/lib/util/escapeCommas.js +5 -2
  76. package/lib/util/flattenColorPalette.js +9 -10
  77. package/lib/util/formatVariantSelector.js +268 -113
  78. package/lib/util/getAllConfigs.js +29 -10
  79. package/lib/util/hashConfig.js +6 -3
  80. package/lib/util/isKeyframeRule.js +5 -2
  81. package/lib/util/isPlainObject.js +5 -2
  82. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +23 -15
  83. package/lib/util/log.js +20 -14
  84. package/lib/util/nameClass.js +20 -9
  85. package/lib/util/negateValue.js +23 -8
  86. package/lib/util/normalizeConfig.js +124 -74
  87. package/lib/util/normalizeScreens.js +119 -8
  88. package/lib/util/parseAnimationValue.js +42 -40
  89. package/lib/util/parseBoxShadowValue.js +30 -23
  90. package/lib/util/parseDependency.js +38 -56
  91. package/lib/util/parseGlob.js +34 -0
  92. package/lib/util/parseObjectStyles.js +11 -8
  93. package/lib/util/pluginUtils.js +143 -58
  94. package/lib/util/prefixSelector.js +27 -11
  95. package/lib/util/removeAlphaVariables.js +29 -0
  96. package/lib/util/resolveConfig.js +93 -72
  97. package/lib/util/resolveConfigPath.js +10 -7
  98. package/lib/util/responsive.js +8 -5
  99. package/lib/util/splitAtTopLevelOnly.js +43 -0
  100. package/lib/util/tap.js +4 -1
  101. package/lib/util/toColorValue.js +5 -2
  102. package/lib/util/toPath.js +20 -4
  103. package/lib/util/transformThemeValue.js +37 -25
  104. package/lib/util/validateConfig.js +24 -0
  105. package/lib/util/validateFormalSyntax.js +24 -0
  106. package/lib/util/withAlphaVariable.js +23 -15
  107. package/nesting/index.js +2 -12
  108. package/package.json +58 -44
  109. package/peers/index.js +11453 -8088
  110. package/plugin.d.ts +11 -0
  111. package/resolveConfig.d.ts +12 -0
  112. package/scripts/generate-types.js +105 -0
  113. package/scripts/release-channel.js +18 -0
  114. package/scripts/release-notes.js +21 -0
  115. package/scripts/swap-engines.js +40 -0
  116. package/scripts/type-utils.js +27 -0
  117. package/src/cli/build/deps.js +56 -0
  118. package/src/cli/build/index.js +49 -0
  119. package/src/cli/build/plugin.js +439 -0
  120. package/src/cli/build/utils.js +76 -0
  121. package/src/cli/build/watching.js +227 -0
  122. package/src/cli/help/index.js +70 -0
  123. package/src/cli/index.js +234 -0
  124. package/src/cli/init/index.js +50 -0
  125. package/src/cli-peer-dependencies.js +7 -1
  126. package/src/cli.js +4 -810
  127. package/src/corePluginList.js +1 -1
  128. package/src/corePlugins.js +524 -62
  129. package/src/css/preflight.css +7 -5
  130. package/src/featureFlags.js +18 -4
  131. package/src/index.js +4 -27
  132. package/src/lib/cacheInvalidation.js +52 -0
  133. package/src/lib/collapseAdjacentRules.js +21 -2
  134. package/src/lib/content.js +208 -0
  135. package/src/lib/defaultExtractor.js +202 -33
  136. package/src/lib/detectNesting.js +9 -1
  137. package/src/lib/evaluateTailwindFunctions.js +78 -7
  138. package/src/lib/expandApplyAtRules.js +482 -183
  139. package/src/lib/expandTailwindAtRules.js +99 -63
  140. package/src/lib/findAtConfigPath.js +48 -0
  141. package/src/lib/generateRules.js +506 -145
  142. package/src/lib/normalizeTailwindDirectives.js +1 -0
  143. package/src/lib/offsets.js +373 -0
  144. package/src/lib/regex.js +74 -0
  145. package/src/lib/remap-bitfield.js +82 -0
  146. package/src/lib/resolveDefaultsAtRules.js +53 -32
  147. package/src/lib/setupContextUtils.js +640 -174
  148. package/src/lib/setupTrackingContext.js +42 -54
  149. package/src/lib/sharedState.js +21 -0
  150. package/src/oxide/cli/build/deps.ts +91 -0
  151. package/src/oxide/cli/build/index.ts +47 -0
  152. package/src/oxide/cli/build/plugin.ts +436 -0
  153. package/src/oxide/cli/build/utils.ts +74 -0
  154. package/src/oxide/cli/build/watching.ts +225 -0
  155. package/src/oxide/cli/help/index.ts +69 -0
  156. package/src/oxide/cli/index.ts +212 -0
  157. package/src/oxide/cli/init/index.ts +32 -0
  158. package/src/oxide/cli.ts +1 -0
  159. package/src/oxide/postcss-plugin.ts +1 -0
  160. package/src/plugin.js +107 -0
  161. package/src/postcss-plugins/nesting/README.md +42 -0
  162. package/src/postcss-plugins/nesting/index.js +13 -0
  163. package/src/postcss-plugins/nesting/plugin.js +80 -0
  164. package/src/processTailwindFeatures.js +6 -0
  165. package/src/util/buildMediaQuery.js +5 -3
  166. package/src/util/cloneNodes.js +19 -2
  167. package/src/util/color.js +38 -19
  168. package/src/util/dataTypes.js +54 -21
  169. package/src/util/formatVariantSelector.js +317 -101
  170. package/src/util/getAllConfigs.js +19 -0
  171. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  172. package/src/util/log.js +8 -8
  173. package/src/util/nameClass.js +4 -0
  174. package/src/util/negateValue.js +11 -3
  175. package/src/util/normalizeConfig.js +44 -6
  176. package/src/util/normalizeScreens.js +99 -4
  177. package/src/util/parseBoxShadowValue.js +4 -3
  178. package/src/util/parseDependency.js +37 -42
  179. package/src/util/parseGlob.js +24 -0
  180. package/src/util/pluginUtils.js +127 -24
  181. package/src/util/prefixSelector.js +30 -10
  182. package/src/util/removeAlphaVariables.js +24 -0
  183. package/src/util/resolveConfig.js +70 -32
  184. package/src/util/splitAtTopLevelOnly.js +45 -0
  185. package/src/util/toPath.js +1 -1
  186. package/src/util/transformThemeValue.js +13 -3
  187. package/src/util/validateConfig.js +13 -0
  188. package/src/util/validateFormalSyntax.js +34 -0
  189. package/src/util/withAlphaVariable.js +1 -1
  190. package/stubs/defaultConfig.stub.js +171 -164
  191. package/stubs/simpleConfig.stub.js +1 -0
  192. package/types/config.d.ts +373 -0
  193. package/types/generated/.gitkeep +0 -0
  194. package/types/generated/colors.d.ts +276 -0
  195. package/types/generated/corePluginList.d.ts +1 -0
  196. package/types/generated/default-theme.d.ts +345 -0
  197. package/types/index.d.ts +7 -0
  198. package/CHANGELOG.md +0 -1975
  199. package/nesting/plugin.js +0 -41
  200. package/scripts/install-integrations.js +0 -27
  201. package/scripts/rebuildFixtures.js +0 -68
@@ -1,21 +1,16 @@
1
- import fs from 'fs'
2
- import path from 'path'
1
+ // @ts-check
3
2
 
4
- import fastGlob from 'fast-glob'
3
+ import fs from 'fs'
5
4
  import LRU from 'quick-lru'
6
- import normalizePath from 'normalize-path'
7
5
 
8
6
  import hash from '../util/hashConfig'
9
7
  import getModuleDependencies from '../lib/getModuleDependencies'
10
-
11
8
  import resolveConfig from '../public/resolve-config'
12
-
13
9
  import resolveConfigPath from '../util/resolveConfigPath'
14
-
15
- import { env } from './sharedState'
16
-
17
10
  import { getContext, getFileModifiedMap } from './setupContextUtils'
18
11
  import parseDependency from '../util/parseDependency'
12
+ import { validateConfig } from '../util/validateConfig.js'
13
+ import { parseCandidateFiles, resolvedChangedContent } from './content.js'
19
14
 
20
15
  let configPathCache = new LRU({ maxSize: 100 })
21
16
 
@@ -26,9 +21,7 @@ function getCandidateFiles(context, tailwindConfig) {
26
21
  return candidateFilesCache.get(context)
27
22
  }
28
23
 
29
- let candidateFiles = tailwindConfig.content.files
30
- .filter((item) => typeof item === 'string')
31
- .map((contentPath) => normalizePath(contentPath))
24
+ let candidateFiles = parseCandidateFiles(context, tailwindConfig)
32
25
 
33
26
  return candidateFilesCache.set(context, candidateFiles).get(context)
34
27
  }
@@ -63,6 +56,7 @@ function getTailwindConfig(configOrPath) {
63
56
  delete require.cache[file]
64
57
  }
65
58
  let newConfig = resolveConfig(require(userConfigPath))
59
+ newConfig = validateConfig(newConfig)
66
60
  let newHash = hash(newConfig)
67
61
  configPathCache.set(userConfigPath, [newConfig, newHash, newDeps, newModified])
68
62
  return [newConfig, userConfigPath, newHash, newDeps]
@@ -73,37 +67,9 @@ function getTailwindConfig(configOrPath) {
73
67
  configOrPath.config === undefined ? configOrPath : configOrPath.config
74
68
  )
75
69
 
76
- return [newConfig, null, hash(newConfig), []]
77
- }
78
-
79
- function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
80
- let changedContent = context.tailwindConfig.content.files
81
- .filter((item) => typeof item.raw === 'string')
82
- .map(({ raw, extension = 'html' }) => ({ content: raw, extension }))
83
-
84
- for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)) {
85
- let content = fs.readFileSync(changedFile, 'utf8')
86
- let extension = path.extname(changedFile).slice(1)
87
- changedContent.push({ content, extension })
88
- }
89
- return changedContent
90
- }
70
+ newConfig = validateConfig(newConfig)
91
71
 
92
- function resolveChangedFiles(candidateFiles, fileModifiedMap) {
93
- let changedFiles = new Set()
94
- env.DEBUG && console.time('Finding changed files')
95
- let files = fastGlob.sync(candidateFiles)
96
- for (let file of files) {
97
- let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity
98
- let modified = fs.statSync(file).mtimeMs
99
-
100
- if (modified > prevModified) {
101
- changedFiles.add(file)
102
- fileModifiedMap.set(file, modified)
103
- }
104
- }
105
- env.DEBUG && console.timeEnd('Finding changed files')
106
- return changedFiles
72
+ return [newConfig, null, hash(newConfig), []]
107
73
  }
108
74
 
109
75
  // DISABLE_TOUCH = TRUE
@@ -112,7 +78,7 @@ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
112
78
  // source path), or set up a new one (including setting up watchers and registering
113
79
  // plugins) then return it
114
80
  export default function setupTrackingContext(configOrPath) {
115
- return ({ tailwindDirectives, registerDependency, applyDirectives }) => {
81
+ return ({ tailwindDirectives, registerDependency }) => {
116
82
  return (root, result) => {
117
83
  let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] =
118
84
  getTailwindConfig(configOrPath)
@@ -125,7 +91,7 @@ export default function setupTrackingContext(configOrPath) {
125
91
  // being part of this trigger too, but it's tough because it's impossible
126
92
  // for a layer in one file to end up in the actual @tailwind rule in
127
93
  // another file since independent sources are effectively isolated.
128
- if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
94
+ if (tailwindDirectives.size > 0) {
129
95
  // Add current css file as a context dependencies.
130
96
  contextDependencies.add(result.opts.from)
131
97
 
@@ -137,7 +103,7 @@ export default function setupTrackingContext(configOrPath) {
137
103
  }
138
104
  }
139
105
 
140
- let [context] = getContext(
106
+ let [context, , mTimesToCommit] = getContext(
141
107
  root,
142
108
  result,
143
109
  tailwindConfig,
@@ -146,6 +112,8 @@ export default function setupTrackingContext(configOrPath) {
146
112
  contextDependencies
147
113
  )
148
114
 
115
+ let fileModifiedMap = getFileModifiedMap(context)
116
+
149
117
  let candidateFiles = getCandidateFiles(context, tailwindConfig)
150
118
 
151
119
  // If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
@@ -153,23 +121,36 @@ export default function setupTrackingContext(configOrPath) {
153
121
  // We may want to think about `@layer` being part of this trigger too, but it's tough
154
122
  // because it's impossible for a layer in one file to end up in the actual @tailwind rule
155
123
  // in another file since independent sources are effectively isolated.
156
- if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
157
- let fileModifiedMap = getFileModifiedMap(context)
158
-
124
+ if (tailwindDirectives.size > 0) {
159
125
  // Add template paths as postcss dependencies.
160
- for (let fileOrGlob of candidateFiles) {
161
- let dependency = parseDependency(fileOrGlob)
162
- if (dependency) {
126
+ for (let contentPath of candidateFiles) {
127
+ for (let dependency of parseDependency(contentPath)) {
163
128
  registerDependency(dependency)
164
129
  }
165
130
  }
166
131
 
167
- for (let changedContent of resolvedChangedContent(
132
+ let [changedContent, contentMTimesToCommit] = resolvedChangedContent(
168
133
  context,
169
134
  candidateFiles,
170
135
  fileModifiedMap
171
- )) {
172
- context.changedContent.push(changedContent)
136
+ )
137
+
138
+ for (let content of changedContent) {
139
+ context.changedContent.push(content)
140
+ }
141
+
142
+ // Add the mtimes of the content files to the commit list
143
+ // We can overwrite the existing values because unconditionally
144
+ // This is because:
145
+ // 1. Most of the files here won't be in the map yet
146
+ // 2. If they are that means it's a context dependency
147
+ // and we're reading this after the context. This means
148
+ // that the mtime we just read is strictly >= the context
149
+ // mtime. Unless the user / os is doing something weird
150
+ // in which the mtime would be going backwards. If that
151
+ // happens there's already going to be problems.
152
+ for (let [path, mtime] of contentMTimesToCommit.entries()) {
153
+ mTimesToCommit.set(path, mtime)
173
154
  }
174
155
  }
175
156
 
@@ -177,6 +158,13 @@ export default function setupTrackingContext(configOrPath) {
177
158
  registerDependency({ type: 'dependency', file })
178
159
  }
179
160
 
161
+ // "commit" the new modified time for all context deps
162
+ // We do this here because we want content tracking to
163
+ // read the "old" mtime even when it's a context dependency.
164
+ for (let [path, mtime] of mTimesToCommit.entries()) {
165
+ fileModifiedMap.set(path, mtime)
166
+ }
167
+
180
168
  return context
181
169
  }
182
170
  }
@@ -1,10 +1,31 @@
1
+ import pkg from '../../package.json'
2
+ let OXIDE_DEFAULT_ENABLED = pkg.tailwindcss.engine === 'oxide'
3
+
1
4
  export const env = {
2
5
  NODE_ENV: process.env.NODE_ENV,
3
6
  DEBUG: resolveDebug(process.env.DEBUG),
7
+ ENGINE: pkg.tailwindcss.engine,
8
+ OXIDE: resolveBoolean(process.env.OXIDE, OXIDE_DEFAULT_ENABLED),
4
9
  }
5
10
  export const contextMap = new Map()
6
11
  export const configContextMap = new Map()
7
12
  export const contextSourcesMap = new Map()
13
+ export const sourceHashMap = new Map()
14
+ export const NOT_ON_DEMAND = new String('*')
15
+
16
+ export const NONE = Symbol('__NONE__')
17
+
18
+ function resolveBoolean(value, defaultValue) {
19
+ if (value === undefined) {
20
+ return defaultValue
21
+ }
22
+
23
+ if (value === '0' || value === 'false') {
24
+ return false
25
+ }
26
+
27
+ return true
28
+ }
8
29
 
9
30
  export function resolveDebug(debug) {
10
31
  if (debug === undefined) {
@@ -0,0 +1,91 @@
1
+ import packageJson from '../../../../package.json'
2
+ import browserslist from 'browserslist'
3
+ import { Result } from 'postcss'
4
+
5
+ import {
6
+ // @ts-ignore
7
+ lazyPostcss,
8
+
9
+ // @ts-ignore
10
+ lazyPostcssImport,
11
+
12
+ // @ts-ignore
13
+ lazyCssnano,
14
+
15
+ // @ts-ignore
16
+ } from '../../../../peers/index'
17
+
18
+ export function lazyLightningCss() {
19
+ // TODO: Make this lazy/bundled
20
+ return require('lightningcss')
21
+ }
22
+
23
+ let lightningCss
24
+
25
+ function loadLightningCss() {
26
+ if (lightningCss) {
27
+ return lightningCss
28
+ }
29
+
30
+ // Try to load a local version first
31
+ try {
32
+ return (lightningCss = require('lightningcss'))
33
+ } catch {}
34
+
35
+ return (lightningCss = lazyLightningCss())
36
+ }
37
+
38
+ export async function lightningcss(shouldMinify: boolean, result: Result) {
39
+ let css = loadLightningCss()
40
+
41
+ try {
42
+ let transformed = css.transform({
43
+ filename: result.opts.from || 'input.css',
44
+ code: Buffer.from(result.css, 'utf-8'),
45
+ minify: shouldMinify,
46
+ sourceMap: !!result.map,
47
+ inputSourceMap: result.map ? result.map.toString() : undefined,
48
+ targets: css.browserslistToTargets(browserslist(packageJson.browserslist)),
49
+ drafts: {
50
+ nesting: true,
51
+ },
52
+ })
53
+
54
+ return Object.assign(result, {
55
+ css: transformed.code.toString('utf8'),
56
+ map: result.map
57
+ ? Object.assign(result.map, {
58
+ toString() {
59
+ return transformed.map.toString()
60
+ },
61
+ })
62
+ : result.map,
63
+ })
64
+ } catch (err) {
65
+ console.error('Unable to use Lightning CSS. Using raw version instead.')
66
+ console.error(err)
67
+
68
+ return result
69
+ }
70
+ }
71
+
72
+ /**
73
+ * @returns {import('postcss')}
74
+ */
75
+ export function loadPostcss() {
76
+ // Try to load a local `postcss` version first
77
+ try {
78
+ return require('postcss')
79
+ } catch {}
80
+
81
+ return lazyPostcss()
82
+ }
83
+
84
+ export function loadPostcssImport() {
85
+ // Try to load a local `postcss-import` version first
86
+ try {
87
+ return require('postcss-import')
88
+ } catch {}
89
+
90
+ return lazyPostcssImport()
91
+ }
@@ -0,0 +1,47 @@
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+ import { createProcessor } from './plugin'
4
+
5
+ export async function build(args, configs) {
6
+ let input = args['--input']
7
+ let shouldWatch = args['--watch']
8
+
9
+ // TODO: Deprecate this in future versions
10
+ if (!input && args['_'][1]) {
11
+ console.error('[deprecation] Running tailwindcss without -i, please provide an input file.')
12
+ input = args['--input'] = args['_'][1]
13
+ }
14
+
15
+ if (input && input !== '-' && !fs.existsSync((input = path.resolve(input)))) {
16
+ console.error(`Specified input file ${args['--input']} does not exist.`)
17
+ process.exit(9)
18
+ }
19
+
20
+ if (args['--config'] && !fs.existsSync((args['--config'] = path.resolve(args['--config'])))) {
21
+ console.error(`Specified config file ${args['--config']} does not exist.`)
22
+ process.exit(9)
23
+ }
24
+
25
+ // TODO: Reference the @config path here if exists
26
+ let configPath = args['--config']
27
+ ? args['--config']
28
+ : ((defaultPath) => (fs.existsSync(defaultPath) ? defaultPath : null))(
29
+ path.resolve(`./${configs.tailwind}`)
30
+ )
31
+
32
+ let processor = await createProcessor(args, configPath)
33
+
34
+ if (shouldWatch) {
35
+ // Abort the watcher if stdin is closed to avoid zombie processes
36
+ // You can disable this behavior with --watch=always
37
+ if (args['--watch'] !== 'always') {
38
+ process.stdin.on('end', () => process.exit(0))
39
+ }
40
+
41
+ process.stdin.resume()
42
+
43
+ await processor.watch()
44
+ } else {
45
+ await processor.build()
46
+ }
47
+ }