tailwindcss 0.0.0-insiders.ebc1c7a → 0.0.0-insiders.ec0049a

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 (165) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +18 -11
  3. package/dist/chunk-AZANAYY2.mjs +1 -0
  4. package/dist/chunk-CH45MXZF.mjs +10 -0
  5. package/dist/chunk-V2K3XTS4.mjs +1 -0
  6. package/dist/colors-b_6i0Oi7.d.ts +295 -0
  7. package/dist/colors.d.mts +295 -0
  8. package/dist/colors.d.ts +5 -0
  9. package/dist/colors.js +1 -0
  10. package/dist/colors.mjs +1 -0
  11. package/dist/default-theme.d.mts +1147 -0
  12. package/dist/default-theme.d.ts +1147 -0
  13. package/dist/default-theme.js +1 -0
  14. package/dist/default-theme.mjs +1 -0
  15. package/dist/flatten-color-palette.d.mts +6 -0
  16. package/dist/flatten-color-palette.d.ts +6 -0
  17. package/dist/flatten-color-palette.js +1 -0
  18. package/dist/flatten-color-palette.mjs +1 -0
  19. package/dist/lib.d.mts +260 -0
  20. package/dist/lib.d.ts +3 -0
  21. package/dist/lib.js +33 -0
  22. package/dist/lib.mjs +24 -0
  23. package/dist/plugin.d.mts +11 -0
  24. package/dist/plugin.d.ts +104 -0
  25. package/dist/plugin.js +1 -0
  26. package/dist/plugin.mjs +1 -0
  27. package/dist/resolve-config-BIFUA2FY.d.ts +29 -0
  28. package/dist/resolve-config-QUZ9b-Gn.d.mts +190 -0
  29. package/dist/types-B254mqw1.d.mts +98 -0
  30. package/index.css +865 -0
  31. package/package.json +73 -110
  32. package/preflight.css +383 -0
  33. package/theme.css +453 -0
  34. package/CHANGELOG.md +0 -1742
  35. package/base.css +0 -1
  36. package/colors.js +0 -304
  37. package/components.css +0 -1
  38. package/defaultConfig.js +0 -4
  39. package/defaultTheme.js +0 -4
  40. package/lib/cli-peer-dependencies.js +0 -20
  41. package/lib/cli.js +0 -765
  42. package/lib/constants.js +0 -37
  43. package/lib/corePluginList.js +0 -8
  44. package/lib/corePlugins.js +0 -2977
  45. package/lib/css/LICENSE +0 -25
  46. package/lib/css/preflight.css +0 -354
  47. package/lib/featureFlags.js +0 -60
  48. package/lib/index.js +0 -31
  49. package/lib/lib/collapseAdjacentRules.js +0 -43
  50. package/lib/lib/evaluateTailwindFunctions.js +0 -192
  51. package/lib/lib/expandApplyAtRules.js +0 -245
  52. package/lib/lib/expandTailwindAtRules.js +0 -260
  53. package/lib/lib/generateRules.js +0 -362
  54. package/lib/lib/getModuleDependencies.js +0 -53
  55. package/lib/lib/normalizeTailwindDirectives.js +0 -68
  56. package/lib/lib/resolveDefaultsAtRules.js +0 -105
  57. package/lib/lib/setupContextUtils.js +0 -643
  58. package/lib/lib/setupTrackingContext.js +0 -190
  59. package/lib/lib/setupWatchingContext.js +0 -331
  60. package/lib/lib/sharedState.js +0 -29
  61. package/lib/lib/substituteScreenAtRules.js +0 -31
  62. package/lib/processTailwindFeatures.js +0 -57
  63. package/lib/util/bigSign.js +0 -10
  64. package/lib/util/buildMediaQuery.js +0 -36
  65. package/lib/util/cloneDeep.js +0 -18
  66. package/lib/util/cloneNodes.js +0 -18
  67. package/lib/util/color.js +0 -74
  68. package/lib/util/configurePlugins.js +0 -19
  69. package/lib/util/createPlugin.js +0 -33
  70. package/lib/util/createUtilityPlugin.js +0 -51
  71. package/lib/util/defaults.js +0 -20
  72. package/lib/util/escapeClassName.js +0 -21
  73. package/lib/util/escapeCommas.js +0 -10
  74. package/lib/util/flattenColorPalette.js +0 -15
  75. package/lib/util/getAllConfigs.js +0 -22
  76. package/lib/util/hashConfig.js +0 -16
  77. package/lib/util/isKeyframeRule.js +0 -10
  78. package/lib/util/isPlainObject.js +0 -15
  79. package/lib/util/log.js +0 -38
  80. package/lib/util/nameClass.js +0 -32
  81. package/lib/util/negateValue.js +0 -20
  82. package/lib/util/parseAnimationValue.js +0 -60
  83. package/lib/util/parseDependency.js +0 -74
  84. package/lib/util/parseObjectStyles.js +0 -28
  85. package/lib/util/pluginUtils.js +0 -318
  86. package/lib/util/prefixSelector.js +0 -23
  87. package/lib/util/resolveConfig.js +0 -289
  88. package/lib/util/resolveConfigPath.js +0 -59
  89. package/lib/util/responsive.js +0 -18
  90. package/lib/util/tap.js +0 -11
  91. package/lib/util/toColorValue.js +0 -10
  92. package/lib/util/toPath.js +0 -11
  93. package/lib/util/transformThemeValue.js +0 -32
  94. package/lib/util/withAlphaVariable.js +0 -65
  95. package/nesting/README.md +0 -42
  96. package/nesting/index.js +0 -12
  97. package/nesting/plugin.js +0 -41
  98. package/peers/index.js +0 -87302
  99. package/plugin.js +0 -3
  100. package/prettier.config.js +0 -19
  101. package/resolveConfig.js +0 -7
  102. package/screens.css +0 -1
  103. package/scripts/create-plugin-list.js +0 -10
  104. package/scripts/install-integrations.js +0 -27
  105. package/scripts/rebuildFixtures.js +0 -68
  106. package/src/cli-peer-dependencies.js +0 -9
  107. package/src/cli.js +0 -759
  108. package/src/constants.js +0 -17
  109. package/src/corePluginList.js +0 -1
  110. package/src/corePlugins.js +0 -2228
  111. package/src/css/LICENSE +0 -25
  112. package/src/css/preflight.css +0 -354
  113. package/src/featureFlags.js +0 -48
  114. package/src/index.js +0 -34
  115. package/src/lib/collapseAdjacentRules.js +0 -39
  116. package/src/lib/evaluateTailwindFunctions.js +0 -195
  117. package/src/lib/expandApplyAtRules.js +0 -251
  118. package/src/lib/expandTailwindAtRules.js +0 -262
  119. package/src/lib/generateRules.js +0 -319
  120. package/src/lib/getModuleDependencies.js +0 -39
  121. package/src/lib/normalizeTailwindDirectives.js +0 -77
  122. package/src/lib/resolveDefaultsAtRules.js +0 -105
  123. package/src/lib/setupContextUtils.js +0 -639
  124. package/src/lib/setupTrackingContext.js +0 -181
  125. package/src/lib/setupWatchingContext.js +0 -306
  126. package/src/lib/sharedState.js +0 -13
  127. package/src/lib/substituteScreenAtRules.js +0 -16
  128. package/src/processTailwindFeatures.js +0 -41
  129. package/src/util/bigSign.js +0 -3
  130. package/src/util/buildMediaQuery.js +0 -24
  131. package/src/util/cloneDeep.js +0 -11
  132. package/src/util/cloneNodes.js +0 -11
  133. package/src/util/color.js +0 -56
  134. package/src/util/configurePlugins.js +0 -23
  135. package/src/util/createPlugin.js +0 -27
  136. package/src/util/createUtilityPlugin.js +0 -46
  137. package/src/util/defaults.js +0 -11
  138. package/src/util/escapeClassName.js +0 -8
  139. package/src/util/escapeCommas.js +0 -3
  140. package/src/util/flattenColorPalette.js +0 -13
  141. package/src/util/getAllConfigs.js +0 -19
  142. package/src/util/hashConfig.js +0 -5
  143. package/src/util/isKeyframeRule.js +0 -3
  144. package/src/util/isPlainObject.js +0 -8
  145. package/src/util/log.js +0 -28
  146. package/src/util/nameClass.js +0 -22
  147. package/src/util/negateValue.js +0 -14
  148. package/src/util/parseAnimationValue.js +0 -62
  149. package/src/util/parseDependency.js +0 -45
  150. package/src/util/parseObjectStyles.js +0 -19
  151. package/src/util/pluginUtils.js +0 -295
  152. package/src/util/prefixSelector.js +0 -15
  153. package/src/util/resolveConfig.js +0 -282
  154. package/src/util/resolveConfigPath.js +0 -55
  155. package/src/util/responsive.js +0 -10
  156. package/src/util/tap.js +0 -4
  157. package/src/util/toColorValue.js +0 -3
  158. package/src/util/toPath.js +0 -4
  159. package/src/util/transformThemeValue.js +0 -37
  160. package/src/util/withAlphaVariable.js +0 -44
  161. package/stubs/defaultConfig.stub.js +0 -884
  162. package/stubs/defaultPostCssConfig.stub.js +0 -6
  163. package/stubs/simpleConfig.stub.js +0 -8
  164. package/tailwind.css +0 -5
  165. package/variants.css +0 -1
@@ -1,181 +0,0 @@
1
- import fs from 'fs'
2
- import path from 'path'
3
-
4
- import fastGlob from 'fast-glob'
5
- import LRU from 'quick-lru'
6
- import normalizePath from 'normalize-path'
7
-
8
- import hash from '../util/hashConfig'
9
- import getModuleDependencies from '../lib/getModuleDependencies'
10
-
11
- import resolveConfig from '../../resolveConfig'
12
-
13
- import resolveConfigPath from '../util/resolveConfigPath'
14
-
15
- import { env } from './sharedState'
16
-
17
- import { getContext, getFileModifiedMap } from './setupContextUtils'
18
- import parseDependency from '../util/parseDependency'
19
-
20
- let configPathCache = new LRU({ maxSize: 100 })
21
-
22
- let candidateFilesCache = new WeakMap()
23
-
24
- function getCandidateFiles(context, tailwindConfig) {
25
- if (candidateFilesCache.has(context)) {
26
- return candidateFilesCache.get(context)
27
- }
28
-
29
- let candidateFiles = tailwindConfig.content.content
30
- .filter((item) => typeof item === 'string')
31
- .map((contentPath) => normalizePath(path.resolve(contentPath)))
32
-
33
- return candidateFilesCache.set(context, candidateFiles).get(context)
34
- }
35
-
36
- // Get the config object based on a path
37
- function getTailwindConfig(configOrPath) {
38
- let userConfigPath = resolveConfigPath(configOrPath)
39
-
40
- if (userConfigPath !== null) {
41
- let [prevConfig, prevConfigHash, prevDeps, prevModified] =
42
- configPathCache.get(userConfigPath) || []
43
-
44
- let newDeps = getModuleDependencies(userConfigPath).map((dep) => dep.file)
45
-
46
- let modified = false
47
- let newModified = new Map()
48
- for (let file of newDeps) {
49
- let time = fs.statSync(file).mtimeMs
50
- newModified.set(file, time)
51
- if (!prevModified || !prevModified.has(file) || time > prevModified.get(file)) {
52
- modified = true
53
- }
54
- }
55
-
56
- // It hasn't changed (based on timestamps)
57
- if (!modified) {
58
- return [prevConfig, userConfigPath, prevConfigHash, prevDeps]
59
- }
60
-
61
- // It has changed (based on timestamps), or first run
62
- for (let file of newDeps) {
63
- delete require.cache[file]
64
- }
65
- let newConfig = resolveConfig(require(userConfigPath))
66
- let newHash = hash(newConfig)
67
- configPathCache.set(userConfigPath, [newConfig, newHash, newDeps, newModified])
68
- return [newConfig, userConfigPath, newHash, newDeps]
69
- }
70
-
71
- // It's a plain object, not a path
72
- let newConfig = resolveConfig(
73
- configOrPath.config === undefined ? configOrPath : configOrPath.config
74
- )
75
-
76
- return [newConfig, null, hash(newConfig), []]
77
- }
78
-
79
- function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
80
- let changedContent = context.tailwindConfig.content.content
81
- .filter((item) => typeof item.raw === 'string')
82
- .concat(context.tailwindConfig.content.safelist)
83
- .map(({ raw, extension }) => ({ content: raw, extension }))
84
-
85
- for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)) {
86
- let content = fs.readFileSync(changedFile, 'utf8')
87
- let extension = path.extname(changedFile).slice(1)
88
- changedContent.push({ content, extension })
89
- }
90
- return changedContent
91
- }
92
-
93
- function resolveChangedFiles(candidateFiles, fileModifiedMap) {
94
- let changedFiles = new Set()
95
- env.DEBUG && console.time('Finding changed files')
96
- let files = fastGlob.sync(candidateFiles)
97
- for (let file of files) {
98
- let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity
99
- let modified = fs.statSync(file).mtimeMs
100
-
101
- if (modified > prevModified) {
102
- changedFiles.add(file)
103
- fileModifiedMap.set(file, modified)
104
- }
105
- }
106
- env.DEBUG && console.timeEnd('Finding changed files')
107
- return changedFiles
108
- }
109
-
110
- // DISABLE_TOUCH = TRUE
111
-
112
- // Retrieve an existing context from cache if possible (since contexts are unique per
113
- // source path), or set up a new one (including setting up watchers and registering
114
- // plugins) then return it
115
- export default function setupTrackingContext(configOrPath) {
116
- return ({ tailwindDirectives, registerDependency }) => {
117
- return (root, result) => {
118
- let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] =
119
- getTailwindConfig(configOrPath)
120
-
121
- let contextDependencies = new Set(configDependencies)
122
-
123
- // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
124
- // to be dependencies of the context. Can reuse the context even if they change.
125
- // We may want to think about `@layer` being part of this trigger too, but it's tough
126
- // because it's impossible for a layer in one file to end up in the actual @tailwind rule
127
- // in another file since independent sources are effectively isolated.
128
- if (tailwindDirectives.size > 0) {
129
- // Add current css file as a context dependencies.
130
- contextDependencies.add(result.opts.from)
131
-
132
- // Add all css @import dependencies as context dependencies.
133
- for (let message of result.messages) {
134
- if (message.type === 'dependency') {
135
- contextDependencies.add(message.file)
136
- }
137
- }
138
- }
139
-
140
- let [context] = getContext(
141
- tailwindDirectives,
142
- root,
143
- result,
144
- tailwindConfig,
145
- userConfigPath,
146
- tailwindConfigHash,
147
- contextDependencies
148
- )
149
-
150
- let candidateFiles = getCandidateFiles(context, tailwindConfig)
151
-
152
- // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
153
- // to be dependencies of the context. Can reuse the context even if they change.
154
- // We may want to think about `@layer` being part of this trigger too, but it's tough
155
- // because it's impossible for a layer in one file to end up in the actual @tailwind rule
156
- // in another file since independent sources are effectively isolated.
157
- if (tailwindDirectives.size > 0) {
158
- let fileModifiedMap = getFileModifiedMap(context)
159
-
160
- // Add template paths as postcss dependencies.
161
- for (let fileOrGlob of candidateFiles) {
162
- registerDependency(parseDependency(fileOrGlob))
163
- }
164
-
165
- for (let changedContent of resolvedChangedContent(
166
- context,
167
- candidateFiles,
168
- fileModifiedMap
169
- )) {
170
- context.changedContent.push(changedContent)
171
- }
172
- }
173
-
174
- for (let file of configDependencies) {
175
- registerDependency({ type: 'dependency', file })
176
- }
177
-
178
- return context
179
- }
180
- }
181
- }
@@ -1,306 +0,0 @@
1
- import fs from 'fs'
2
- import path from 'path'
3
-
4
- import tmp from 'tmp'
5
- import chokidar from 'chokidar'
6
- import fastGlob from 'fast-glob'
7
- import LRU from 'quick-lru'
8
- import normalizePath from 'normalize-path'
9
-
10
- import hash from '../util/hashConfig'
11
- import log from '../util/log'
12
- import getModuleDependencies from '../lib/getModuleDependencies'
13
- import resolveConfig from '../../resolveConfig'
14
- import resolveConfigPath from '../util/resolveConfigPath'
15
- import { getContext } from './setupContextUtils'
16
-
17
- // This is used to trigger rebuilds. Just updating the timestamp
18
- // is significantly faster than actually writing to the file (10x).
19
-
20
- function touch(filename) {
21
- let time = new Date()
22
-
23
- try {
24
- fs.utimesSync(filename, time, time)
25
- } catch (err) {
26
- fs.closeSync(fs.openSync(filename, 'w'))
27
- }
28
- }
29
-
30
- let watchers = new WeakMap()
31
-
32
- function getWatcher(context) {
33
- if (watchers.has(context)) {
34
- return watchers.get(context)
35
- }
36
-
37
- return null
38
- }
39
-
40
- function setWatcher(context, watcher) {
41
- return watchers.set(context, watcher)
42
- }
43
-
44
- let touchFiles = new WeakMap()
45
-
46
- function getTouchFile(context) {
47
- if (touchFiles.has(context)) {
48
- return touchFiles.get(context)
49
- }
50
-
51
- return null
52
- }
53
-
54
- function setTouchFile(context, touchFile) {
55
- return touchFiles.set(context, touchFile)
56
- }
57
-
58
- let configPaths = new WeakMap()
59
-
60
- function getConfigPath(context, configOrPath) {
61
- if (!configPaths.has(context)) {
62
- configPaths.set(context, resolveConfigPath(configOrPath))
63
- }
64
-
65
- return configPaths.get(context)
66
- }
67
-
68
- function rebootWatcher(context, configPath, configDependencies, candidateFiles) {
69
- let touchFile = getTouchFile(context)
70
-
71
- if (touchFile === null) {
72
- touchFile = tmp.fileSync().name
73
- setTouchFile(context, touchFile)
74
- touch(touchFile)
75
- }
76
-
77
- let watcher = getWatcher(context)
78
-
79
- Promise.resolve(watcher ? watcher.close() : null).then(() => {
80
- log.info([
81
- 'Tailwind CSS is watching for changes...',
82
- 'https://tailwindcss.com/docs/just-in-time-mode#watch-mode-and-one-off-builds',
83
- ])
84
-
85
- watcher = chokidar.watch([...candidateFiles, ...configDependencies], {
86
- ignoreInitial: true,
87
- })
88
-
89
- setWatcher(context, watcher)
90
-
91
- watcher.on('add', (file) => {
92
- let changedFile = path.resolve('.', file)
93
- let content = fs.readFileSync(changedFile, 'utf8')
94
- let extension = path.extname(changedFile).slice(1)
95
- context.changedContent.push({ content, extension })
96
- touch(touchFile)
97
- })
98
-
99
- watcher.on('change', (file) => {
100
- // If it was a config dependency, touch the config file to trigger a new context.
101
- // This is not really that clean of a solution but it's the fastest, because we
102
- // can do a very quick check on each build to see if the config has changed instead
103
- // of having to get all of the module dependencies and check every timestamp each
104
- // time.
105
- if (configDependencies.has(file)) {
106
- for (let dependency of configDependencies) {
107
- delete require.cache[require.resolve(dependency)]
108
- }
109
- touch(configPath)
110
- } else {
111
- let changedFile = path.resolve('.', file)
112
- let content = fs.readFileSync(changedFile, 'utf8')
113
- let extension = path.extname(changedFile).slice(1)
114
- context.changedContent.push({ content, extension })
115
- touch(touchFile)
116
- }
117
- })
118
-
119
- watcher.on('unlink', (file) => {
120
- // Touch the config file if any of the dependencies are deleted.
121
- if (configDependencies.has(file)) {
122
- for (let dependency of configDependencies) {
123
- delete require.cache[require.resolve(dependency)]
124
- }
125
- touch(configPath)
126
- }
127
- })
128
- })
129
- }
130
-
131
- let configPathCache = new LRU({ maxSize: 100 })
132
-
133
- let configDependenciesCache = new WeakMap()
134
-
135
- function getConfigDependencies(context) {
136
- if (!configDependenciesCache.has(context)) {
137
- configDependenciesCache.set(context, new Set())
138
- }
139
-
140
- return configDependenciesCache.get(context)
141
- }
142
-
143
- let candidateFilesCache = new WeakMap()
144
-
145
- function getCandidateFiles(context, tailwindConfig) {
146
- if (candidateFilesCache.has(context)) {
147
- return candidateFilesCache.get(context)
148
- }
149
-
150
- let candidateFiles = tailwindConfig.content.content
151
- .filter((item) => typeof item === 'string')
152
- .map((contentPath) => normalizePath(path.resolve(contentPath)))
153
-
154
- return candidateFilesCache.set(context, candidateFiles).get(context)
155
- }
156
-
157
- // Get the config object based on a path
158
- function getTailwindConfig(configOrPath) {
159
- let userConfigPath = resolveConfigPath(configOrPath)
160
-
161
- if (userConfigPath !== null) {
162
- let [prevConfig, prevModified = -Infinity, prevConfigHash] =
163
- configPathCache.get(userConfigPath) || []
164
- let modified = fs.statSync(userConfigPath).mtimeMs
165
-
166
- // It hasn't changed (based on timestamp)
167
- if (modified <= prevModified) {
168
- return [prevConfig, userConfigPath, prevConfigHash, [userConfigPath]]
169
- }
170
-
171
- // It has changed (based on timestamp), or first run
172
- delete require.cache[userConfigPath]
173
- let newConfig = resolveConfig(require(userConfigPath))
174
- let newHash = hash(newConfig)
175
- configPathCache.set(userConfigPath, [newConfig, modified, newHash])
176
- return [newConfig, userConfigPath, newHash, [userConfigPath]]
177
- }
178
-
179
- // It's a plain object, not a path
180
- let newConfig = resolveConfig(
181
- configOrPath.config === undefined ? configOrPath : configOrPath.config
182
- )
183
-
184
- return [newConfig, null, hash(newConfig), []]
185
- }
186
-
187
- function resolvedChangedContent(context, candidateFiles) {
188
- let changedContent = context.tailwindConfig.content.content
189
- .filter((item) => typeof item.raw === 'string')
190
- .concat(context.tailwindConfig.content.safelist)
191
- .map(({ raw, extension }) => ({ content: raw, extension }))
192
-
193
- for (let changedFile of resolveChangedFiles(context, candidateFiles)) {
194
- let content = fs.readFileSync(changedFile, 'utf8')
195
- let extension = path.extname(changedFile).slice(1)
196
- changedContent.push({ content, extension })
197
- }
198
- return changedContent
199
- }
200
-
201
- let scannedContentCache = new WeakMap()
202
-
203
- function resolveChangedFiles(context, candidateFiles) {
204
- let changedFiles = new Set()
205
-
206
- // If we're not set up and watching files ourselves, we need to do
207
- // the work of grabbing all of the template files for candidate
208
- // detection.
209
- if (!scannedContentCache.has(context)) {
210
- let files = fastGlob.sync(candidateFiles)
211
- for (let file of files) {
212
- changedFiles.add(file)
213
- }
214
- scannedContentCache.set(context, true)
215
- }
216
-
217
- return changedFiles
218
- }
219
-
220
- // DISABLE_TOUCH = FALSE
221
-
222
- // Retrieve an existing context from cache if possible (since contexts are unique per
223
- // source path), or set up a new one (including setting up watchers and registering
224
- // plugins) then return it
225
- export default function setupWatchingContext(configOrPath) {
226
- return ({ tailwindDirectives, registerDependency }) => {
227
- return (root, result) => {
228
- let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] =
229
- getTailwindConfig(configOrPath)
230
-
231
- let contextDependencies = new Set(configDependencies)
232
-
233
- // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
234
- // to be dependencies of the context. Can reuse the context even if they change.
235
- // We may want to think about `@layer` being part of this trigger too, but it's tough
236
- // because it's impossible for a layer in one file to end up in the actual @tailwind rule
237
- // in another file since independent sources are effectively isolated.
238
- if (tailwindDirectives.size > 0) {
239
- // Add current css file as a context dependencies.
240
- contextDependencies.add(result.opts.from)
241
-
242
- // Add all css @import dependencies as context dependencies.
243
- for (let message of result.messages) {
244
- if (message.type === 'dependency') {
245
- contextDependencies.add(message.file)
246
- }
247
- }
248
- }
249
-
250
- let [context, isNewContext] = getContext(
251
- tailwindDirectives,
252
- root,
253
- result,
254
- tailwindConfig,
255
- userConfigPath,
256
- tailwindConfigHash,
257
- contextDependencies
258
- )
259
-
260
- let candidateFiles = getCandidateFiles(context, tailwindConfig)
261
- let contextConfigDependencies = getConfigDependencies(context)
262
-
263
- for (let file of configDependencies) {
264
- registerDependency({ type: 'dependency', file })
265
- }
266
-
267
- context.disposables.push((oldContext) => {
268
- let watcher = getWatcher(oldContext)
269
- if (watcher !== null) {
270
- watcher.close()
271
- }
272
- })
273
-
274
- let configPath = getConfigPath(context, configOrPath)
275
-
276
- if (configPath !== null) {
277
- for (let dependency of getModuleDependencies(configPath)) {
278
- if (dependency.file === configPath) {
279
- continue
280
- }
281
-
282
- contextConfigDependencies.add(dependency.file)
283
- }
284
- }
285
-
286
- if (isNewContext) {
287
- rebootWatcher(context, configPath, contextConfigDependencies, candidateFiles)
288
- }
289
-
290
- // Register our temp file as a dependency — we write to this file
291
- // to trigger rebuilds.
292
- let touchFile = getTouchFile(context)
293
- if (touchFile) {
294
- registerDependency({ type: 'dependency', file: touchFile })
295
- }
296
-
297
- if (tailwindDirectives.size > 0) {
298
- for (let changedContent of resolvedChangedContent(context, candidateFiles)) {
299
- context.changedContent.push(changedContent)
300
- }
301
- }
302
-
303
- return context
304
- }
305
- }
306
- }
@@ -1,13 +0,0 @@
1
- import LRU from 'quick-lru'
2
-
3
- export const env = {
4
- TAILWIND_MODE: process.env.TAILWIND_MODE,
5
- NODE_ENV: process.env.NODE_ENV,
6
- DEBUG: process.env.DEBUG !== undefined,
7
- TAILWIND_DISABLE_TOUCH: process.env.TAILWIND_DISABLE_TOUCH !== undefined,
8
- TAILWIND_TOUCH_DIR: process.env.TAILWIND_TOUCH_DIR,
9
- }
10
- export const contextMap = new Map()
11
- export const configContextMap = new Map()
12
- export const contextSourcesMap = new Map()
13
- export const contentMatchCache = new LRU({ maxSize: 25000 })
@@ -1,16 +0,0 @@
1
- import buildMediaQuery from '../util/buildMediaQuery'
2
-
3
- export default function ({ tailwindConfig: { theme } }) {
4
- return function (css) {
5
- css.walkAtRules('screen', (atRule) => {
6
- const screen = atRule.params
7
-
8
- if (!theme.screens?.hasOwnProperty?.(screen)) {
9
- throw atRule.error(`No \`${screen}\` screen found.`)
10
- }
11
-
12
- atRule.name = 'media'
13
- atRule.params = buildMediaQuery(theme.screens[screen])
14
- })
15
- }
16
- }
@@ -1,41 +0,0 @@
1
- import normalizeTailwindDirectives from './lib/normalizeTailwindDirectives'
2
- import expandTailwindAtRules from './lib/expandTailwindAtRules'
3
- import expandApplyAtRules from './lib/expandApplyAtRules'
4
- import evaluateTailwindFunctions from './lib/evaluateTailwindFunctions'
5
- import substituteScreenAtRules from './lib/substituteScreenAtRules'
6
- import resolveDefaultsAtRules from './lib/resolveDefaultsAtRules'
7
- import collapseAdjacentRules from './lib/collapseAdjacentRules'
8
- import { createContext } from './lib/setupContextUtils'
9
-
10
- export default function processTailwindFeatures(setupContext) {
11
- return function (root, result) {
12
- let tailwindDirectives = normalizeTailwindDirectives(root)
13
-
14
- let context = setupContext({
15
- tailwindDirectives,
16
- registerDependency(dependency) {
17
- result.messages.push({
18
- plugin: 'tailwindcss',
19
- parent: result.opts.from,
20
- ...dependency,
21
- })
22
- },
23
- createContext(tailwindConfig, changedContent) {
24
- return createContext(tailwindConfig, changedContent, tailwindDirectives, root)
25
- },
26
- })(root, result)
27
-
28
- if (context.tailwindConfig.separator === '-') {
29
- throw new Error(
30
- "The '-' character cannot be used as a custom separator in JIT mode due to parsing ambiguity. Please use another character like '_' instead."
31
- )
32
- }
33
-
34
- expandTailwindAtRules(context)(root, result)
35
- expandApplyAtRules(context)(root, result)
36
- evaluateTailwindFunctions(context)(root, result)
37
- substituteScreenAtRules(context)(root, result)
38
- resolveDefaultsAtRules(context)(root, result)
39
- collapseAdjacentRules(context)(root, result)
40
- }
41
- }
@@ -1,3 +0,0 @@
1
- export default function bigSign(bigIntValue) {
2
- return (bigIntValue > 0n) - (bigIntValue < 0n)
3
- }
@@ -1,24 +0,0 @@
1
- export default function buildMediaQuery(screens) {
2
- if (typeof screens === 'string') {
3
- screens = { min: screens }
4
- }
5
-
6
- if (!Array.isArray(screens)) {
7
- screens = [screens]
8
- }
9
-
10
- return screens
11
- .map((screen) => {
12
- if (screen?.hasOwnProperty?.('raw')) {
13
- return screen.raw
14
- }
15
-
16
- return Object.entries(screen)
17
- .map(([feature, value]) => {
18
- feature = { min: 'min-width', max: 'max-width' }[feature] ?? feature
19
- return `(${feature}: ${value})`
20
- })
21
- .join(' and ')
22
- })
23
- .join(', ')
24
- }
@@ -1,11 +0,0 @@
1
- export function cloneDeep(value) {
2
- if (Array.isArray(value)) {
3
- return value.map((child) => cloneDeep(child))
4
- }
5
-
6
- if (typeof value === 'object' && value !== null) {
7
- return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, cloneDeep(v)]))
8
- }
9
-
10
- return value
11
- }
@@ -1,11 +0,0 @@
1
- export default function cloneNodes(nodes, source) {
2
- return nodes.map((node) => {
3
- let cloned = node.clone()
4
-
5
- if (source !== undefined) {
6
- cloned.source = source
7
- }
8
-
9
- return cloned
10
- })
11
- }
package/src/util/color.js DELETED
@@ -1,56 +0,0 @@
1
- import namedColors from 'color-name'
2
-
3
- let HEX = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i
4
- let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i
5
- let VALUE = `(?:\\d+|\\d*\\.\\d+)%?`
6
- let SEP = `(?:\\s*,\\s*|\\s+)`
7
- let ALPHA_SEP = `\\s*[,/]\\s*`
8
- let RGB_HSL = new RegExp(
9
- `^(rgb|hsl)a?\\(\\s*(${VALUE})${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\s*\\)$`
10
- )
11
-
12
- export function parseColor(value) {
13
- if (typeof value !== 'string') {
14
- return null
15
- }
16
-
17
- value = value.trim()
18
- if (value === 'transparent') {
19
- return { mode: 'rgb', color: ['0', '0', '0'], alpha: '0' }
20
- }
21
-
22
- if (value in namedColors) {
23
- return { mode: 'rgb', color: namedColors[value].map((v) => v.toString()) }
24
- }
25
-
26
- let hex = value
27
- .replace(SHORT_HEX, (_, r, g, b, a) => ['#', r, r, g, g, b, b, a ? a + a : ''].join(''))
28
- .match(HEX)
29
-
30
- if (hex !== null) {
31
- return {
32
- mode: 'rgb',
33
- color: [parseInt(hex[1], 16), parseInt(hex[2], 16), parseInt(hex[3], 16)].map((v) =>
34
- v.toString()
35
- ),
36
- alpha: hex[4] ? (parseInt(hex[4], 16) / 255).toString() : undefined,
37
- }
38
- }
39
-
40
- let match = value.match(RGB_HSL)
41
-
42
- if (match !== null) {
43
- return {
44
- mode: match[1],
45
- color: [match[2], match[3], match[4]].map((v) => v.toString()),
46
- alpha: match[5]?.toString?.(),
47
- }
48
- }
49
-
50
- return null
51
- }
52
-
53
- export function formatColor({ mode, color, alpha }) {
54
- let hasAlpha = alpha !== undefined
55
- return `${mode}(${color.join(' ')}${hasAlpha ? ` / ${alpha}` : ''})`
56
- }
@@ -1,23 +0,0 @@
1
- export default function (pluginConfig, plugins) {
2
- if (pluginConfig === undefined) {
3
- return plugins
4
- }
5
-
6
- const pluginNames = Array.isArray(pluginConfig)
7
- ? pluginConfig
8
- : [
9
- ...new Set(
10
- plugins
11
- .filter((pluginName) => {
12
- return pluginConfig !== false && pluginConfig[pluginName] !== false
13
- })
14
- .concat(
15
- Object.keys(pluginConfig).filter((pluginName) => {
16
- return pluginConfig[pluginName] !== false
17
- })
18
- )
19
- ),
20
- ]
21
-
22
- return pluginNames
23
- }