tailwindcss 3.4.16 → 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 +19 -1
- package/lib/cli/build/plugin.js +5 -2
- package/lib/corePlugins.js +2 -2
- package/lib/lib/generateRules.js +6 -1
- package/lib/lib/load-config.js +2 -5
- package/lib/lib/setupTrackingContext.js +3 -0
- package/package.json +3 -3
- package/src/cli/build/plugin.js +5 -2
- package/src/corePlugins.js +2 -2
- package/src/lib/generateRules.js +8 -1
- package/src/lib/load-config.ts +2 -11
- package/src/lib/setupTrackingContext.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,22 @@ 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
|
+
|
|
22
|
+
## [3.4.17] - 2024-12-17
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Work around Node v22.12+ issue ([#15421](https://github.com/tailwindlabs/tailwindcss/pull/15421))
|
|
27
|
+
|
|
12
28
|
## [3.4.16] - 2024-12-03
|
|
13
29
|
|
|
14
30
|
### Fixed
|
|
@@ -2471,7 +2487,9 @@ No release notes
|
|
|
2471
2487
|
|
|
2472
2488
|
- Everything!
|
|
2473
2489
|
|
|
2474
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.
|
|
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
|
|
2492
|
+
[3.4.17]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.16...v3.4.17
|
|
2475
2493
|
[3.4.16]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.15...v3.4.16
|
|
2476
2494
|
[3.4.15]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.14...v3.4.15
|
|
2477
2495
|
[3.4.14]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.13...v3.4.14
|
package/lib/cli/build/plugin.js
CHANGED
|
@@ -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;
|
package/lib/corePlugins.js
CHANGED
|
@@ -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 =
|
|
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;
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -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
|
-
|
|
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([
|
package/lib/lib/load-config.js
CHANGED
|
@@ -46,12 +46,9 @@ function lazyJiti() {
|
|
|
46
46
|
}
|
|
47
47
|
function loadConfig(path) {
|
|
48
48
|
let config = function() {
|
|
49
|
-
|
|
50
|
-
if (path && (path.endsWith(".mjs") || path.endsWith(".ts") || path.endsWith(".cts") || path.endsWith(".mts"))) {
|
|
51
|
-
return lazyJiti()(path);
|
|
52
|
-
}
|
|
49
|
+
if (!path) return {};
|
|
53
50
|
try {
|
|
54
|
-
return
|
|
51
|
+
return require(path);
|
|
55
52
|
} catch {
|
|
56
53
|
return lazyJiti()(path);
|
|
57
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.
|
|
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.
|
|
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",
|
package/src/cli/build/plugin.js
CHANGED
|
@@ -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()
|
package/src/corePlugins.js
CHANGED
|
@@ -409,8 +409,8 @@ export let variantPlugins = {
|
|
|
409
409
|
matchVariant(
|
|
410
410
|
'supports',
|
|
411
411
|
(value = '') => {
|
|
412
|
-
let check = normalize(value)
|
|
413
|
-
let isRaw =
|
|
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.
|
package/src/lib/generateRules.js
CHANGED
|
@@ -143,7 +143,14 @@ function applyImportant(matches, classCandidate) {
|
|
|
143
143
|
className === classCandidate ? `!${className}` : className
|
|
144
144
|
)
|
|
145
145
|
|
|
146
|
-
|
|
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
|
})
|
package/src/lib/load-config.ts
CHANGED
|
@@ -33,19 +33,10 @@ function lazyJiti() {
|
|
|
33
33
|
|
|
34
34
|
export function loadConfig(path: string): Config {
|
|
35
35
|
let config = (function () {
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
path &&
|
|
39
|
-
(path.endsWith('.mjs') ||
|
|
40
|
-
path.endsWith('.ts') ||
|
|
41
|
-
path.endsWith('.cts') ||
|
|
42
|
-
path.endsWith('.mts'))
|
|
43
|
-
) {
|
|
44
|
-
return lazyJiti()(path)
|
|
45
|
-
}
|
|
36
|
+
if (!path) return {}
|
|
46
37
|
|
|
47
38
|
try {
|
|
48
|
-
return
|
|
39
|
+
return require(path)
|
|
49
40
|
} catch {
|
|
50
41
|
return lazyJiti()(path)
|
|
51
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)))
|