tailwindcss 3.2.2 → 3.2.3

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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  - Nothing yet!
11
11
 
12
+ ## [3.2.3] - 2022-11-09
13
+
14
+ ### Fixed
15
+
16
+ - Fixed use of `raw` content in the CLI ([#9773](https://github.com/tailwindlabs/tailwindcss/pull/9773))
17
+ - Pick up changes from files that are both context and content deps ([#9787](https://github.com/tailwindlabs/tailwindcss/pull/9787))
18
+ - Sort pseudo-elements ONLY after classes when using variants and `@apply` ([#9765](https://github.com/tailwindlabs/tailwindcss/pull/9765))
19
+ - Support important utilities in the safelist (pattern must include a `!`) ([#9791](https://github.com/tailwindlabs/tailwindcss/pull/9791))
20
+
12
21
  ## [3.2.2] - 2022-11-04
13
22
 
14
23
  ### Fixed
@@ -2101,7 +2110,8 @@ No release notes
2101
2110
 
2102
2111
  - Everything!
2103
2112
 
2104
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.2...HEAD
2113
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.3...HEAD
2114
+ [3.2.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.2...v3.2.3
2105
2115
  [3.2.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.1...v3.2.2
2106
2116
  [3.2.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.0...v3.2.1
2107
2117
  [3.2.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.8...v3.2.0
@@ -170,9 +170,9 @@ let state = {
170
170
  let rawContent = this.config.content.files.filter((file)=>{
171
171
  return file !== null && typeof file === "object";
172
172
  });
173
- for (let { raw: content1 , extension ="html" } of rawContent){
174
- content1.push({
175
- content: content1,
173
+ for (let { raw: htmlContent , extension ="html" } of rawContent){
174
+ content.push({
175
+ content: htmlContent,
176
176
  extension
177
177
  });
178
178
  }
@@ -160,7 +160,14 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
160
160
  for (let file of files){
161
161
  let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
162
162
  let modified = _fs.default.statSync(file).mtimeMs;
163
- if (modified > prevModified) {
163
+ // This check is intentionally >= because we track the last modified time of context dependencies
164
+ // earier in the process and we want to make sure we don't miss any changes that happen
165
+ // when a context dependency is also a content dependency
166
+ // Ideally, we'd do all this tracking at one time but that is a larger refactor
167
+ // than we want to commit to right now, so this is a decent compromise.
168
+ // This should be sufficient because file modification times will be off by at least
169
+ // 1ms (the precision of fstat in Node) in most cases if they exist and were changed.
170
+ if (modified >= prevModified) {
164
171
  changedFiles.add(file);
165
172
  fileModifiedMap.set(file, modified);
166
173
  }
@@ -330,9 +330,9 @@ function processApply(root, context, localCache) {
330
330
  return -1;
331
331
  } else if (a.type === "class" && b.type === "tag") {
332
332
  return 1;
333
- } else if (a.type === "class" && b.type === "pseudo") {
333
+ } else if (a.type === "class" && b.type === "pseudo" && b.value.startsWith("::")) {
334
334
  return -1;
335
- } else if (a.type === "pseudo" && b.type === "class") {
335
+ } else if (a.type === "pseudo" && a.value.startsWith("::") && b.type === "class") {
336
336
  return 1;
337
337
  }
338
338
  return 0;
@@ -799,6 +799,7 @@ function registerPlugins(plugins, context) {
799
799
  if (checks.length > 0) {
800
800
  let patternMatchingCount = new Map();
801
801
  let prefixLength = context.tailwindConfig.prefix.length;
802
+ let checkImportantUtils = checks.some((check)=>check.pattern.source.includes("!"));
802
803
  for (let util of classList){
803
804
  let utils = Array.isArray(util) ? (()=>{
804
805
  let [utilName, options] = util;
@@ -827,6 +828,12 @@ function registerPlugins(plugins, context) {
827
828
  ...classes.flatMap((cls)=>Object.keys(context.tailwindConfig.theme.opacity).map((opacity)=>`${cls}/${opacity}`))
828
829
  ];
829
830
  }
831
+ if (checkImportantUtils && (options === null || options === void 0 ? void 0 : options.respectImportant)) {
832
+ classes = [
833
+ ...classes,
834
+ ...classes.map((cls)=>"!" + cls)
835
+ ];
836
+ }
830
837
  return classes;
831
838
  })() : [
832
839
  util
@@ -78,9 +78,9 @@ function formatVariantSelector(current, ...others) {
78
78
  return -1;
79
79
  } else if (a.type === "class" && b.type === "tag") {
80
80
  return 1;
81
- } else if (a.type === "class" && b.type === "pseudo" && b.value !== ":merge") {
81
+ } else if (a.type === "class" && b.type === "pseudo" && b.value.startsWith("::")) {
82
82
  return -1;
83
- } else if (a.type === "pseudo" && a.value !== ":merge" && b.type === "class") {
83
+ } else if (a.type === "pseudo" && a.value.startsWith("::") && b.type === "class") {
84
84
  return 1;
85
85
  }
86
86
  return sel.index(a) - sel.index(b);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -50,7 +50,7 @@
50
50
  "autoprefixer": "^10.4.13",
51
51
  "cssnano": "^5.1.14",
52
52
  "esbuild": "^0.15.12",
53
- "eslint": "^8.25.0",
53
+ "eslint": "^8.26.0",
54
54
  "eslint-config-prettier": "^8.5.0",
55
55
  "eslint-plugin-prettier": "^4.2.1",
56
56
  "jest": "^28.1.3",
@@ -195,8 +195,8 @@ let state = {
195
195
  return file !== null && typeof file === 'object'
196
196
  })
197
197
 
198
- for (let { raw: content, extension = 'html' } of rawContent) {
199
- content.push({ content, extension })
198
+ for (let { raw: htmlContent, extension = 'html' } of rawContent) {
199
+ content.push({ content: htmlContent, extension })
200
200
  }
201
201
 
202
202
  return content
@@ -196,7 +196,14 @@ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
196
196
  let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity
197
197
  let modified = fs.statSync(file).mtimeMs
198
198
 
199
- if (modified > prevModified) {
199
+ // This check is intentionally >= because we track the last modified time of context dependencies
200
+ // earier in the process and we want to make sure we don't miss any changes that happen
201
+ // when a context dependency is also a content dependency
202
+ // Ideally, we'd do all this tracking at one time but that is a larger refactor
203
+ // than we want to commit to right now, so this is a decent compromise.
204
+ // This should be sufficient because file modification times will be off by at least
205
+ // 1ms (the precision of fstat in Node) in most cases if they exist and were changed.
206
+ if (modified >= prevModified) {
200
207
  changedFiles.add(file)
201
208
  fileModifiedMap.set(file, modified)
202
209
  }
@@ -370,9 +370,9 @@ function processApply(root, context, localCache) {
370
370
  return -1
371
371
  } else if (a.type === 'class' && b.type === 'tag') {
372
372
  return 1
373
- } else if (a.type === 'class' && b.type === 'pseudo') {
373
+ } else if (a.type === 'class' && b.type === 'pseudo' && b.value.startsWith('::')) {
374
374
  return -1
375
- } else if (a.type === 'pseudo' && b.type === 'class') {
375
+ } else if (a.type === 'pseudo' && a.value.startsWith('::') && b.type === 'class') {
376
376
  return 1
377
377
  }
378
378
 
@@ -825,6 +825,7 @@ function registerPlugins(plugins, context) {
825
825
  if (checks.length > 0) {
826
826
  let patternMatchingCount = new Map()
827
827
  let prefixLength = context.tailwindConfig.prefix.length
828
+ let checkImportantUtils = checks.some((check) => check.pattern.source.includes('!'))
828
829
 
829
830
  for (let util of classList) {
830
831
  let utils = Array.isArray(util)
@@ -861,6 +862,10 @@ function registerPlugins(plugins, context) {
861
862
  ]
862
863
  }
863
864
 
865
+ if (checkImportantUtils && options?.respectImportant) {
866
+ classes = [...classes, ...classes.map((cls) => '!' + cls)]
867
+ }
868
+
864
869
  return classes
865
870
  })()
866
871
  : [util]
@@ -69,9 +69,9 @@ function resortSelector(sel) {
69
69
  return -1
70
70
  } else if (a.type === 'class' && b.type === 'tag') {
71
71
  return 1
72
- } else if (a.type === 'class' && b.type === 'pseudo' && b.value !== ':merge') {
72
+ } else if (a.type === 'class' && b.type === 'pseudo' && b.value.startsWith('::')) {
73
73
  return -1
74
- } else if (a.type === 'pseudo' && a.value !== ':merge' && b.type === 'class') {
74
+ } else if (a.type === 'pseudo' && a.value.startsWith('::') && b.type === 'class') {
75
75
  return 1
76
76
  }
77
77