tailwindcss 3.4.17 → 3.4.18

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,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  - Nothing yet!
11
11
 
12
+ ## [3.4.18] - 2024-10-01
13
+
14
+ ### Fixed
15
+
16
+ - Improve support for raw `supports-[…]` queries in arbitrary values ([#13605](https://github.com/tailwindlabs/tailwindcss/pull/13605))
17
+ - Fix `require.cache` error when loaded through a TypeScript file in Node 22.18+ ([#18665](https://github.com/tailwindlabs/tailwindcss/pull/18665))
18
+ - Support `import.meta.resolve(…)` in configs for new enough Node.js versions ([#18938](https://github.com/tailwindlabs/tailwindcss/pull/18938))
19
+ - Allow using newer versions of `postcss-load-config` for better ESM and TypeScript PostCSS config support with the CLI ([#18938](https://github.com/tailwindlabs/tailwindcss/pull/18938))
20
+ - Remove irrelevant utility rules when matching important classes ([#19030](https://github.com/tailwindlabs/tailwindcss/pull/19030))
21
+
12
22
  ## [3.4.17] - 2024-12-17
13
23
 
14
24
  ### Fixed
@@ -2477,7 +2487,8 @@ No release notes
2477
2487
 
2478
2488
  - Everything!
2479
2489
 
2480
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.17...HEAD
2490
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.18...v3
2491
+ [3.4.18]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.17...v3.4.18
2481
2492
  [3.4.17]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.16...v3.4.17
2482
2493
  [3.4.16]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.15...v3.4.16
2483
2494
  [3.4.15]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.14...v3.4.15
@@ -52,10 +52,13 @@ function _interop_require_default(obj) {
52
52
  if (!config.plugins) {
53
53
  config.plugins = [];
54
54
  }
55
+ // We have to await these because in v5 and v6 of postcss-load-config
56
+ // these functions return promises while they don't in v4. Awaiting a
57
+ // non-promise is basically a no-op so this is safe to do.
55
58
  return {
56
59
  file,
57
- plugins: (0, _plugins.default)(config, file),
58
- options: (0, _options.default)(config, file)
60
+ plugins: await (0, _plugins.default)(config, file),
61
+ options: await (0, _options.default)(config, file)
59
62
  };
60
63
  })() : await (0, _postcssloadconfig.default)();
61
64
  let configPlugins = config.plugins;
@@ -441,8 +441,8 @@ let variantPlugins = {
441
441
  supportsVariants: ({ matchVariant , theme })=>{
442
442
  var _theme;
443
443
  matchVariant("supports", (value = "")=>{
444
- let check = (0, _dataTypes.normalize)(value);
445
- let isRaw = /^\w*\s*\(/.test(check);
444
+ let check = value.startsWith("--") ? value : (0, _dataTypes.normalize)(value);
445
+ let isRaw = /^[\w-]*\s*\(/.test(check);
446
446
  // Chrome has a bug where `(condition1)or(condition2)` is not valid
447
447
  // But `(condition1) or (condition2)` is supported.
448
448
  check = isRaw ? check.replace(/\b(and|or|not)\b/g, " $1 ") : check;
@@ -182,7 +182,12 @@ function applyImportant(matches, classCandidate) {
182
182
  ast.each((sel)=>(0, _formatVariantSelector.eliminateIrrelevantSelectors)(sel, classCandidate));
183
183
  // Update all instances of the base candidate to include the important marker
184
184
  (0, _pluginUtils.updateAllClasses)(ast, (className)=>className === classCandidate ? `!${className}` : className);
185
- r.selector = ast.toString();
185
+ let newSelector = ast.toString();
186
+ if (newSelector.trim() === "") {
187
+ r.remove();
188
+ return;
189
+ }
190
+ r.selector = newSelector;
186
191
  r.walkDecls((d)=>d.important = true);
187
192
  });
188
193
  result.push([
@@ -47,15 +47,8 @@ function lazyJiti() {
47
47
  function loadConfig(path) {
48
48
  let config = function() {
49
49
  if (!path) return {};
50
- // Always use jiti for now. There is a a bug that occurs in Node v22.12+
51
- // where imported files return invalid results
52
- return lazyJiti()(path);
53
- // Always use jiti for ESM or TS files
54
- if (path && (path.endsWith(".mjs") || path.endsWith(".ts") || path.endsWith(".cts") || path.endsWith(".mts"))) {
55
- return lazyJiti()(path);
56
- }
57
50
  try {
58
- return path ? require(path) : {};
51
+ return require(path);
59
52
  } catch {
60
53
  return lazyJiti()(path);
61
54
  }
@@ -66,6 +66,9 @@ function getTailwindConfig(configOrPath) {
66
66
  }
67
67
  // It has changed (based on timestamps), or first run
68
68
  for (let file of newDeps){
69
+ // When loaded transitively through a TypeScript file `require.cache`
70
+ // may be undefined. Happens in Node 22.18+.
71
+ if (!require.cache) continue;
69
72
  delete require.cache[file];
70
73
  }
71
74
  let newConfig = (0, _validateConfig.validateConfig)((0, _resolveconfig.default)((0, _loadconfig.loadConfig)(userConfigPath)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.4.17",
3
+ "version": "3.4.18",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -72,7 +72,7 @@
72
72
  "fast-glob": "^3.3.2",
73
73
  "glob-parent": "^6.0.2",
74
74
  "is-glob": "^4.0.3",
75
- "jiti": "^1.21.6",
75
+ "jiti": "^1.21.7",
76
76
  "lilconfig": "^3.1.3",
77
77
  "micromatch": "^4.0.8",
78
78
  "normalize-path": "^3.0.0",
@@ -81,7 +81,7 @@
81
81
  "postcss": "^8.4.47",
82
82
  "postcss-import": "^15.1.0",
83
83
  "postcss-js": "^4.0.1",
84
- "postcss-load-config": "^4.0.2",
84
+ "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0",
85
85
  "postcss-nested": "^6.2.0",
86
86
  "postcss-selector-parser": "^6.1.2",
87
87
  "resolve": "^1.22.8",
@@ -43,10 +43,13 @@ async function loadPostCssPlugins(customPostCssPath) {
43
43
  config.plugins = []
44
44
  }
45
45
 
46
+ // We have to await these because in v5 and v6 of postcss-load-config
47
+ // these functions return promises while they don't in v4. Awaiting a
48
+ // non-promise is basically a no-op so this is safe to do.
46
49
  return {
47
50
  file,
48
- plugins: loadPlugins(config, file),
49
- options: loadOptions(config, file),
51
+ plugins: await loadPlugins(config, file),
52
+ options: await loadOptions(config, file),
50
53
  }
51
54
  })()
52
55
  : await postcssrc()
@@ -409,8 +409,8 @@ export let variantPlugins = {
409
409
  matchVariant(
410
410
  'supports',
411
411
  (value = '') => {
412
- let check = normalize(value)
413
- let isRaw = /^\w*\s*\(/.test(check)
412
+ let check = value.startsWith('--') ? value : normalize(value)
413
+ let isRaw = /^[\w-]*\s*\(/.test(check)
414
414
 
415
415
  // Chrome has a bug where `(condition1)or(condition2)` is not valid
416
416
  // But `(condition1) or (condition2)` is supported.
@@ -143,7 +143,14 @@ function applyImportant(matches, classCandidate) {
143
143
  className === classCandidate ? `!${className}` : className
144
144
  )
145
145
 
146
- r.selector = ast.toString()
146
+ let newSelector = ast.toString()
147
+
148
+ if (newSelector.trim() === '') {
149
+ r.remove()
150
+ return
151
+ }
152
+
153
+ r.selector = newSelector
147
154
 
148
155
  r.walkDecls((d) => (d.important = true))
149
156
  })
@@ -35,23 +35,8 @@ export function loadConfig(path: string): Config {
35
35
  let config = (function () {
36
36
  if (!path) return {}
37
37
 
38
- // Always use jiti for now. There is a a bug that occurs in Node v22.12+
39
- // where imported files return invalid results
40
- return lazyJiti()(path)
41
-
42
- // Always use jiti for ESM or TS files
43
- if (
44
- path &&
45
- (path.endsWith('.mjs') ||
46
- path.endsWith('.ts') ||
47
- path.endsWith('.cts') ||
48
- path.endsWith('.mts'))
49
- ) {
50
- return lazyJiti()(path)
51
- }
52
-
53
38
  try {
54
- return path ? require(path) : {}
39
+ return require(path)
55
40
  } catch {
56
41
  return lazyJiti()(path)
57
42
  }
@@ -54,6 +54,9 @@ function getTailwindConfig(configOrPath) {
54
54
 
55
55
  // It has changed (based on timestamps), or first run
56
56
  for (let file of newDeps) {
57
+ // When loaded transitively through a TypeScript file `require.cache`
58
+ // may be undefined. Happens in Node 22.18+.
59
+ if (!require.cache) continue
57
60
  delete require.cache[file]
58
61
  }
59
62
  let newConfig = validateConfig(resolveConfig(loadConfig(userConfigPath)))