tailwindcss 3.0.13 → 3.0.17
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 +36 -1
- package/lib/cli.js +9 -3
- package/lib/corePlugins.js +2 -1
- package/lib/lib/expandTailwindAtRules.js +27 -9
- package/lib/lib/generateRules.js +7 -0
- package/lib/lib/normalizeTailwindDirectives.js +2 -1
- package/lib/lib/setupContextUtils.js +4 -2
- package/{nesting → lib/postcss-plugins/nesting}/README.md +0 -0
- package/lib/postcss-plugins/nesting/index.js +17 -0
- package/lib/postcss-plugins/nesting/plugin.js +53 -0
- package/lib/util/normalizeConfig.js +13 -4
- package/nesting/index.js +2 -12
- package/package.json +8 -8
- package/peers/index.js +787 -743
- package/src/cli.js +5 -3
- package/src/corePlugins.js +1 -0
- package/src/lib/expandTailwindAtRules.js +31 -6
- package/src/lib/generateRules.js +6 -0
- package/src/lib/normalizeTailwindDirectives.js +1 -0
- package/src/lib/setupContextUtils.js +2 -1
- package/src/postcss-plugins/nesting/README.md +42 -0
- package/src/postcss-plugins/nesting/index.js +13 -0
- package/{nesting → src/postcss-plugins/nesting}/plugin.js +7 -4
- package/src/util/normalizeConfig.js +12 -4
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
- Nothing yet!
|
|
11
11
|
|
|
12
|
+
## [3.0.17] - 2022-01-26
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Remove false positive warning in CLI when using the `--content` option ([#7220](https://github.com/tailwindlabs/tailwindcss/pull/7220))
|
|
17
|
+
|
|
18
|
+
## [3.0.16] - 2022-01-24
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- Ensure to transpile the PostCSS Nesting plugin (tailwindcss/nesting) ([#7080](https://github.com/tailwindlabs/tailwindcss/pull/7080))
|
|
23
|
+
- Improve various warnings ([#7118](https://github.com/tailwindlabs/tailwindcss/pull/7118))
|
|
24
|
+
- Fix grammatical mistake ([cca5a38](https://github.com/tailwindlabs/tailwindcss/commit/cca5a3804e1d3ee0214491921e1aec35bf62a813))
|
|
25
|
+
|
|
26
|
+
## [3.0.15] - 2022-01-15
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Temporarily remove optional chaining in nesting plugin ([#7077](https://github.com/tailwindlabs/tailwindcss/pull/7077))
|
|
31
|
+
|
|
32
|
+
## [3.0.14] - 2022-01-14
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- Show warnings for invalid content config ([#7065](https://github.com/tailwindlabs/tailwindcss/pull/7065))
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- Only emit utility/component variants when those layers exist ([#7066](https://github.com/tailwindlabs/tailwindcss/pull/7066))
|
|
41
|
+
- Ensure nesting plugins can receive options ([#7016](https://github.com/tailwindlabs/tailwindcss/pull/7016))
|
|
42
|
+
|
|
12
43
|
## [3.0.13] - 2022-01-11
|
|
13
44
|
|
|
14
45
|
### Fixed
|
|
@@ -1798,7 +1829,11 @@ No release notes
|
|
|
1798
1829
|
|
|
1799
1830
|
- Everything!
|
|
1800
1831
|
|
|
1801
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.
|
|
1832
|
+
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.17...HEAD
|
|
1833
|
+
[3.0.17]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.16...v3.0.17
|
|
1834
|
+
[3.0.16]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.15...v3.0.16
|
|
1835
|
+
[3.0.15]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.14...v3.0.15
|
|
1836
|
+
[3.0.14]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.13...v3.0.14
|
|
1802
1837
|
[3.0.13]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.12...v3.0.13
|
|
1803
1838
|
[3.0.12]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.11...v3.0.12
|
|
1804
1839
|
[3.0.11]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.10...v3.0.11
|
package/lib/cli.js
CHANGED
|
@@ -400,7 +400,6 @@ async function build() {
|
|
|
400
400
|
}
|
|
401
401
|
function resolveConfig() {
|
|
402
402
|
let config = configPath ? require(configPath) : {};
|
|
403
|
-
let resolvedConfig = (0, _resolveConfig).default(config);
|
|
404
403
|
if (args['--purge']) {
|
|
405
404
|
_log.default.warn('purge-flag-deprecated', [
|
|
406
405
|
'The `--purge` flag has been deprecated.',
|
|
@@ -411,9 +410,16 @@ async function build() {
|
|
|
411
410
|
}
|
|
412
411
|
}
|
|
413
412
|
if (args['--content']) {
|
|
414
|
-
|
|
413
|
+
let files = args['--content'].split(/(?<!{[^}]+),/);
|
|
414
|
+
let resolvedConfig = (0, _resolveConfig).default(config, {
|
|
415
|
+
content: {
|
|
416
|
+
files
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
resolvedConfig.content.files = files;
|
|
420
|
+
return resolvedConfig;
|
|
415
421
|
}
|
|
416
|
-
return
|
|
422
|
+
return (0, _resolveConfig).default(config);
|
|
417
423
|
}
|
|
418
424
|
function extractFileGlobs(config) {
|
|
419
425
|
return config.content.files.filter((file)=>{
|
package/lib/corePlugins.js
CHANGED
|
@@ -184,7 +184,8 @@ let variantPlugins = {
|
|
|
184
184
|
mode = 'media';
|
|
185
185
|
_log.default.warn('darkmode-false', [
|
|
186
186
|
'The `darkMode` option in your Tailwind CSS configuration is set to `false`, which now behaves the same as `media`.',
|
|
187
|
-
'Change `darkMode` to `media` or remove it entirely.',
|
|
187
|
+
'Change `darkMode` to `media` or remove it entirely.',
|
|
188
|
+
'https://tailwindcss.com/docs/upgrade-guide#remove-dark-mode-configuration',
|
|
188
189
|
]);
|
|
189
190
|
}
|
|
190
191
|
if (mode === 'class') {
|
|
@@ -7,6 +7,7 @@ var _quickLru = _interopRequireDefault(require("quick-lru"));
|
|
|
7
7
|
var sharedState = _interopRequireWildcard(require("./sharedState"));
|
|
8
8
|
var _generateRules = require("./generateRules");
|
|
9
9
|
var _bigSign = _interopRequireDefault(require("../util/bigSign"));
|
|
10
|
+
var _log = _interopRequireDefault(require("../util/log"));
|
|
10
11
|
var _cloneNodes = _interopRequireDefault(require("../util/cloneNodes"));
|
|
11
12
|
var _defaultExtractor = require("./defaultExtractor");
|
|
12
13
|
function _interopRequireDefault(obj) {
|
|
@@ -191,8 +192,6 @@ function expandTailwindAtRules(context) {
|
|
|
191
192
|
...baseNodes,
|
|
192
193
|
...defaultNodes
|
|
193
194
|
], layerNodes.base.source));
|
|
194
|
-
}
|
|
195
|
-
if (layerNodes.base) {
|
|
196
195
|
layerNodes.base.remove();
|
|
197
196
|
}
|
|
198
197
|
if (layerNodes.components) {
|
|
@@ -207,15 +206,34 @@ function expandTailwindAtRules(context) {
|
|
|
207
206
|
], layerNodes.utilities.source));
|
|
208
207
|
layerNodes.utilities.remove();
|
|
209
208
|
}
|
|
209
|
+
// We do post-filtering to not alter the emitted order of the variants
|
|
210
|
+
const variantNodes = Array.from(screenNodes).filter((node)=>{
|
|
211
|
+
var ref;
|
|
212
|
+
const parentLayer = (ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.parentLayer;
|
|
213
|
+
if (parentLayer === 'components') {
|
|
214
|
+
return layerNodes.components !== null;
|
|
215
|
+
}
|
|
216
|
+
if (parentLayer === 'utilities') {
|
|
217
|
+
return layerNodes.utilities !== null;
|
|
218
|
+
}
|
|
219
|
+
return true;
|
|
220
|
+
});
|
|
210
221
|
if (layerNodes.variants) {
|
|
211
|
-
layerNodes.variants.before((0, _cloneNodes).default(
|
|
212
|
-
...screenNodes
|
|
213
|
-
], layerNodes.variants.source));
|
|
222
|
+
layerNodes.variants.before((0, _cloneNodes).default(variantNodes, layerNodes.variants.source));
|
|
214
223
|
layerNodes.variants.remove();
|
|
215
|
-
} else {
|
|
216
|
-
root.append((0, _cloneNodes).default(
|
|
217
|
-
|
|
218
|
-
|
|
224
|
+
} else if (variantNodes.length > 0) {
|
|
225
|
+
root.append((0, _cloneNodes).default(variantNodes, root.source));
|
|
226
|
+
}
|
|
227
|
+
// If we've got a utility layer and no utilities are generated there's likely something wrong
|
|
228
|
+
const hasUtilityVariants = variantNodes.some((node)=>{
|
|
229
|
+
var ref;
|
|
230
|
+
return ((ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.parentLayer) === 'utilities';
|
|
231
|
+
});
|
|
232
|
+
if (layerNodes.utilities && utilityNodes.size === 0 && !hasUtilityVariants) {
|
|
233
|
+
_log.default.warn('content-problems', [
|
|
234
|
+
'No utility classes were detected in your source files. If this is unexpected, double-check the `content` option in your Tailwind CSS configuration.',
|
|
235
|
+
'https://tailwindcss.com/docs/content-configuration',
|
|
236
|
+
]);
|
|
219
237
|
}
|
|
220
238
|
// ---
|
|
221
239
|
if (env.DEBUG) {
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -217,6 +217,13 @@ function applyVariant(variant, matches, context) {
|
|
|
217
217
|
rule.selector = before;
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
+
// This tracks the originating layer for the variant
|
|
221
|
+
// For example:
|
|
222
|
+
// .sm:underline {} is a variant of something in the utilities layer
|
|
223
|
+
// .sm:container {} is a variant of the container component
|
|
224
|
+
clone.nodes[0].raws.tailwind = {
|
|
225
|
+
parentLayer: meta.layer
|
|
226
|
+
};
|
|
220
227
|
var _collectedFormats;
|
|
221
228
|
let withOffset = [
|
|
222
229
|
{
|
|
@@ -49,7 +49,8 @@ function normalizeTailwindDirectives(root) {
|
|
|
49
49
|
].includes(atRule.name)) {
|
|
50
50
|
_log.default.warn(`${atRule.name}-at-rule-deprecated`, [
|
|
51
51
|
`The \`@${atRule.name}\` directive has been deprecated in Tailwind CSS v3.0.`,
|
|
52
|
-
`Use \`@layer utilities\` or \`@layer components\` instead.`,
|
|
52
|
+
`Use \`@layer utilities\` or \`@layer components\` instead.`,
|
|
53
|
+
'https://tailwindcss.com/docs/upgrade-guide#replace-variants-with-layer',
|
|
53
54
|
]);
|
|
54
55
|
}
|
|
55
56
|
layerDirectives.add(atRule);
|
|
@@ -664,7 +664,8 @@ function registerPlugins(plugins, context) {
|
|
|
664
664
|
if (value1 instanceof RegExp) {
|
|
665
665
|
_log.default.warn('root-regex', [
|
|
666
666
|
'Regular expressions in `safelist` work differently in Tailwind CSS v3.0.',
|
|
667
|
-
'Update your `safelist` configuration to eliminate this warning.'
|
|
667
|
+
'Update your `safelist` configuration to eliminate this warning.',
|
|
668
|
+
'https://tailwindcss.com/docs/content-configuration#safelisting-classes',
|
|
668
669
|
]);
|
|
669
670
|
continue;
|
|
670
671
|
}
|
|
@@ -716,7 +717,8 @@ function registerPlugins(plugins, context) {
|
|
|
716
717
|
if (count !== 0) continue;
|
|
717
718
|
_log.default.warn([
|
|
718
719
|
`The safelist pattern \`${regex}\` doesn't match any Tailwind CSS classes.`,
|
|
719
|
-
'Fix this pattern or remove it from your `safelist` configuration.',
|
|
720
|
+
'Fix this pattern or remove it from your `safelist` configuration.',
|
|
721
|
+
'https://tailwindcss.com/docs/content-configuration#safelisting-classes',
|
|
720
722
|
]);
|
|
721
723
|
}
|
|
722
724
|
}
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var _plugin = require("./plugin");
|
|
7
|
+
var _default = Object.assign(function(opts) {
|
|
8
|
+
return {
|
|
9
|
+
postcssPlugin: 'tailwindcss/nesting',
|
|
10
|
+
Once (root, { result }) {
|
|
11
|
+
return (0, _plugin).nesting(opts)(root, result);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}, {
|
|
15
|
+
postcss: true
|
|
16
|
+
});
|
|
17
|
+
exports.default = _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.nesting = nesting;
|
|
6
|
+
var _postcss = _interopRequireDefault(require("postcss"));
|
|
7
|
+
var _postcssNested = _interopRequireDefault(require("postcss-nested"));
|
|
8
|
+
function _interopRequireDefault(obj) {
|
|
9
|
+
return obj && obj.__esModule ? obj : {
|
|
10
|
+
default: obj
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function nesting(opts = _postcssNested.default) {
|
|
14
|
+
return (root, result)=>{
|
|
15
|
+
root.walkAtRules('screen', (rule)=>{
|
|
16
|
+
rule.name = 'media';
|
|
17
|
+
rule.params = `screen(${rule.params})`;
|
|
18
|
+
});
|
|
19
|
+
root.walkAtRules('apply', (rule)=>{
|
|
20
|
+
rule.before(_postcss.default.decl({
|
|
21
|
+
prop: '__apply',
|
|
22
|
+
value: rule.params,
|
|
23
|
+
source: rule.source
|
|
24
|
+
}));
|
|
25
|
+
rule.remove();
|
|
26
|
+
});
|
|
27
|
+
let plugin = (()=>{
|
|
28
|
+
var ref;
|
|
29
|
+
if (typeof opts === 'function' || typeof opts === 'object' && (opts === null || opts === void 0 ? void 0 : (ref = opts.hasOwnProperty) === null || ref === void 0 ? void 0 : ref.call(opts, 'postcssPlugin'))) {
|
|
30
|
+
return opts;
|
|
31
|
+
}
|
|
32
|
+
if (typeof opts === 'string') {
|
|
33
|
+
return require(opts);
|
|
34
|
+
}
|
|
35
|
+
if (Object.keys(opts).length <= 0) {
|
|
36
|
+
return _postcssNested.default;
|
|
37
|
+
}
|
|
38
|
+
throw new Error('tailwindcss/nesting should be loaded with a nesting plugin.');
|
|
39
|
+
})();
|
|
40
|
+
(0, _postcss).default([
|
|
41
|
+
plugin
|
|
42
|
+
]).process(root, result.opts).sync();
|
|
43
|
+
root.walkDecls('__apply', (decl)=>{
|
|
44
|
+
decl.before(_postcss.default.atRule({
|
|
45
|
+
name: 'apply',
|
|
46
|
+
params: decl.value,
|
|
47
|
+
source: decl.source
|
|
48
|
+
}));
|
|
49
|
+
decl.remove();
|
|
50
|
+
});
|
|
51
|
+
return root;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -123,7 +123,8 @@ function normalizeConfig(config) {
|
|
|
123
123
|
if (!valid) {
|
|
124
124
|
_log.default.warn('purge-deprecation', [
|
|
125
125
|
'The `purge`/`content` options have changed in Tailwind CSS v3.0.',
|
|
126
|
-
'Update your configuration file to eliminate this warning.'
|
|
126
|
+
'Update your configuration file to eliminate this warning.',
|
|
127
|
+
'https://tailwindcss.com/docs/upgrade-guide#configure-content-sources',
|
|
127
128
|
]);
|
|
128
129
|
}
|
|
129
130
|
// Normalize the `safelist`
|
|
@@ -140,7 +141,8 @@ function normalizeConfig(config) {
|
|
|
140
141
|
if (typeof config.prefix === 'function') {
|
|
141
142
|
_log.default.warn('prefix-function', [
|
|
142
143
|
'As of Tailwind CSS v3.0, `prefix` cannot be a function.',
|
|
143
|
-
'Update `prefix` in your configuration to be a string to eliminate this warning.'
|
|
144
|
+
'Update `prefix` in your configuration to be a string to eliminate this warning.',
|
|
145
|
+
'https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function',
|
|
144
146
|
]);
|
|
145
147
|
config.prefix = '';
|
|
146
148
|
} else {
|
|
@@ -221,11 +223,18 @@ function normalizeConfig(config) {
|
|
|
221
223
|
for (let file of config.content.files){
|
|
222
224
|
if (typeof file === 'string' && /{([^,]*?)}/g.test(file)) {
|
|
223
225
|
_log.default.warn('invalid-glob-braces', [
|
|
224
|
-
`The glob pattern ${(0, _log).dim(file)} in your
|
|
225
|
-
`
|
|
226
|
+
`The glob pattern ${(0, _log).dim(file)} in your Tailwind CSS configuration is invalid.`,
|
|
227
|
+
`Update it to ${(0, _log).dim(file.replace(/{([^,]*?)}/g, '$1'))} to silence this warning.`
|
|
226
228
|
]);
|
|
227
229
|
break;
|
|
228
230
|
}
|
|
229
231
|
}
|
|
232
|
+
if (config.content.files.length === 0) {
|
|
233
|
+
_log.default.warn('content-problems', [
|
|
234
|
+
'The `content` option in your Tailwind CSS configuration is missing or empty.',
|
|
235
|
+
'Configure your content sources or your generated CSS will be missing styles.',
|
|
236
|
+
'https://tailwindcss.com/docs/content-configuration',
|
|
237
|
+
]);
|
|
238
|
+
}
|
|
230
239
|
return config;
|
|
231
240
|
}
|
package/nesting/index.js
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
let nesting = require('
|
|
2
|
-
|
|
3
|
-
module.exports = (opts) => {
|
|
4
|
-
return {
|
|
5
|
-
postcssPlugin: 'tailwindcss/nesting',
|
|
6
|
-
Once(root, { result }) {
|
|
7
|
-
return nesting(opts)(root, result)
|
|
8
|
-
},
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
module.exports.postcss = true
|
|
1
|
+
let nesting = require('../lib/postcss-plugins/nesting')
|
|
2
|
+
module.exports = (nesting.__esModule ? nesting : { default: nesting }).default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.17",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -45,16 +45,16 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@swc/cli": "^0.1.55",
|
|
47
47
|
"@swc/core": "^1.2.127",
|
|
48
|
-
"@swc/jest": "^0.2.
|
|
48
|
+
"@swc/jest": "^0.2.17",
|
|
49
49
|
"@swc/register": "^0.1.7",
|
|
50
|
-
"autoprefixer": "^10.4.
|
|
51
|
-
"cssnano": "^5.0.
|
|
50
|
+
"autoprefixer": "^10.4.2",
|
|
51
|
+
"cssnano": "^5.0.15",
|
|
52
52
|
"esbuild": "^0.14.10",
|
|
53
53
|
"eslint": "^8.6.0",
|
|
54
54
|
"eslint-config-prettier": "^8.3.0",
|
|
55
55
|
"eslint-plugin-prettier": "^4.0.0",
|
|
56
|
-
"jest": "^27.4.
|
|
57
|
-
"jest-diff": "^27.4.
|
|
56
|
+
"jest": "^27.4.7",
|
|
57
|
+
"jest-diff": "^27.4.6",
|
|
58
58
|
"postcss": "^8.4.5",
|
|
59
59
|
"prettier": "^2.5.1",
|
|
60
60
|
"rimraf": "^3.0.0"
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"arg": "^5.0.1",
|
|
68
68
|
"chalk": "^4.1.2",
|
|
69
|
-
"chokidar": "^3.5.
|
|
69
|
+
"chokidar": "^3.5.3",
|
|
70
70
|
"color-name": "^1.1.4",
|
|
71
71
|
"cosmiconfig": "^7.0.1",
|
|
72
72
|
"detective": "^5.2.0",
|
|
73
73
|
"didyoumean": "^1.2.2",
|
|
74
74
|
"dlv": "^1.1.3",
|
|
75
|
-
"fast-glob": "^3.2.
|
|
75
|
+
"fast-glob": "^3.2.11",
|
|
76
76
|
"glob-parent": "^6.0.2",
|
|
77
77
|
"is-glob": "^4.0.3",
|
|
78
78
|
"normalize-path": "^3.0.0",
|