tailwindcss 0.0.0-insiders.ee945bb → 0.0.0-insiders.ef2ebb2

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 (215) hide show
  1. package/README.md +13 -9
  2. package/colors.d.ts +3 -0
  3. package/defaultConfig.d.ts +3 -0
  4. package/defaultTheme.d.ts +4 -0
  5. package/index.css +5 -0
  6. package/lib/cli/build/index.js +57 -0
  7. package/lib/cli/build/plugin.js +433 -0
  8. package/lib/cli/build/utils.js +88 -0
  9. package/lib/cli/build/watching.js +182 -0
  10. package/lib/cli/help/index.js +73 -0
  11. package/lib/cli/index.js +231 -0
  12. package/lib/cli/init/index.js +63 -0
  13. package/lib/cli.js +1 -751
  14. package/lib/corePluginList.js +13 -3
  15. package/lib/corePlugins.js +2323 -1720
  16. package/lib/css/preflight.css +13 -5
  17. package/lib/featureFlags.js +50 -25
  18. package/lib/index.js +1 -40
  19. package/lib/lib/cacheInvalidation.js +48 -25
  20. package/lib/lib/collapseAdjacentRules.js +17 -10
  21. package/lib/lib/collapseDuplicateDeclarations.js +13 -8
  22. package/lib/lib/content.js +207 -0
  23. package/lib/lib/defaultExtractor.js +232 -33
  24. package/lib/lib/detectNesting.js +21 -10
  25. package/lib/lib/evaluateTailwindFunctions.js +117 -50
  26. package/lib/lib/expandApplyAtRules.js +316 -215
  27. package/lib/lib/expandTailwindAtRules.js +167 -115
  28. package/lib/lib/findAtConfigPath.js +46 -0
  29. package/lib/lib/generateRules.js +454 -206
  30. package/lib/lib/getModuleDependencies.js +88 -37
  31. package/lib/lib/handleImportAtRules.js +50 -0
  32. package/lib/lib/load-config.js +42 -0
  33. package/lib/lib/normalizeTailwindDirectives.js +29 -39
  34. package/lib/lib/offsets.js +306 -0
  35. package/lib/lib/partitionApplyAtRules.js +13 -8
  36. package/lib/lib/regex.js +74 -0
  37. package/lib/lib/remap-bitfield.js +89 -0
  38. package/lib/lib/resolveDefaultsAtRules.js +96 -74
  39. package/lib/lib/setupContextUtils.js +687 -301
  40. package/lib/lib/setupTrackingContext.js +63 -68
  41. package/lib/lib/sharedState.js +44 -17
  42. package/lib/lib/substituteScreenAtRules.js +14 -10
  43. package/lib/plugin.js +166 -0
  44. package/lib/postcss-plugins/nesting/README.md +2 -2
  45. package/lib/postcss-plugins/nesting/index.js +10 -6
  46. package/lib/postcss-plugins/nesting/plugin.js +24 -20
  47. package/lib/processTailwindFeatures.js +34 -29
  48. package/lib/public/colors.js +272 -246
  49. package/lib/public/create-plugin.js +9 -5
  50. package/lib/public/default-config.js +10 -6
  51. package/lib/public/default-theme.js +10 -6
  52. package/lib/public/load-config.js +12 -0
  53. package/lib/public/resolve-config.js +11 -6
  54. package/lib/util/applyImportantSelector.js +36 -0
  55. package/lib/util/bigSign.js +6 -1
  56. package/lib/util/buildMediaQuery.js +13 -6
  57. package/lib/util/cloneDeep.js +9 -6
  58. package/lib/util/cloneNodes.js +12 -3
  59. package/lib/util/color.js +70 -53
  60. package/lib/util/colorNames.js +752 -0
  61. package/lib/util/configurePlugins.js +7 -2
  62. package/lib/util/createPlugin.js +8 -5
  63. package/lib/util/createUtilityPlugin.js +13 -9
  64. package/lib/util/dataTypes.js +182 -111
  65. package/lib/util/defaults.js +12 -7
  66. package/lib/util/escapeClassName.js +13 -8
  67. package/lib/util/escapeCommas.js +7 -2
  68. package/lib/util/flattenColorPalette.js +11 -10
  69. package/lib/util/formatVariantSelector.js +228 -151
  70. package/lib/util/getAllConfigs.js +33 -12
  71. package/lib/util/hashConfig.js +9 -4
  72. package/lib/util/isKeyframeRule.js +7 -2
  73. package/lib/util/isPlainObject.js +7 -2
  74. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +25 -15
  75. package/lib/util/log.js +40 -13
  76. package/lib/util/nameClass.js +27 -10
  77. package/lib/util/negateValue.js +25 -8
  78. package/lib/util/normalizeConfig.js +155 -87
  79. package/lib/util/normalizeScreens.js +127 -8
  80. package/lib/util/parseAnimationValue.js +44 -40
  81. package/lib/util/parseBoxShadowValue.js +33 -62
  82. package/lib/util/parseDependency.js +39 -55
  83. package/lib/util/parseGlob.js +36 -0
  84. package/lib/util/parseObjectStyles.js +15 -10
  85. package/lib/util/pluginUtils.js +154 -59
  86. package/lib/util/prefixSelector.js +29 -10
  87. package/lib/util/pseudoElements.js +209 -0
  88. package/lib/util/removeAlphaVariables.js +31 -0
  89. package/lib/util/resolveConfig.js +96 -95
  90. package/lib/util/resolveConfigPath.js +29 -10
  91. package/lib/util/responsive.js +11 -6
  92. package/lib/util/splitAtTopLevelOnly.js +51 -0
  93. package/lib/util/tap.js +6 -1
  94. package/lib/util/toColorValue.js +7 -2
  95. package/lib/util/toPath.js +22 -4
  96. package/lib/util/transformThemeValue.js +40 -26
  97. package/lib/util/validateConfig.js +48 -0
  98. package/lib/util/validateFormalSyntax.js +26 -0
  99. package/lib/util/withAlphaVariable.js +27 -15
  100. package/lib/value-parser/LICENSE +22 -0
  101. package/lib/value-parser/README.md +3 -0
  102. package/lib/value-parser/index.d.js +2 -0
  103. package/lib/value-parser/index.js +22 -0
  104. package/lib/value-parser/parse.js +259 -0
  105. package/lib/value-parser/stringify.js +38 -0
  106. package/lib/value-parser/unit.js +86 -0
  107. package/lib/value-parser/walk.js +16 -0
  108. package/loadConfig.d.ts +4 -0
  109. package/loadConfig.js +2 -0
  110. package/package.json +59 -53
  111. package/plugin.d.ts +11 -0
  112. package/resolveConfig.d.ts +12 -0
  113. package/scripts/generate-types.js +105 -0
  114. package/scripts/release-channel.js +18 -0
  115. package/scripts/release-notes.js +21 -0
  116. package/scripts/type-utils.js +27 -0
  117. package/src/cli/build/index.js +53 -0
  118. package/src/cli/build/plugin.js +476 -0
  119. package/src/cli/build/utils.js +76 -0
  120. package/src/cli/build/watching.js +229 -0
  121. package/src/cli/help/index.js +70 -0
  122. package/src/cli/index.js +217 -0
  123. package/src/cli/init/index.js +79 -0
  124. package/src/cli.js +1 -825
  125. package/src/corePluginList.js +1 -1
  126. package/src/corePlugins.js +614 -106
  127. package/src/css/preflight.css +13 -5
  128. package/src/featureFlags.js +17 -3
  129. package/src/index.js +1 -42
  130. package/src/lib/collapseAdjacentRules.js +5 -1
  131. package/src/lib/content.js +240 -0
  132. package/src/lib/defaultExtractor.js +202 -35
  133. package/src/lib/detectNesting.js +9 -1
  134. package/src/lib/evaluateTailwindFunctions.js +82 -8
  135. package/src/lib/expandApplyAtRules.js +322 -189
  136. package/src/lib/expandTailwindAtRules.js +82 -59
  137. package/src/lib/findAtConfigPath.js +48 -0
  138. package/src/lib/generateRules.js +427 -127
  139. package/src/lib/getModuleDependencies.js +70 -30
  140. package/src/lib/handleImportAtRules.js +34 -0
  141. package/src/lib/load-config.ts +31 -0
  142. package/src/lib/normalizeTailwindDirectives.js +0 -27
  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 -36
  147. package/src/lib/setupContextUtils.js +591 -156
  148. package/src/lib/setupTrackingContext.js +44 -58
  149. package/src/lib/sharedState.js +13 -4
  150. package/src/plugin.js +141 -0
  151. package/src/postcss-plugins/nesting/README.md +2 -2
  152. package/src/public/colors.js +22 -0
  153. package/src/public/default-config.js +1 -1
  154. package/src/public/default-theme.js +2 -2
  155. package/src/public/load-config.js +2 -0
  156. package/src/util/applyImportantSelector.js +27 -0
  157. package/src/util/buildMediaQuery.js +5 -3
  158. package/src/util/cloneNodes.js +5 -1
  159. package/src/util/color.js +39 -20
  160. package/src/util/colorNames.js +150 -0
  161. package/src/util/dataTypes.js +67 -23
  162. package/src/util/formatVariantSelector.js +264 -144
  163. package/src/util/getAllConfigs.js +21 -2
  164. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  165. package/src/util/log.js +25 -1
  166. package/src/util/nameClass.js +4 -0
  167. package/src/util/negateValue.js +11 -3
  168. package/src/util/normalizeConfig.js +78 -20
  169. package/src/util/normalizeScreens.js +99 -4
  170. package/src/util/parseBoxShadowValue.js +3 -50
  171. package/src/util/parseDependency.js +37 -42
  172. package/src/util/parseGlob.js +24 -0
  173. package/src/util/pluginUtils.js +118 -23
  174. package/src/util/prefixSelector.js +28 -10
  175. package/src/util/pseudoElements.js +167 -0
  176. package/src/util/removeAlphaVariables.js +24 -0
  177. package/src/util/resolveConfig.js +70 -62
  178. package/src/util/resolveConfigPath.js +12 -1
  179. package/src/util/splitAtTopLevelOnly.js +52 -0
  180. package/src/util/toPath.js +1 -1
  181. package/src/util/transformThemeValue.js +13 -3
  182. package/src/util/validateConfig.js +36 -0
  183. package/src/util/validateFormalSyntax.js +34 -0
  184. package/src/util/withAlphaVariable.js +1 -1
  185. package/src/value-parser/LICENSE +22 -0
  186. package/src/value-parser/README.md +3 -0
  187. package/src/value-parser/index.d.ts +177 -0
  188. package/src/value-parser/index.js +28 -0
  189. package/src/value-parser/parse.js +303 -0
  190. package/src/value-parser/stringify.js +41 -0
  191. package/src/value-parser/unit.js +118 -0
  192. package/src/value-parser/walk.js +18 -0
  193. package/stubs/.gitignore +1 -0
  194. package/stubs/.prettierrc.json +6 -0
  195. package/stubs/{defaultConfig.stub.js → config.full.js} +218 -165
  196. package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -1
  197. package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
  198. package/stubs/postcss.config.js +5 -0
  199. package/stubs/tailwind.config.cjs +2 -0
  200. package/stubs/tailwind.config.js +2 -0
  201. package/stubs/tailwind.config.ts +3 -0
  202. package/types/config.d.ts +369 -0
  203. package/types/generated/.gitkeep +0 -0
  204. package/types/generated/colors.d.ts +298 -0
  205. package/types/generated/corePluginList.d.ts +1 -0
  206. package/types/generated/default-theme.d.ts +372 -0
  207. package/types/index.d.ts +7 -0
  208. package/CHANGELOG.md +0 -2090
  209. package/lib/cli-peer-dependencies.js +0 -15
  210. package/lib/constants.js +0 -37
  211. package/peers/index.js +0 -75077
  212. package/scripts/install-integrations.js +0 -27
  213. package/scripts/rebuildFixtures.js +0 -68
  214. package/src/cli-peer-dependencies.js +0 -9
  215. package/src/constants.js +0 -17
@@ -1,21 +1,17 @@
1
- import fs from 'fs'
2
- import path from 'path'
1
+ // @ts-check
3
2
 
4
- import fastGlob from 'fast-glob'
5
- import LRU from 'quick-lru'
6
- import normalizePath from 'normalize-path'
3
+ import fs from 'fs'
4
+ import LRU from '@alloc/quick-lru'
7
5
 
8
6
  import hash from '../util/hashConfig'
9
- import getModuleDependencies from '../lib/getModuleDependencies'
10
-
11
7
  import resolveConfig from '../public/resolve-config'
12
-
13
8
  import resolveConfigPath from '../util/resolveConfigPath'
14
-
15
- import { env } from './sharedState'
16
-
17
9
  import { getContext, getFileModifiedMap } from './setupContextUtils'
18
10
  import parseDependency from '../util/parseDependency'
11
+ import { validateConfig } from '../util/validateConfig.js'
12
+ import { parseCandidateFiles, resolvedChangedContent } from './content.js'
13
+ import { loadConfig } from '../lib/load-config'
14
+ import getModuleDependencies from './getModuleDependencies'
19
15
 
20
16
  let configPathCache = new LRU({ maxSize: 100 })
21
17
 
@@ -26,9 +22,7 @@ function getCandidateFiles(context, tailwindConfig) {
26
22
  return candidateFilesCache.get(context)
27
23
  }
28
24
 
29
- let candidateFiles = tailwindConfig.content.files
30
- .filter((item) => typeof item === 'string')
31
- .map((contentPath) => normalizePath(contentPath))
25
+ let candidateFiles = parseCandidateFiles(context, tailwindConfig)
32
26
 
33
27
  return candidateFilesCache.set(context, candidateFiles).get(context)
34
28
  }
@@ -41,7 +35,7 @@ function getTailwindConfig(configOrPath) {
41
35
  let [prevConfig, prevConfigHash, prevDeps, prevModified] =
42
36
  configPathCache.get(userConfigPath) || []
43
37
 
44
- let newDeps = getModuleDependencies(userConfigPath).map((dep) => dep.file)
38
+ let newDeps = getModuleDependencies(userConfigPath)
45
39
 
46
40
  let modified = false
47
41
  let newModified = new Map()
@@ -62,48 +56,18 @@ function getTailwindConfig(configOrPath) {
62
56
  for (let file of newDeps) {
63
57
  delete require.cache[file]
64
58
  }
65
- let newConfig = resolveConfig(require(userConfigPath))
59
+ let newConfig = validateConfig(resolveConfig(loadConfig(userConfigPath)))
66
60
  let newHash = hash(newConfig)
67
61
  configPathCache.set(userConfigPath, [newConfig, newHash, newDeps, newModified])
68
62
  return [newConfig, userConfigPath, newHash, newDeps]
69
63
  }
70
64
 
71
65
  // It's a plain object, not a path
72
- let newConfig = resolveConfig(
73
- configOrPath.config === undefined ? configOrPath : configOrPath.config
74
- )
66
+ let newConfig = resolveConfig(configOrPath?.config ?? configOrPath ?? {})
75
67
 
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
- }
68
+ newConfig = validateConfig(newConfig)
91
69
 
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
70
+ return [newConfig, null, hash(newConfig), []]
107
71
  }
108
72
 
109
73
  // DISABLE_TOUCH = TRUE
@@ -137,7 +101,7 @@ export default function setupTrackingContext(configOrPath) {
137
101
  }
138
102
  }
139
103
 
140
- let [context] = getContext(
104
+ let [context, , mTimesToCommit] = getContext(
141
105
  root,
142
106
  result,
143
107
  tailwindConfig,
@@ -146,6 +110,8 @@ export default function setupTrackingContext(configOrPath) {
146
110
  contextDependencies
147
111
  )
148
112
 
113
+ let fileModifiedMap = getFileModifiedMap(context)
114
+
149
115
  let candidateFiles = getCandidateFiles(context, tailwindConfig)
150
116
 
151
117
  // If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
@@ -154,22 +120,35 @@ export default function setupTrackingContext(configOrPath) {
154
120
  // because it's impossible for a layer in one file to end up in the actual @tailwind rule
155
121
  // in another file since independent sources are effectively isolated.
156
122
  if (tailwindDirectives.size > 0) {
157
- let fileModifiedMap = getFileModifiedMap(context)
158
-
159
123
  // Add template paths as postcss dependencies.
160
- for (let fileOrGlob of candidateFiles) {
161
- let dependency = parseDependency(fileOrGlob)
162
- if (dependency) {
124
+ for (let contentPath of candidateFiles) {
125
+ for (let dependency of parseDependency(contentPath)) {
163
126
  registerDependency(dependency)
164
127
  }
165
128
  }
166
129
 
167
- for (let changedContent of resolvedChangedContent(
130
+ let [changedContent, contentMTimesToCommit] = resolvedChangedContent(
168
131
  context,
169
132
  candidateFiles,
170
133
  fileModifiedMap
171
- )) {
172
- context.changedContent.push(changedContent)
134
+ )
135
+
136
+ for (let content of changedContent) {
137
+ context.changedContent.push(content)
138
+ }
139
+
140
+ // Add the mtimes of the content files to the commit list
141
+ // We can overwrite the existing values because unconditionally
142
+ // This is because:
143
+ // 1. Most of the files here won't be in the map yet
144
+ // 2. If they are that means it's a context dependency
145
+ // and we're reading this after the context. This means
146
+ // that the mtime we just read is strictly >= the context
147
+ // mtime. Unless the user / os is doing something weird
148
+ // in which the mtime would be going backwards. If that
149
+ // happens there's already going to be problems.
150
+ for (let [path, mtime] of contentMTimesToCommit.entries()) {
151
+ mTimesToCommit.set(path, mtime)
173
152
  }
174
153
  }
175
154
 
@@ -177,6 +156,13 @@ export default function setupTrackingContext(configOrPath) {
177
156
  registerDependency({ type: 'dependency', file })
178
157
  }
179
158
 
159
+ // "commit" the new modified time for all context deps
160
+ // We do this here because we want content tracking to
161
+ // read the "old" mtime even when it's a context dependency.
162
+ for (let [path, mtime] of mTimesToCommit.entries()) {
163
+ fileModifiedMap.set(path, mtime)
164
+ }
165
+
180
166
  return context
181
167
  }
182
168
  }
@@ -1,13 +1,22 @@
1
- export const env = {
2
- NODE_ENV: process.env.NODE_ENV,
3
- DEBUG: resolveDebug(process.env.DEBUG),
4
- }
1
+ export const env =
2
+ typeof process !== 'undefined'
3
+ ? {
4
+ NODE_ENV: process.env.NODE_ENV,
5
+ DEBUG: resolveDebug(process.env.DEBUG),
6
+ }
7
+ : {
8
+ NODE_ENV: 'production',
9
+ DEBUG: false,
10
+ }
11
+
5
12
  export const contextMap = new Map()
6
13
  export const configContextMap = new Map()
7
14
  export const contextSourcesMap = new Map()
8
15
  export const sourceHashMap = new Map()
9
16
  export const NOT_ON_DEMAND = new String('*')
10
17
 
18
+ export const NONE = Symbol('__NONE__')
19
+
11
20
  export function resolveDebug(debug) {
12
21
  if (debug === undefined) {
13
22
  return false
package/src/plugin.js ADDED
@@ -0,0 +1,141 @@
1
+ import postcss from 'postcss'
2
+ import lightningcss, { Features } from 'lightningcss'
3
+ import browserslist from 'browserslist'
4
+ import setupTrackingContext from './lib/setupTrackingContext'
5
+ import processTailwindFeatures from './processTailwindFeatures'
6
+ import { env } from './lib/sharedState'
7
+ import { findAtConfigPath } from './lib/findAtConfigPath'
8
+ import { handleImportAtRules } from './lib/handleImportAtRules'
9
+
10
+ module.exports = function tailwindcss(configOrPath) {
11
+ return {
12
+ postcssPlugin: 'tailwindcss',
13
+ plugins: [
14
+ env.DEBUG &&
15
+ function (root) {
16
+ console.log('\n')
17
+ console.time('JIT TOTAL')
18
+ return root
19
+ },
20
+ ...handleImportAtRules(),
21
+ function (root, result) {
22
+ // Use the path for the `@config` directive if it exists, otherwise use the
23
+ // path for the file being processed
24
+ configOrPath = findAtConfigPath(root, result) ?? configOrPath
25
+
26
+ let context = setupTrackingContext(configOrPath)
27
+
28
+ if (root.type === 'document') {
29
+ let roots = root.nodes.filter((node) => node.type === 'root')
30
+
31
+ for (const root of roots) {
32
+ if (root.type === 'root') {
33
+ processTailwindFeatures(context)(root, result)
34
+ }
35
+ }
36
+
37
+ return
38
+ }
39
+
40
+ processTailwindFeatures(context)(root, result)
41
+ },
42
+ function lightningCssPlugin(_root, result) {
43
+ let map = result.map ?? result.opts.map
44
+
45
+ let intermediateResult = result.root.toResult({
46
+ map: map ? { inline: true } : false,
47
+ })
48
+
49
+ let intermediateMap = intermediateResult.map?.toJSON?.() ?? map
50
+
51
+ try {
52
+ let includeFeatures = Features.Nesting
53
+ let excludeFeatures = 0
54
+
55
+ let resolvedBrowsersListConfig = browserslist.findConfig(
56
+ result.opts.from ?? process.cwd()
57
+ )?.defaults
58
+ let defaultBrowsersListConfig = require('../package.json').browserslist
59
+ let browsersListConfig = resolvedBrowsersListConfig ?? defaultBrowsersListConfig
60
+
61
+ if (browsersListConfig.join(',') === defaultBrowsersListConfig.join(',')) {
62
+ includeFeatures |=
63
+ Features.ColorFunction | Features.OklabColors | Features.LabColors | Features.P3Colors
64
+
65
+ excludeFeatures |=
66
+ Features.HexAlphaColors |
67
+ Features.LogicalProperties |
68
+ Features.SpaceSeparatedColorNotation
69
+ }
70
+
71
+ let transformed = lightningcss.transform({
72
+ filename: result.opts.from,
73
+ code: Buffer.from(intermediateResult.css),
74
+ minify: false,
75
+ sourceMap: !!intermediateMap,
76
+ targets: lightningcss.browserslistToTargets(browserslist(browsersListConfig)),
77
+ drafts: {
78
+ nesting: true,
79
+ customMedia: true,
80
+ },
81
+ nonStandard: {
82
+ deepSelectorCombinator: true,
83
+ },
84
+ include: includeFeatures,
85
+ exclude: excludeFeatures,
86
+ })
87
+
88
+ let code = transformed.code.toString()
89
+
90
+ // https://postcss.org/api/#sourcemapoptions
91
+ if (intermediateMap && transformed.map != null) {
92
+ let prev = transformed.map.toString()
93
+
94
+ if (typeof intermediateMap === 'object') {
95
+ intermediateMap.prev = prev
96
+ } else {
97
+ code = `${code}\n/*# sourceMappingURL=data:application/json;base64,${Buffer.from(
98
+ prev
99
+ ).toString('base64')} */`
100
+ }
101
+ }
102
+
103
+ result.root = postcss.parse(code, {
104
+ ...result.opts,
105
+ map: intermediateMap,
106
+ })
107
+ } catch (err) {
108
+ if (err.source && typeof process !== 'undefined' && process.env.JEST_WORKER_ID) {
109
+ let lines = err.source.split('\n')
110
+ err = new Error(
111
+ [
112
+ 'Error formatting using Lightning CSS:',
113
+ '',
114
+ ...[
115
+ '```css',
116
+ ...lines.slice(Math.max(err.loc.line - 3, 0), err.loc.line),
117
+ ' '.repeat(err.loc.column - 1) + '^-- ' + err.toString(),
118
+ ...lines.slice(err.loc.line, err.loc.line + 2),
119
+ '```',
120
+ ],
121
+ ].join('\n')
122
+ )
123
+ }
124
+
125
+ if (Error.captureStackTrace) {
126
+ Error.captureStackTrace(err, lightningCssPlugin)
127
+ }
128
+ throw err
129
+ }
130
+ },
131
+ env.DEBUG &&
132
+ function (root) {
133
+ console.timeEnd('JIT TOTAL')
134
+ console.log('\n')
135
+ return root
136
+ },
137
+ ].filter(Boolean),
138
+ }
139
+ }
140
+
141
+ module.exports.postcss = true
@@ -1,6 +1,6 @@
1
1
  # tailwindcss/nesting
2
2
 
3
- This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands Tailwind's custom syntax like `@apply` and `@screen`.
3
+ This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands Tailwind's custom syntax like `@apply` and `@screen`.
4
4
 
5
5
  Add it to your PostCSS configuration, somewhere before Tailwind itself:
6
6
 
@@ -18,7 +18,7 @@ module.exports = {
18
18
 
19
19
  By default, it uses the [postcss-nested](https://github.com/postcss/postcss-nested) plugin under the hood, which uses a Sass-like syntax and is the plugin that powers nesting support in the [Tailwind CSS plugin API](https://tailwindcss.com/docs/plugins#css-in-js-syntax).
20
20
 
21
- If you'd rather use [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin alongside:
21
+ If you'd rather use [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin alongside:
22
22
 
23
23
  ```shell
24
24
  npm install postcss-nesting
@@ -24,6 +24,7 @@ export default {
24
24
  700: '#334155',
25
25
  800: '#1e293b',
26
26
  900: '#0f172a',
27
+ 950: '#020617',
27
28
  },
28
29
  gray: {
29
30
  50: '#f9fafb',
@@ -36,6 +37,7 @@ export default {
36
37
  700: '#374151',
37
38
  800: '#1f2937',
38
39
  900: '#111827',
40
+ 950: '#030712',
39
41
  },
40
42
  zinc: {
41
43
  50: '#fafafa',
@@ -48,6 +50,7 @@ export default {
48
50
  700: '#3f3f46',
49
51
  800: '#27272a',
50
52
  900: '#18181b',
53
+ 950: '#09090b',
51
54
  },
52
55
  neutral: {
53
56
  50: '#fafafa',
@@ -60,6 +63,7 @@ export default {
60
63
  700: '#404040',
61
64
  800: '#262626',
62
65
  900: '#171717',
66
+ 950: '#0a0a0a',
63
67
  },
64
68
  stone: {
65
69
  50: '#fafaf9',
@@ -72,6 +76,7 @@ export default {
72
76
  700: '#44403c',
73
77
  800: '#292524',
74
78
  900: '#1c1917',
79
+ 950: '#0c0a09',
75
80
  },
76
81
  red: {
77
82
  50: '#fef2f2',
@@ -84,6 +89,7 @@ export default {
84
89
  700: '#b91c1c',
85
90
  800: '#991b1b',
86
91
  900: '#7f1d1d',
92
+ 950: '#450a0a',
87
93
  },
88
94
  orange: {
89
95
  50: '#fff7ed',
@@ -96,6 +102,7 @@ export default {
96
102
  700: '#c2410c',
97
103
  800: '#9a3412',
98
104
  900: '#7c2d12',
105
+ 950: '#431407',
99
106
  },
100
107
  amber: {
101
108
  50: '#fffbeb',
@@ -108,6 +115,7 @@ export default {
108
115
  700: '#b45309',
109
116
  800: '#92400e',
110
117
  900: '#78350f',
118
+ 950: '#451a03',
111
119
  },
112
120
  yellow: {
113
121
  50: '#fefce8',
@@ -120,6 +128,7 @@ export default {
120
128
  700: '#a16207',
121
129
  800: '#854d0e',
122
130
  900: '#713f12',
131
+ 950: '#422006',
123
132
  },
124
133
  lime: {
125
134
  50: '#f7fee7',
@@ -132,6 +141,7 @@ export default {
132
141
  700: '#4d7c0f',
133
142
  800: '#3f6212',
134
143
  900: '#365314',
144
+ 950: '#1a2e05',
135
145
  },
136
146
  green: {
137
147
  50: '#f0fdf4',
@@ -144,6 +154,7 @@ export default {
144
154
  700: '#15803d',
145
155
  800: '#166534',
146
156
  900: '#14532d',
157
+ 950: '#052e16',
147
158
  },
148
159
  emerald: {
149
160
  50: '#ecfdf5',
@@ -156,6 +167,7 @@ export default {
156
167
  700: '#047857',
157
168
  800: '#065f46',
158
169
  900: '#064e3b',
170
+ 950: '#022c22',
159
171
  },
160
172
  teal: {
161
173
  50: '#f0fdfa',
@@ -168,6 +180,7 @@ export default {
168
180
  700: '#0f766e',
169
181
  800: '#115e59',
170
182
  900: '#134e4a',
183
+ 950: '#042f2e',
171
184
  },
172
185
  cyan: {
173
186
  50: '#ecfeff',
@@ -180,6 +193,7 @@ export default {
180
193
  700: '#0e7490',
181
194
  800: '#155e75',
182
195
  900: '#164e63',
196
+ 950: '#083344',
183
197
  },
184
198
  sky: {
185
199
  50: '#f0f9ff',
@@ -192,6 +206,7 @@ export default {
192
206
  700: '#0369a1',
193
207
  800: '#075985',
194
208
  900: '#0c4a6e',
209
+ 950: '#082f49',
195
210
  },
196
211
  blue: {
197
212
  50: '#eff6ff',
@@ -204,6 +219,7 @@ export default {
204
219
  700: '#1d4ed8',
205
220
  800: '#1e40af',
206
221
  900: '#1e3a8a',
222
+ 950: '#172554',
207
223
  },
208
224
  indigo: {
209
225
  50: '#eef2ff',
@@ -216,6 +232,7 @@ export default {
216
232
  700: '#4338ca',
217
233
  800: '#3730a3',
218
234
  900: '#312e81',
235
+ 950: '#1e1b4b',
219
236
  },
220
237
  violet: {
221
238
  50: '#f5f3ff',
@@ -228,6 +245,7 @@ export default {
228
245
  700: '#6d28d9',
229
246
  800: '#5b21b6',
230
247
  900: '#4c1d95',
248
+ 950: '#2e1065',
231
249
  },
232
250
  purple: {
233
251
  50: '#faf5ff',
@@ -240,6 +258,7 @@ export default {
240
258
  700: '#7e22ce',
241
259
  800: '#6b21a8',
242
260
  900: '#581c87',
261
+ 950: '#3b0764',
243
262
  },
244
263
  fuchsia: {
245
264
  50: '#fdf4ff',
@@ -252,6 +271,7 @@ export default {
252
271
  700: '#a21caf',
253
272
  800: '#86198f',
254
273
  900: '#701a75',
274
+ 950: '#4a044e',
255
275
  },
256
276
  pink: {
257
277
  50: '#fdf2f8',
@@ -264,6 +284,7 @@ export default {
264
284
  700: '#be185d',
265
285
  800: '#9d174d',
266
286
  900: '#831843',
287
+ 950: '#500724',
267
288
  },
268
289
  rose: {
269
290
  50: '#fff1f2',
@@ -276,6 +297,7 @@ export default {
276
297
  700: '#be123c',
277
298
  800: '#9f1239',
278
299
  900: '#881337',
300
+ 950: '#4c0519',
279
301
  },
280
302
  get lightBlue() {
281
303
  warn({ version: 'v2.2', from: 'lightBlue', to: 'sky' })
@@ -1,4 +1,4 @@
1
1
  import { cloneDeep } from '../util/cloneDeep'
2
- import defaultConfig from '../../stubs/defaultConfig.stub'
2
+ import defaultConfig from '../../stubs/config.full'
3
3
 
4
4
  export default cloneDeep(defaultConfig)
@@ -1,4 +1,4 @@
1
1
  import { cloneDeep } from '../util/cloneDeep'
2
- import defaultConfig from '../../stubs/defaultConfig.stub'
2
+ import defaultFullConfig from '../../stubs/config.full'
3
3
 
4
- export default cloneDeep(defaultConfig.theme)
4
+ export default cloneDeep(defaultFullConfig.theme)
@@ -0,0 +1,2 @@
1
+ import { loadConfig } from '../lib/load-config'
2
+ export default loadConfig
@@ -0,0 +1,27 @@
1
+ import parser from 'postcss-selector-parser'
2
+ import { movePseudos } from './pseudoElements'
3
+
4
+ export function applyImportantSelector(selector, important) {
5
+ let sel = parser().astSync(selector)
6
+
7
+ sel.each((sel) => {
8
+ // Wrap with :is if it's not already wrapped
9
+ let isWrapped =
10
+ sel.nodes[0].type === 'pseudo' &&
11
+ sel.nodes[0].value === ':is' &&
12
+ sel.nodes.every((node) => node.type !== 'combinator')
13
+
14
+ if (!isWrapped) {
15
+ sel.nodes = [
16
+ parser.pseudo({
17
+ value: ':is',
18
+ nodes: [sel.clone()],
19
+ }),
20
+ ]
21
+ }
22
+
23
+ movePseudos(sel)
24
+ })
25
+
26
+ return `${important} ${sel.toString()}`
27
+ }
@@ -2,8 +2,8 @@ export default function buildMediaQuery(screens) {
2
2
  screens = Array.isArray(screens) ? screens : [screens]
3
3
 
4
4
  return screens
5
- .map((screen) =>
6
- screen.values.map((screen) => {
5
+ .map((screen) => {
6
+ let values = screen.values.map((screen) => {
7
7
  if (screen.raw !== undefined) {
8
8
  return screen.raw
9
9
  }
@@ -15,6 +15,8 @@ export default function buildMediaQuery(screens) {
15
15
  .filter(Boolean)
16
16
  .join(' and ')
17
17
  })
18
- )
18
+
19
+ return screen.not ? `not all and ${values}` : values
20
+ })
19
21
  .join(', ')
20
22
  }
@@ -2,7 +2,11 @@ export default function cloneNodes(nodes, source = undefined, raws = undefined)
2
2
  return nodes.map((node) => {
3
3
  let cloned = node.clone()
4
4
 
5
- if (source !== undefined) {
5
+ // We always want override the source map
6
+ // except when explicitly told not to
7
+ let shouldOverwriteSource = node.raws.tailwind?.preserveSource !== true || !cloned.source
8
+
9
+ if (source !== undefined && shouldOverwriteSource) {
6
10
  cloned.source = source
7
11
 
8
12
  if ('walk' in cloned) {