tailwindcss 3.0.12 → 3.0.16

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 (37) hide show
  1. package/CHANGELOG.md +38 -5
  2. package/lib/cli.js +8 -16
  3. package/lib/corePlugins.js +71 -139
  4. package/lib/featureFlags.js +1 -2
  5. package/lib/lib/expandTailwindAtRules.js +29 -13
  6. package/lib/lib/generateRules.js +8 -2
  7. package/lib/lib/normalizeTailwindDirectives.js +2 -1
  8. package/lib/lib/partitionApplyAtRules.js +53 -0
  9. package/lib/lib/setupContextUtils.js +56 -120
  10. package/{nesting → lib/postcss-plugins/nesting}/README.md +0 -0
  11. package/lib/postcss-plugins/nesting/index.js +17 -0
  12. package/lib/postcss-plugins/nesting/plugin.js +53 -0
  13. package/lib/processTailwindFeatures.js +2 -0
  14. package/lib/util/createPlugin.js +1 -2
  15. package/lib/util/createUtilityPlugin.js +4 -8
  16. package/lib/util/flattenColorPalette.js +1 -3
  17. package/lib/util/normalizeConfig.js +19 -16
  18. package/lib/util/normalizeScreens.js +2 -4
  19. package/lib/util/pluginUtils.js +5 -12
  20. package/lib/util/resolveConfig.js +9 -18
  21. package/lib/util/resolveConfigPath.js +1 -2
  22. package/lib/util/toColorValue.js +1 -2
  23. package/lib/util/transformThemeValue.js +4 -8
  24. package/nesting/index.js +2 -12
  25. package/package.json +10 -12
  26. package/peers/index.js +261 -231
  27. package/src/corePlugins.js +1 -0
  28. package/src/lib/expandTailwindAtRules.js +31 -6
  29. package/src/lib/generateRules.js +6 -0
  30. package/src/lib/normalizeTailwindDirectives.js +1 -0
  31. package/src/lib/partitionApplyAtRules.js +52 -0
  32. package/src/lib/setupContextUtils.js +7 -75
  33. package/src/postcss-plugins/nesting/README.md +42 -0
  34. package/src/postcss-plugins/nesting/index.js +13 -0
  35. package/{nesting → src/postcss-plugins/nesting}/plugin.js +7 -4
  36. package/src/processTailwindFeatures.js +2 -0
  37. package/src/util/normalizeConfig.js +12 -4
@@ -8,13 +8,11 @@ function _interopRequireWildcard(obj) {
8
8
  if (obj && obj.__esModule) {
9
9
  return obj;
10
10
  } else {
11
- var newObj = {
12
- };
11
+ var newObj = {};
13
12
  if (obj != null) {
14
13
  for(var key in obj){
15
14
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
16
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
17
- };
15
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
18
16
  if (desc.get || desc.set) {
19
17
  Object.defineProperty(newObj, key, desc);
20
18
  } else {
@@ -125,7 +123,8 @@ function normalizeConfig(config) {
125
123
  if (!valid) {
126
124
  _log.default.warn('purge-deprecation', [
127
125
  'The `purge`/`content` options have changed in Tailwind CSS v3.0.',
128
- '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',
129
128
  ]);
130
129
  }
131
130
  // Normalize the `safelist`
@@ -142,7 +141,8 @@ function normalizeConfig(config) {
142
141
  if (typeof config.prefix === 'function') {
143
142
  _log.default.warn('prefix-function', [
144
143
  'As of Tailwind CSS v3.0, `prefix` cannot be a function.',
145
- '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',
146
146
  ]);
147
147
  config.prefix = '';
148
148
  } else {
@@ -169,11 +169,9 @@ function normalizeConfig(config) {
169
169
  if ((ref4 = config.content) === null || ref4 === void 0 ? void 0 : (ref5 = ref4.extract) === null || ref5 === void 0 ? void 0 : ref5.DEFAULT) return config.content.extract.DEFAULT;
170
170
  if ((ref6 = config.purge) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.options) === null || ref7 === void 0 ? void 0 : ref7.extractors) return config.purge.options.extractors;
171
171
  if ((ref8 = config.content) === null || ref8 === void 0 ? void 0 : (ref9 = ref8.options) === null || ref9 === void 0 ? void 0 : ref9.extractors) return config.content.options.extractors;
172
- return {
173
- };
172
+ return {};
174
173
  })();
175
- let extractors = {
176
- };
174
+ let extractors = {};
177
175
  let defaultExtractor = (()=>{
178
176
  var ref, ref10, ref11, ref12;
179
177
  if ((ref = config.purge) === null || ref === void 0 ? void 0 : (ref10 = ref.options) === null || ref10 === void 0 ? void 0 : ref10.defaultExtractor) {
@@ -208,11 +206,9 @@ function normalizeConfig(config) {
208
206
  if ((ref13 = config.content) === null || ref13 === void 0 ? void 0 : ref13.transform) return config.content.transform;
209
207
  if ((ref14 = config.purge) === null || ref14 === void 0 ? void 0 : (ref15 = ref14.transform) === null || ref15 === void 0 ? void 0 : ref15.DEFAULT) return config.purge.transform.DEFAULT;
210
208
  if ((ref16 = config.content) === null || ref16 === void 0 ? void 0 : (ref17 = ref16.transform) === null || ref17 === void 0 ? void 0 : ref17.DEFAULT) return config.content.transform.DEFAULT;
211
- return {
212
- };
209
+ return {};
213
210
  })();
214
- let transformers = {
215
- };
211
+ let transformers = {};
216
212
  if (typeof transform === 'function') {
217
213
  transformers.DEFAULT = transform;
218
214
  }
@@ -227,11 +223,18 @@ function normalizeConfig(config) {
227
223
  for (let file of config.content.files){
228
224
  if (typeof file === 'string' && /{([^,]*?)}/g.test(file)) {
229
225
  _log.default.warn('invalid-glob-braces', [
230
- `The glob pattern ${(0, _log).dim(file)} in your config is invalid.`,
231
- ` Update it to ${(0, _log).dim(file.replace(/{([^,]*?)}/g, '$1'))} to silence this warning.`
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.`
232
228
  ]);
233
229
  break;
234
230
  }
235
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
+ }
236
239
  return config;
237
240
  }
@@ -48,11 +48,9 @@ function normalizeScreens(screens, root = true) {
48
48
  };
49
49
  });
50
50
  }
51
- return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {
52
- }), false);
51
+ return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
53
52
  }
54
- function resolveValue({ 'min-width': _minWidth , min =_minWidth , max , raw } = {
55
- }) {
53
+ function resolveValue({ 'min-width': _minWidth , min =_minWidth , max , raw } = {}) {
56
54
  return {
57
55
  min,
58
56
  max,
@@ -40,8 +40,7 @@ function resolveArbitraryValue(modifier, validate) {
40
40
  }
41
41
  return (0, _dataTypes).normalize(value);
42
42
  }
43
- function asNegativeValue(modifier, lookup = {
44
- }, validate) {
43
+ function asNegativeValue(modifier, lookup = {}, validate) {
45
44
  let positiveValue = lookup[modifier];
46
45
  if (positiveValue !== undefined) {
47
46
  return (0, _negateValue).default(positiveValue);
@@ -54,10 +53,8 @@ function asNegativeValue(modifier, lookup = {
54
53
  return (0, _negateValue).default(resolved);
55
54
  }
56
55
  }
57
- function asValue(modifier, options = {
58
- }, { validate =()=>true
59
- } = {
60
- }) {
56
+ function asValue(modifier, options = {}, { validate =()=>true
57
+ } = {}) {
61
58
  var ref;
62
59
  let value = (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
63
60
  if (value !== undefined) {
@@ -83,10 +80,7 @@ function splitAlpha(modifier) {
83
80
  modifier.slice(slashIdx + 1)
84
81
  ];
85
82
  }
86
- function asColor(modifier, options = {
87
- }, { tailwindConfig ={
88
- } } = {
89
- }) {
83
+ function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
90
84
  var ref;
91
85
  if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier]) !== undefined) {
92
86
  var ref1;
@@ -112,8 +106,7 @@ function asColor(modifier, options = {
112
106
  validate: _dataTypes.color
113
107
  });
114
108
  }
115
- function asLookupValue(modifier, options = {
116
- }) {
109
+ function asLookupValue(modifier, options = {}) {
117
110
  var ref;
118
111
  return (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
119
112
  }
@@ -53,8 +53,7 @@ const configUtils = {
53
53
  negativeScale[`-${key}`] = negativeValue;
54
54
  }
55
55
  return negativeScale;
56
- }, {
57
- });
56
+ }, {});
58
57
  },
59
58
  breakpoints (screens) {
60
59
  return Object.keys(screens).filter((key)=>typeof screens[key] === 'string'
@@ -62,8 +61,7 @@ const configUtils = {
62
61
  ...breakpoints,
63
62
  [`screen-${key}`]: screens[key]
64
63
  })
65
- , {
66
- });
64
+ , {});
67
65
  }
68
66
  };
69
67
  function value(valueToResolve, ...args) {
@@ -88,14 +86,12 @@ function collectExtends(items) {
88
86
  mergedValue
89
87
  ];
90
88
  });
91
- }, {
92
- });
89
+ }, {});
93
90
  }
94
91
  function mergeThemes(themes) {
95
92
  return {
96
93
  ...themes.reduce((merged, theme)=>(0, _defaults).defaults(merged, theme)
97
- , {
98
- }),
94
+ , {}),
99
95
  // In order to resolve n config objects, we combine all of their `extend` properties
100
96
  // into arrays instead of objects so they aren't overridden.
101
97
  extend: collectExtends(themes)
@@ -124,11 +120,9 @@ function mergeExtensions({ extend , ...theme }) {
124
120
  return mergeWith(theme, extend, (themeValue, extensions)=>{
125
121
  // The `extend` property is an array, so we need to check if it contains any functions
126
122
  if (!isFunction(themeValue) && !extensions.some(isFunction)) {
127
- return mergeWith({
128
- }, themeValue, ...extensions, mergeExtensionCustomizer);
123
+ return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
129
124
  }
130
- return (resolveThemePath, utils)=>mergeWith({
131
- }, ...[
125
+ return (resolveThemePath, utils)=>mergeWith({}, ...[
132
126
  themeValue,
133
127
  ...extensions
134
128
  ].map((e)=>value(e, resolveThemePath, utils)
@@ -162,8 +156,7 @@ function resolveFunctionKeys(object) {
162
156
  ...resolved,
163
157
  [key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
164
158
  };
165
- }, {
166
- });
159
+ }, {});
167
160
  }
168
161
  function extractPluginConfigs(configs) {
169
162
  let allConfigs = [];
@@ -185,8 +178,7 @@ function extractPluginConfigs(configs) {
185
178
  allConfigs = [
186
179
  ...allConfigs,
187
180
  ...extractPluginConfigs([
188
- (ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {
189
- }
181
+ (ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {}
190
182
  ])
191
183
  ];
192
184
  });
@@ -230,8 +222,7 @@ function resolveConfig(configs) {
230
222
  var ref, ref2;
231
223
  return (0, _normalizeConfig).normalizeConfig((0, _defaults).defaults({
232
224
  theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
233
- return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {
234
- };
225
+ return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {};
235
226
  })))),
236
227
  corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins
237
228
  )),
@@ -45,8 +45,7 @@ function resolveConfigPath(pathOrConfig) {
45
45
  const configPath = _path.default.resolve(configFile);
46
46
  _fs.default.accessSync(configPath);
47
47
  return configPath;
48
- } catch (err) {
49
- }
48
+ } catch (err) {}
50
49
  }
51
50
  return null;
52
51
  }
@@ -4,6 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.default = toColorValue;
6
6
  function toColorValue(maybeFunction) {
7
- return typeof maybeFunction === 'function' ? maybeFunction({
8
- }) : maybeFunction;
7
+ return typeof maybeFunction === 'function' ? maybeFunction({}) : maybeFunction;
9
8
  }
@@ -15,8 +15,7 @@ function transformThemeValue(themeSection) {
15
15
  'outline'
16
16
  ].includes(themeSection)) {
17
17
  return (value)=>{
18
- if (typeof value === 'function') value = value({
19
- });
18
+ if (typeof value === 'function') value = value({});
20
19
  if (Array.isArray(value)) value = value[0];
21
20
  return value;
22
21
  };
@@ -35,8 +34,7 @@ function transformThemeValue(themeSection) {
35
34
  'animation',
36
35
  ].includes(themeSection)) {
37
36
  return (value)=>{
38
- if (typeof value === 'function') value = value({
39
- });
37
+ if (typeof value === 'function') value = value({});
40
38
  if (Array.isArray(value)) value = value.join(', ');
41
39
  return value;
42
40
  };
@@ -49,15 +47,13 @@ function transformThemeValue(themeSection) {
49
47
  'objectPosition'
50
48
  ].includes(themeSection)) {
51
49
  return (value)=>{
52
- if (typeof value === 'function') value = value({
53
- });
50
+ if (typeof value === 'function') value = value({});
54
51
  if (typeof value === 'string') value = _postcss.default.list.comma(value).join(' ');
55
52
  return value;
56
53
  };
57
54
  }
58
55
  return (value)=>{
59
- if (typeof value === 'function') value = value({
60
- });
56
+ if (typeof value === 'function') value = value({});
61
57
  return value;
62
58
  };
63
59
  }
package/nesting/index.js CHANGED
@@ -1,12 +1,2 @@
1
- let nesting = require('./plugin')
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.12",
3
+ "version": "3.0.16",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -44,20 +44,18 @@
44
44
  ],
45
45
  "devDependencies": {
46
46
  "@swc/cli": "^0.1.55",
47
- "@swc/core": "^1.2.118",
48
- "@swc/jest": "^0.2.15",
47
+ "@swc/core": "^1.2.127",
48
+ "@swc/jest": "^0.2.17",
49
49
  "@swc/register": "^0.1.7",
50
50
  "autoprefixer": "^10.4.1",
51
- "cross-env": "^7.0.3",
52
- "cssnano": "^5.0.14",
53
- "esbuild": "^0.14.2",
54
- "eslint": "^8.4.1",
51
+ "cssnano": "^5.0.15",
52
+ "esbuild": "^0.14.10",
53
+ "eslint": "^8.6.0",
55
54
  "eslint-config-prettier": "^8.3.0",
56
55
  "eslint-plugin-prettier": "^4.0.0",
57
- "jest": "^27.4.5",
58
- "jest-diff": "^27.4.2",
56
+ "jest": "^27.4.7",
57
+ "jest-diff": "^27.4.6",
59
58
  "postcss": "^8.4.5",
60
- "postcss-cli": "^8.3.1",
61
59
  "prettier": "^2.5.1",
62
60
  "rimraf": "^3.0.0"
63
61
  },
@@ -74,7 +72,7 @@
74
72
  "detective": "^5.2.0",
75
73
  "didyoumean": "^1.2.2",
76
74
  "dlv": "^1.1.3",
77
- "fast-glob": "^3.2.7",
75
+ "fast-glob": "^3.2.11",
78
76
  "glob-parent": "^6.0.2",
79
77
  "is-glob": "^4.0.3",
80
78
  "normalize-path": "^3.0.0",
@@ -85,7 +83,7 @@
85
83
  "postcss-selector-parser": "^6.0.8",
86
84
  "postcss-value-parser": "^4.2.0",
87
85
  "quick-lru": "^5.1.1",
88
- "resolve": "^1.20.0"
86
+ "resolve": "^1.21.0"
89
87
  },
90
88
  "browserslist": [
91
89
  "> 1%",