tailwindcss 0.0.0-insiders.cdbaa74 → 0.0.0-insiders.ce7ac96

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 (50) hide show
  1. package/CHANGELOG.md +18 -2
  2. package/lib/cli/build/index.js +5 -1
  3. package/lib/cli/build/plugin.js +9 -9
  4. package/lib/cli/init/index.js +2 -2
  5. package/lib/cli.js +21 -11
  6. package/lib/corePlugins.js +32 -25
  7. package/lib/featureFlags.js +8 -8
  8. package/lib/index.js +2 -2
  9. package/lib/lib/collapseAdjacentRules.js +2 -2
  10. package/lib/lib/collapseDuplicateDeclarations.js +2 -2
  11. package/lib/lib/defaultExtractor.js +3 -3
  12. package/lib/lib/evaluateTailwindFunctions.js +4 -4
  13. package/lib/lib/expandApplyAtRules.js +2 -2
  14. package/lib/lib/expandTailwindAtRules.js +4 -4
  15. package/lib/lib/findAtConfigPath.js +3 -3
  16. package/lib/lib/generateRules.js +41 -22
  17. package/lib/lib/offsets.js +69 -1
  18. package/lib/lib/remap-bitfield.js +87 -0
  19. package/lib/lib/resolveDefaultsAtRules.js +4 -4
  20. package/lib/lib/setupContextUtils.js +37 -43
  21. package/lib/postcss-plugins/nesting/plugin.js +2 -2
  22. package/lib/util/cloneNodes.js +2 -2
  23. package/lib/util/color.js +4 -4
  24. package/lib/util/createUtilityPlugin.js +2 -2
  25. package/lib/util/dataTypes.js +10 -1
  26. package/lib/util/defaults.js +4 -4
  27. package/lib/util/escapeClassName.js +3 -3
  28. package/lib/util/formatVariantSelector.js +14 -6
  29. package/lib/util/getAllConfigs.js +2 -2
  30. package/lib/util/normalizeConfig.js +22 -22
  31. package/lib/util/pluginUtils.js +24 -17
  32. package/lib/util/resolveConfig.js +7 -7
  33. package/package.json +12 -12
  34. package/peers/index.js +17 -3
  35. package/resolveConfig.d.ts +11 -2
  36. package/src/cli/build/index.js +6 -2
  37. package/src/cli/build/plugin.js +2 -2
  38. package/src/cli.js +24 -13
  39. package/src/corePlugins.js +10 -1
  40. package/src/lib/defaultExtractor.js +1 -1
  41. package/src/lib/generateRules.js +25 -3
  42. package/src/lib/offsets.js +82 -1
  43. package/src/lib/remap-bitfield.js +82 -0
  44. package/src/lib/setupContextUtils.js +4 -11
  45. package/src/util/dataTypes.js +15 -4
  46. package/src/util/formatVariantSelector.js +12 -1
  47. package/src/util/pluginUtils.js +10 -2
  48. package/stubs/defaultConfig.stub.js +146 -145
  49. package/types/config.d.ts +2 -1
  50. package/types/generated/default-theme.d.ts +77 -77
package/CHANGELOG.md CHANGED
@@ -7,14 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - Add `line-height` modifier support to `font-size` utilities ([#9875](https://github.com/tailwindlabs/tailwindcss/pull/9875))
13
+ - Support using variables as arbitrary values without `var(...)` ([#9880](https://github.com/tailwindlabs/tailwindcss/pull/9880), [#9962](https://github.com/tailwindlabs/tailwindcss/pull/9962))
14
+ - Add `--watch=always` option to prevent exit when stdin closes ([#9966](https://github.com/tailwindlabs/tailwindcss/pull/9966))
15
+ - Add standalone CLI build for 64-bit Windows on ARM (`node16-win-arm64`) ([#10001](https://github.com/tailwindlabs/tailwindcss/pull/10001))
16
+
10
17
  ### Fixed
11
18
 
12
19
  - Cleanup unused `variantOrder` ([#9829](https://github.com/tailwindlabs/tailwindcss/pull/9829))
13
20
  - Fix `foo-[abc]/[def]` not being handled correctly ([#9866](https://github.com/tailwindlabs/tailwindcss/pull/9866))
21
+ - Add container queries plugin to standalone CLI ([#9865](https://github.com/tailwindlabs/tailwindcss/pull/9865))
22
+ - Support renaming of output files by `PostCSS` plugin. ([#9944](https://github.com/tailwindlabs/tailwindcss/pull/9944))
23
+ - Improve return value of `resolveConfig`, unwrap `ResolvableTo` ([#9972](https://github.com/tailwindlabs/tailwindcss/pull/9972))
24
+ - Clip unbalanced brackets in arbitrary values ([#9973](https://github.com/tailwindlabs/tailwindcss/pull/9973))
25
+ - Don’t reorder webkit scrollbar pseudo elements ([#9991](https://github.com/tailwindlabs/tailwindcss/pull/9991))
26
+ - Deterministic sorting of arbitrary variants ([#10016](https://github.com/tailwindlabs/tailwindcss/pull/10016))
27
+ - Add `data` key to theme types ([#10023](https://github.com/tailwindlabs/tailwindcss/pull/10023))
28
+ - Prevent invalid arbitrary variant selectors from failing the build ([#10059](https://github.com/tailwindlabs/tailwindcss/pull/10059))
29
+ - Properly handle subtraction followed by a variable ([#10074](https://github.com/tailwindlabs/tailwindcss/pull/10074))
14
30
 
15
- ### Added
31
+ ### Changed
16
32
 
17
- - Add container queries plugin to standalone CLI ([#9865](https://github.com/tailwindlabs/tailwindcss/pull/9865))
33
+ - Alphabetize `theme` keys in default config ([#9953](https://github.com/tailwindlabs/tailwindcss/pull/9953))
18
34
 
19
35
  ## [3.2.4] - 2022-11-11
20
36
 
@@ -35,7 +35,11 @@ async function build(args, configs) {
35
35
  let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null)(_path.default.resolve(`./${configs.tailwind}`));
36
36
  let processor = await (0, _pluginJs.createProcessor)(args, configPath);
37
37
  if (shouldWatch) {
38
- /* Abort the watcher if stdin is closed to avoid zombie processes */ process.stdin.on("end", ()=>process.exit(0));
38
+ // Abort the watcher if stdin is closed to avoid zombie processes
39
+ // You can disable this behavior with --watch=always
40
+ if (args["--watch"] !== "always") {
41
+ process.stdin.on("end", ()=>process.exit(0));
42
+ }
39
43
  process.stdin.resume();
40
44
  await processor.watch();
41
45
  } else {
@@ -113,8 +113,8 @@ let state = {
113
113
  contextDependencies: new Set(),
114
114
  /** @type {import('../../lib/content.js').ContentPath[]} */ contentPaths: [],
115
115
  refreshContentPaths () {
116
- var ref;
117
- this.contentPaths = (0, _contentJs.parseCandidateFiles)(this.context, (ref = this.context) === null || ref === void 0 ? void 0 : ref.tailwindConfig);
116
+ var _this_context;
117
+ this.contentPaths = (0, _contentJs.parseCandidateFiles)(this.context, (_this_context = this.context) === null || _this_context === void 0 ? void 0 : _this_context.tailwindConfig);
118
118
  },
119
119
  get config () {
120
120
  return this.context.tailwindConfig;
@@ -184,8 +184,8 @@ let state = {
184
184
  return this.context;
185
185
  }
186
186
  _shared.env.DEBUG && console.time("Searching for config");
187
- var ref;
188
- let configPath = (ref = (0, _findAtConfigPathJs.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : cliConfigPath;
187
+ var _findAtConfigPath;
188
+ let configPath = (_findAtConfigPath = (0, _findAtConfigPathJs.findAtConfigPath)(root, result)) !== null && _findAtConfigPath !== void 0 ? _findAtConfigPath : cliConfigPath;
189
189
  _shared.env.DEBUG && console.timeEnd("Searching for config");
190
190
  _shared.env.DEBUG && console.time("Loading config");
191
191
  let config = this.loadConfig(configPath, content);
@@ -213,7 +213,7 @@ let state = {
213
213
  }
214
214
  };
215
215
  async function createProcessor(args, cliConfigPath) {
216
- var ref;
216
+ var _args_content;
217
217
  let postcss = (0, _deps.loadPostcss)();
218
218
  let input = args["--input"];
219
219
  let output = args["--output"];
@@ -229,8 +229,8 @@ async function createProcessor(args, cliConfigPath) {
229
229
  args["--content"] = args["--purge"];
230
230
  }
231
231
  }
232
- var ref1;
233
- let content = (ref1 = (ref = args["--content"]) === null || ref === void 0 ? void 0 : ref.split(/(?<!{[^}]+),/)) !== null && ref1 !== void 0 ? ref1 : [];
232
+ var _args_content_split;
233
+ let content = (_args_content_split = (_args_content = args["--content"]) === null || _args_content === void 0 ? void 0 : _args_content.split(/(?<!{[^}]+),/)) !== null && _args_content_split !== void 0 ? _args_content_split : [];
234
234
  let tailwindPlugin = ()=>{
235
235
  return {
236
236
  postcssPlugin: "tailwindcss",
@@ -304,8 +304,8 @@ async function createProcessor(args, cliConfigPath) {
304
304
  return;
305
305
  }
306
306
  return Promise.all([
307
- (0, _utils.outputFile)(output, result.css),
308
- result.map && (0, _utils.outputFile)(output + ".map", result.map.toString())
307
+ (0, _utils.outputFile)(result.opts.to, result.css),
308
+ result.map && (0, _utils.outputFile)(result.opts.to + ".map", result.map.toString())
309
309
  ]);
310
310
  }).then(()=>{
311
311
  let end = process.hrtime.bigint();
@@ -16,8 +16,8 @@ function _interopRequireDefault(obj) {
16
16
  }
17
17
  function init(args, configs) {
18
18
  let messages = [];
19
- var ref;
20
- let tailwindConfigLocation = _path.default.resolve((ref = args["_"][1]) !== null && ref !== void 0 ? ref : `./${configs.tailwind}`);
19
+ var _args___;
20
+ let tailwindConfigLocation = _path.default.resolve((_args___ = args["_"][1]) !== null && _args___ !== void 0 ? _args___ : `./${configs.tailwind}`);
21
21
  if (_fs.default.existsSync(tailwindConfigLocation)) {
22
22
  messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
23
23
  } else {
package/lib/cli.js CHANGED
@@ -72,7 +72,7 @@ let commands = {
72
72
  description: "Output file"
73
73
  },
74
74
  "--watch": {
75
- type: Boolean,
75
+ type: oneOf(String, Boolean),
76
76
  description: "Watch for changes and rebuild as needed"
77
77
  },
78
78
  "--poll": {
@@ -159,8 +159,8 @@ let args = (()=>{
159
159
  ...flags,
160
160
  ...sharedFlags
161
161
  }).filter(([_key, value])=>{
162
- var ref;
163
- return !(value === null || value === void 0 ? void 0 : (ref = value.type) === null || ref === void 0 ? void 0 : ref.manualParsing);
162
+ var _value_type;
163
+ return !(value === null || value === void 0 ? void 0 : (_value_type = value.type) === null || _value_type === void 0 ? void 0 : _value_type.manualParsing);
164
164
  }).map(([key, value])=>[
165
165
  key,
166
166
  typeof value === "object" ? value.type : value
@@ -171,8 +171,8 @@ let args = (()=>{
171
171
  for(let i = result["_"].length - 1; i >= 0; --i){
172
172
  let flag = result["_"][i];
173
173
  if (!flag.startsWith("-")) continue;
174
- let flagName = flag;
175
- let handler = flags[flag];
174
+ let [flagName, flagValue] = flag.split("=");
175
+ let handler = flags[flagName];
176
176
  // Resolve flagName & handler
177
177
  while(typeof handler === "string"){
178
178
  flagName = handler;
@@ -181,14 +181,24 @@ let args = (()=>{
181
181
  if (!handler) continue;
182
182
  let args = [];
183
183
  let offset = i + 1;
184
- // Parse args for current flag
185
- while(result["_"][offset] && !result["_"][offset].startsWith("-")){
186
- args.push(result["_"][offset++]);
184
+ // --flag value syntax was used so we need to pull `value` from `args`
185
+ if (flagValue === undefined) {
186
+ // Parse args for current flag
187
+ while(result["_"][offset] && !result["_"][offset].startsWith("-")){
188
+ args.push(result["_"][offset++]);
189
+ }
190
+ // Cleanup manually parsed flags + args
191
+ result["_"].splice(i, 1 + args.length);
192
+ // No args were provided, use default value defined in handler
193
+ // One arg was provided, use that directly
194
+ // Multiple args were provided so pass them all in an array
195
+ flagValue = args.length === 0 ? undefined : args.length === 1 ? args[0] : args;
196
+ } else {
197
+ // Remove the whole flag from the args array
198
+ result["_"].splice(i, 1);
187
199
  }
188
- // Cleanup manually parsed flags + args
189
- result["_"].splice(i, 1 + args.length);
190
200
  // Set the resolved value in the `result` object
191
- result[flagName] = handler.type(args.length === 0 ? undefined : args.length === 1 ? args[0] : args, flagName);
201
+ result[flagName] = handler.type(flagValue, flagName);
192
202
  }
193
203
  // Ensure that the `command` is always the first argument in the `args`.
194
204
  // This is important so that we don't have to check if a default command
@@ -277,15 +277,15 @@ let variantPlugins = {
277
277
  addVariant("print", "@media print");
278
278
  },
279
279
  screenVariants: ({ theme , addVariant , matchVariant })=>{
280
- var ref;
281
- let rawScreens = (ref = theme("screens")) !== null && ref !== void 0 ? ref : {};
280
+ var _theme;
281
+ let rawScreens = (_theme = theme("screens")) !== null && _theme !== void 0 ? _theme : {};
282
282
  let areSimpleScreens = Object.values(rawScreens).every((v)=>typeof v === "string");
283
283
  let screens = (0, _normalizeScreens.normalizeScreens)(theme("screens"));
284
284
  /** @type {Set<string>} */ let unitCache = new Set([]);
285
285
  /** @param {string} value */ function units(value) {
286
- var ref;
287
- var ref1;
288
- return (ref1 = (ref = value.match(/(\D+)$/)) === null || ref === void 0 ? void 0 : ref[1]) !== null && ref1 !== void 0 ? ref1 : "(none)";
286
+ var _value_match;
287
+ var _value_match_;
288
+ return (_value_match_ = (_value_match = value.match(/(\D+)$/)) === null || _value_match === void 0 ? void 0 : _value_match[1]) !== null && _value_match_ !== void 0 ? _value_match_ : "(none)";
289
289
  }
290
290
  /** @param {string} value */ function recordUnits(value) {
291
291
  if (value !== undefined) {
@@ -384,7 +384,7 @@ let variantPlugins = {
384
384
  });
385
385
  },
386
386
  supportsVariants: ({ matchVariant , theme })=>{
387
- var ref;
387
+ var _theme;
388
388
  matchVariant("supports", (value = "")=>{
389
389
  let check = (0, _dataTypes.normalize)(value);
390
390
  let isRaw = /^\w*\s*\(/.test(check);
@@ -402,35 +402,35 @@ let variantPlugins = {
402
402
  }
403
403
  return `@supports ${check}`;
404
404
  }, {
405
- values: (ref = theme("supports")) !== null && ref !== void 0 ? ref : {}
405
+ values: (_theme = theme("supports")) !== null && _theme !== void 0 ? _theme : {}
406
406
  });
407
407
  },
408
408
  ariaVariants: ({ matchVariant , theme })=>{
409
- var ref;
409
+ var _theme;
410
410
  matchVariant("aria", (value)=>`&[aria-${(0, _dataTypes.normalize)(value)}]`, {
411
- values: (ref = theme("aria")) !== null && ref !== void 0 ? ref : {}
411
+ values: (_theme = theme("aria")) !== null && _theme !== void 0 ? _theme : {}
412
412
  });
413
- var ref1;
413
+ var _theme1;
414
414
  matchVariant("group-aria", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[aria-${(0, _dataTypes.normalize)(value)}] &`, {
415
- values: (ref1 = theme("aria")) !== null && ref1 !== void 0 ? ref1 : {}
415
+ values: (_theme1 = theme("aria")) !== null && _theme1 !== void 0 ? _theme1 : {}
416
416
  });
417
- var ref2;
417
+ var _theme2;
418
418
  matchVariant("peer-aria", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[aria-${(0, _dataTypes.normalize)(value)}] ~ &`, {
419
- values: (ref2 = theme("aria")) !== null && ref2 !== void 0 ? ref2 : {}
419
+ values: (_theme2 = theme("aria")) !== null && _theme2 !== void 0 ? _theme2 : {}
420
420
  });
421
421
  },
422
422
  dataVariants: ({ matchVariant , theme })=>{
423
- var ref;
423
+ var _theme;
424
424
  matchVariant("data", (value)=>`&[data-${(0, _dataTypes.normalize)(value)}]`, {
425
- values: (ref = theme("data")) !== null && ref !== void 0 ? ref : {}
425
+ values: (_theme = theme("data")) !== null && _theme !== void 0 ? _theme : {}
426
426
  });
427
- var ref1;
427
+ var _theme1;
428
428
  matchVariant("group-data", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[data-${(0, _dataTypes.normalize)(value)}] &`, {
429
- values: (ref1 = theme("data")) !== null && ref1 !== void 0 ? ref1 : {}
429
+ values: (_theme1 = theme("data")) !== null && _theme1 !== void 0 ? _theme1 : {}
430
430
  });
431
- var ref2;
431
+ var _theme2;
432
432
  matchVariant("peer-data", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[data-${(0, _dataTypes.normalize)(value)}] ~ &`, {
433
- values: (ref2 = theme("data")) !== null && ref2 !== void 0 ? ref2 : {}
433
+ values: (_theme2 = theme("data")) !== null && _theme2 !== void 0 ? _theme2 : {}
434
434
  });
435
435
  },
436
436
  orientationVariants: ({ addVariant })=>{
@@ -1223,8 +1223,8 @@ let corePlugins = {
1223
1223
  },
1224
1224
  animation: ({ matchUtilities , theme , config })=>{
1225
1225
  let prefixName = (name)=>`${config("prefix")}${(0, _escapeClassName.default)(name)}`;
1226
- var ref;
1227
- let keyframes = Object.fromEntries(Object.entries((ref = theme("keyframes")) !== null && ref !== void 0 ? ref : {}).map(([key, value])=>{
1226
+ var _theme;
1227
+ let keyframes = Object.fromEntries(Object.entries((_theme = theme("keyframes")) !== null && _theme !== void 0 ? _theme : {}).map(([key, value])=>{
1228
1228
  return [
1229
1229
  key,
1230
1230
  {
@@ -2872,10 +2872,16 @@ let corePlugins = {
2872
2872
  },
2873
2873
  fontSize: ({ matchUtilities , theme })=>{
2874
2874
  matchUtilities({
2875
- text: (value)=>{
2875
+ text: (value, { modifier })=>{
2876
2876
  let [fontSize, options] = Array.isArray(value) ? value : [
2877
2877
  value
2878
2878
  ];
2879
+ if (modifier) {
2880
+ return {
2881
+ "font-size": fontSize,
2882
+ "line-height": modifier
2883
+ };
2884
+ }
2879
2885
  let { lineHeight , letterSpacing , fontWeight } = (0, _isPlainObject.default)(options) ? options : {
2880
2886
  lineHeight: options
2881
2887
  };
@@ -2894,6 +2900,7 @@ let corePlugins = {
2894
2900
  }
2895
2901
  }, {
2896
2902
  values: theme("fontSize"),
2903
+ modifiers: theme("lineHeight"),
2897
2904
  type: [
2898
2905
  "absolute-size",
2899
2906
  "relative-size",
@@ -3441,15 +3448,15 @@ let corePlugins = {
3441
3448
  },
3442
3449
  ringWidth: ({ matchUtilities , addDefaults , addUtilities , theme , config })=>{
3443
3450
  let ringColorDefault = (()=>{
3444
- var ref, ref1;
3451
+ var _theme, _theme1;
3445
3452
  if ((0, _featureFlags.flagEnabled)(config(), "respectDefaultRingColorOpacity")) {
3446
3453
  return theme("ringColor.DEFAULT");
3447
3454
  }
3448
3455
  let ringOpacityDefault = theme("ringOpacity.DEFAULT", "0.5");
3449
- if (!((ref = theme("ringColor")) === null || ref === void 0 ? void 0 : ref.DEFAULT)) {
3456
+ if (!((_theme = theme("ringColor")) === null || _theme === void 0 ? void 0 : _theme.DEFAULT)) {
3450
3457
  return `rgb(147 197 253 / ${ringOpacityDefault})`;
3451
3458
  }
3452
- return (0, _withAlphaVariable.withAlphaValue)((ref1 = theme("ringColor")) === null || ref1 === void 0 ? void 0 : ref1.DEFAULT, ringOpacityDefault, `rgb(147 197 253 / ${ringOpacityDefault})`);
3459
+ return (0, _withAlphaVariable.withAlphaValue)((_theme1 = theme("ringColor")) === null || _theme1 === void 0 ? void 0 : _theme1.DEFAULT, ringOpacityDefault, `rgb(147 197 253 / ${ringOpacityDefault})`);
3453
3460
  })();
3454
3461
  addDefaults("ring-width", {
3455
3462
  "--tw-ring-inset": " ",
@@ -38,14 +38,14 @@ let featureFlags = {
38
38
  };
39
39
  function flagEnabled(config, flag) {
40
40
  if (featureFlags.future.includes(flag)) {
41
- var ref;
42
- var ref1, ref2;
43
- return config.future === "all" || ((ref2 = (ref1 = config === null || config === void 0 ? void 0 : (ref = config.future) === null || ref === void 0 ? void 0 : ref[flag]) !== null && ref1 !== void 0 ? ref1 : defaults[flag]) !== null && ref2 !== void 0 ? ref2 : false);
41
+ var _config_future;
42
+ var _config_future_flag, _ref;
43
+ return config.future === "all" || ((_ref = (_config_future_flag = config === null || config === void 0 ? void 0 : (_config_future = config.future) === null || _config_future === void 0 ? void 0 : _config_future[flag]) !== null && _config_future_flag !== void 0 ? _config_future_flag : defaults[flag]) !== null && _ref !== void 0 ? _ref : false);
44
44
  }
45
45
  if (featureFlags.experimental.includes(flag)) {
46
- var ref3;
47
- var ref4, ref5;
48
- return config.experimental === "all" || ((ref5 = (ref4 = config === null || config === void 0 ? void 0 : (ref3 = config.experimental) === null || ref3 === void 0 ? void 0 : ref3[flag]) !== null && ref4 !== void 0 ? ref4 : defaults[flag]) !== null && ref5 !== void 0 ? ref5 : false);
46
+ var _config_experimental;
47
+ var _config_experimental_flag, _ref1;
48
+ return config.experimental === "all" || ((_ref1 = (_config_experimental_flag = config === null || config === void 0 ? void 0 : (_config_experimental = config.experimental) === null || _config_experimental === void 0 ? void 0 : _config_experimental[flag]) !== null && _config_experimental_flag !== void 0 ? _config_experimental_flag : defaults[flag]) !== null && _ref1 !== void 0 ? _ref1 : false);
49
49
  }
50
50
  return false;
51
51
  }
@@ -53,8 +53,8 @@ function experimentalFlagsEnabled(config) {
53
53
  if (config.experimental === "all") {
54
54
  return featureFlags.experimental;
55
55
  }
56
- var ref;
57
- return Object.keys((ref = config === null || config === void 0 ? void 0 : config.experimental) !== null && ref !== void 0 ? ref : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]);
56
+ var _config_experimental;
57
+ return Object.keys((_config_experimental = config === null || config === void 0 ? void 0 : config.experimental) !== null && _config_experimental !== void 0 ? _config_experimental : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]);
58
58
  }
59
59
  function issueFlagNotices(config) {
60
60
  if (process.env.JEST_WORKER_ID !== undefined) {
package/lib/index.js CHANGED
@@ -21,10 +21,10 @@ module.exports = function tailwindcss(configOrPath) {
21
21
  return root;
22
22
  },
23
23
  function(root, result) {
24
- var ref;
24
+ var _findAtConfigPath1;
25
25
  // Use the path for the `@config` directive if it exists, otherwise use the
26
26
  // path for the file being processed
27
- configOrPath = (ref = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : configOrPath;
27
+ configOrPath = (_findAtConfigPath1 = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && _findAtConfigPath1 !== void 0 ? _findAtConfigPath1 : configOrPath;
28
28
  let context = (0, _setupTrackingContext.default)(configOrPath);
29
29
  if (root.type === "document") {
30
30
  let roots = root.nodes.filter((node)=>node.type === "root");
@@ -29,10 +29,10 @@ function collapseAdjacentRules() {
29
29
  return;
30
30
  }
31
31
  let properties = comparisonMap[node.type];
32
- var _property, _property1;
32
+ var _node_property, _currentRule_property;
33
33
  if (node.type === "atrule" && node.name === "font-face") {
34
34
  currentRule = node;
35
- } else if (properties.every((property)=>((_property = node[property]) !== null && _property !== void 0 ? _property : "").replace(/\s+/g, " ") === ((_property1 = currentRule[property]) !== null && _property1 !== void 0 ? _property1 : "").replace(/\s+/g, " "))) {
35
+ } else if (properties.every((property)=>((_node_property = node[property]) !== null && _node_property !== void 0 ? _node_property : "").replace(/\s+/g, " ") === ((_currentRule_property = currentRule[property]) !== null && _currentRule_property !== void 0 ? _currentRule_property : "").replace(/\s+/g, " "))) {
36
36
  // An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
37
37
  if (node.nodes) {
38
38
  currentRule.append(node.nodes);
@@ -76,8 +76,8 @@ let UNITLESS_NUMBER = Symbol("unitless-number");
76
76
  function resolveUnit(input) {
77
77
  let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
78
78
  if (result) {
79
- var ref;
80
- return (ref = result[1]) !== null && ref !== void 0 ? ref : UNITLESS_NUMBER;
79
+ var _result_;
80
+ return (_result_ = result[1]) !== null && _result_ !== void 0 ? _result_ : UNITLESS_NUMBER;
81
81
  }
82
82
  return null;
83
83
  }
@@ -54,10 +54,10 @@ function defaultExtractor(context) {
54
54
  */ return (content)=>{
55
55
  /** @type {(string|string)[]} */ let results = [];
56
56
  for (let pattern of patterns){
57
- var ref;
57
+ var _content_match;
58
58
  results = [
59
59
  ...results,
60
- ...(ref = content.match(pattern)) !== null && ref !== void 0 ? ref : []
60
+ ...(_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []
61
61
  ];
62
62
  }
63
63
  return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
@@ -216,7 +216,7 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
216
216
  // This means that there was an extra closing `]`
217
217
  // We'll clip to just before it
218
218
  if (depth < 0) {
219
- return input.substring(0, match.index);
219
+ return input.substring(0, match.index - 1);
220
220
  }
221
221
  // We've finished balancing the brackets but there still may be characters that can be included
222
222
  // For example in the class `text-[#336699]/[.35]`
@@ -177,8 +177,8 @@ let nodeTypePropertyMap = {
177
177
  alpha
178
178
  });
179
179
  });
180
- var ref;
181
- return (ref = results.find((result)=>result.isValid)) !== null && ref !== void 0 ? ref : results[0];
180
+ var _results_find;
181
+ return (_results_find = results.find((result)=>result.isValid)) !== null && _results_find !== void 0 ? _results_find : results[0];
182
182
  }
183
183
  function _default(context) {
184
184
  let config = context.tailwindConfig;
@@ -186,9 +186,9 @@ function _default(context) {
186
186
  theme: (node, path, ...defaultValue)=>{
187
187
  let { isValid , value , error , alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
188
188
  if (!isValid) {
189
- var ref;
189
+ var _parentNode_raws_tailwind;
190
190
  let parentNode = node.parent;
191
- let candidate = (ref = parentNode === null || parentNode === void 0 ? void 0 : parentNode.raws.tailwind) === null || ref === void 0 ? void 0 : ref.candidate;
191
+ let candidate = (_parentNode_raws_tailwind = parentNode === null || parentNode === void 0 ? void 0 : parentNode.raws.tailwind) === null || _parentNode_raws_tailwind === void 0 ? void 0 : _parentNode_raws_tailwind.candidate;
192
192
  if (parentNode && candidate !== undefined) {
193
193
  // Remove this utility from any caches
194
194
  context.markInvalidUtilityNode(parentNode);
@@ -139,8 +139,8 @@ function* pathToRoot(node) {
139
139
  root.walkRules((rule)=>{
140
140
  // Ignore rules generated by Tailwind
141
141
  for (let node of pathToRoot(rule)){
142
- var ref;
143
- if (((ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.layer) !== undefined) {
142
+ var _node_raws_tailwind;
143
+ if (((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.layer) !== undefined) {
144
144
  return;
145
145
  }
146
146
  }
@@ -199,8 +199,8 @@ function expandTailwindAtRules(context) {
199
199
  }
200
200
  // We do post-filtering to not alter the emitted order of the variants
201
201
  const variantNodes = Array.from(screenNodes).filter((node)=>{
202
- var ref;
203
- const parentLayer = (ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.parentLayer;
202
+ var _node_raws_tailwind;
203
+ const parentLayer = (_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer;
204
204
  if (parentLayer === "components") {
205
205
  return layerNodes.components !== null;
206
206
  }
@@ -221,8 +221,8 @@ function expandTailwindAtRules(context) {
221
221
  }
222
222
  // If we've got a utility layer and no utilities are generated there's likely something wrong
223
223
  const hasUtilityVariants = variantNodes.some((node)=>{
224
- var ref;
225
- return ((ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.parentLayer) === "utilities";
224
+ var _node_raws_tailwind;
225
+ return ((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer) === "utilities";
226
226
  });
227
227
  if (layerNodes.utilities && utilityNodes.size === 0 && !hasUtilityVariants) {
228
228
  _log.default.warn("content-problems", [
@@ -17,9 +17,9 @@ function findAtConfigPath(root, result) {
17
17
  let configPath = null;
18
18
  let relativeTo = null;
19
19
  root.walkAtRules("config", (rule)=>{
20
- var ref;
21
- var _file, ref1;
22
- relativeTo = (ref1 = (_file = (ref = rule.source) === null || ref === void 0 ? void 0 : ref.input.file) !== null && _file !== void 0 ? _file : result.opts.from) !== null && ref1 !== void 0 ? ref1 : null;
20
+ var _rule_source;
21
+ var _rule_source_input_file, _ref;
22
+ relativeTo = (_ref = (_rule_source_input_file = (_rule_source = rule.source) === null || _rule_source === void 0 ? void 0 : _rule_source.input.file) !== null && _rule_source_input_file !== void 0 ? _rule_source_input_file : result.opts.from) !== null && _ref !== void 0 ? _ref : null;
23
23
  if (relativeTo === null) {
24
24
  throw rule.error("The `@config` directive cannot be used without setting `from` in your PostCSS config.");
25
25
  }
@@ -370,12 +370,12 @@ function applyVariant(variant, matches, context) {
370
370
  ...clone.nodes[0].raws.tailwind,
371
371
  parentLayer: meta.layer
372
372
  };
373
- var _collectedFormats;
373
+ var _meta_collectedFormats;
374
374
  let withOffset = [
375
375
  {
376
376
  ...meta,
377
377
  sort: context.offsets.applyVariantOffset(meta.sort, variantSort, Object.assign(args, context.variantOptions.get(variant))),
378
- collectedFormats: ((_collectedFormats = meta.collectedFormats) !== null && _collectedFormats !== void 0 ? _collectedFormats : []).concat(collectedFormats),
378
+ collectedFormats: ((_meta_collectedFormats = meta.collectedFormats) !== null && _meta_collectedFormats !== void 0 ? _meta_collectedFormats : []).concat(collectedFormats),
379
379
  isArbitraryVariant: isArbitraryValue(variant)
380
380
  },
381
381
  clone.nodes[0]
@@ -434,7 +434,7 @@ function isValidPropName(name) {
434
434
  function isParsableNode(node) {
435
435
  let isParsable = true;
436
436
  node.walkDecls((decl)=>{
437
- if (!isParsableCssValue(decl.name, decl.value)) {
437
+ if (!isParsableCssValue(decl.prop, decl.value)) {
438
438
  isParsable = false;
439
439
  return false;
440
440
  }
@@ -456,8 +456,8 @@ function isParsableCssValue(property, value) {
456
456
  }
457
457
  }
458
458
  function extractArbitraryProperty(classCandidate, context) {
459
- var ref;
460
- let [, property, value] = (ref = classCandidate.match(/^\[([a-zA-Z0-9-_]+):(\S+)\]$/)) !== null && ref !== void 0 ? ref : [];
459
+ var _classCandidate_match;
460
+ let [, property, value] = (_classCandidate_match = classCandidate.match(/^\[([a-zA-Z0-9-_]+):(\S+)\]$/)) !== null && _classCandidate_match !== void 0 ? _classCandidate_match : [];
461
461
  if (value === undefined) {
462
462
  return null;
463
463
  }
@@ -535,12 +535,12 @@ function splitWithSeparator(input, separator) {
535
535
  }
536
536
  function* recordCandidates(matches, classCandidate) {
537
537
  for (const match of matches){
538
- var ref;
539
- var ref1;
538
+ var _match__options;
539
+ var _match__options_preserveSource;
540
540
  match[1].raws.tailwind = {
541
541
  ...match[1].raws.tailwind,
542
542
  classCandidate,
543
- preserveSource: (ref1 = (ref = match[0].options) === null || ref === void 0 ? void 0 : ref.preserveSource) !== null && ref1 !== void 0 ? ref1 : false
543
+ preserveSource: (_match__options_preserveSource = (_match__options = match[0].options) === null || _match__options === void 0 ? void 0 : _match__options.preserveSource) !== null && _match__options_preserveSource !== void 0 ? _match__options_preserveSource : false
544
544
  };
545
545
  yield match;
546
546
  }
@@ -614,9 +614,9 @@ function* resolveMatches(candidate, context, original = candidate) {
614
614
  }
615
615
  }
616
616
  if (matchesPerPlugin.length > 0) {
617
- var ref;
618
- var ref1, _options;
619
- let matchingTypes = Array.from((0, _pluginUtils.getMatchingTypes)((ref1 = (ref = sort.options) === null || ref === void 0 ? void 0 : ref.types) !== null && ref1 !== void 0 ? ref1 : [], modifier, (_options = sort.options) !== null && _options !== void 0 ? _options : {}, context.tailwindConfig)).map(([_, type])=>type);
617
+ var _sort_options;
618
+ var _sort_options_types, _sort_options1;
619
+ let matchingTypes = Array.from((0, _pluginUtils.getMatchingTypes)((_sort_options_types = (_sort_options = sort.options) === null || _sort_options === void 0 ? void 0 : _sort_options.types) !== null && _sort_options_types !== void 0 ? _sort_options_types : [], modifier, (_sort_options1 = sort.options) !== null && _sort_options1 !== void 0 ? _sort_options1 : {}, context.tailwindConfig)).map(([_, type])=>type);
620
620
  if (matchingTypes.length > 0) {
621
621
  typesByMatches.set(matchesPerPlugin, matchingTypes);
622
622
  }
@@ -656,18 +656,18 @@ function* resolveMatches(candidate, context, original = candidate) {
656
656
  });
657
657
  });
658
658
  }
659
- var ref2;
659
+ var _findFallback;
660
660
  // Try to find a fallback plugin, because we already know that multiple plugins matched for
661
661
  // the given arbitrary value.
662
- let fallback = (ref2 = findFallback(withoutAny)) !== null && ref2 !== void 0 ? ref2 : findFallback(withAny);
662
+ let fallback = (_findFallback = findFallback(withoutAny)) !== null && _findFallback !== void 0 ? _findFallback : findFallback(withAny);
663
663
  if (fallback) {
664
664
  matches = [
665
665
  fallback
666
666
  ];
667
667
  } else {
668
- var ref3;
668
+ var _typesByMatches_get;
669
669
  let typesPerPlugin = matches.map((match)=>new Set([
670
- ...(ref3 = typesByMatches.get(match)) !== null && ref3 !== void 0 ? ref3 : []
670
+ ...(_typesByMatches_get = typesByMatches.get(match)) !== null && _typesByMatches_get !== void 0 ? _typesByMatches_get : []
671
671
  ]));
672
672
  // Remove duplicates, so that we can detect proper unique types for each plugin.
673
673
  for (let pluginTypes of typesPerPlugin){
@@ -713,6 +713,7 @@ function* resolveMatches(candidate, context, original = candidate) {
713
713
  matches = applyVariant(variant, matches, context);
714
714
  }
715
715
  for (let match of matches){
716
+ let isValid = true;
716
717
  match[1].raws.tailwind = {
717
718
  ...match[1].raws.tailwind,
718
719
  candidate
@@ -726,19 +727,37 @@ function* resolveMatches(candidate, context, original = candidate) {
726
727
  ]
727
728
  });
728
729
  container.walkRules((rule)=>{
729
- var ref;
730
+ var _context_tailwindConfig;
730
731
  if (inKeyframes(rule)) return;
731
- var ref1;
732
- rule.selector = (0, _formatVariantSelector.finalizeSelector)(finalFormat, {
732
+ var _context_tailwindConfig_separator;
733
+ let selectorOptions = {
733
734
  selector: rule.selector,
734
735
  candidate: original,
735
- base: candidate.split(new RegExp(`\\${(ref1 = context === null || context === void 0 ? void 0 : (ref = context.tailwindConfig) === null || ref === void 0 ? void 0 : ref.separator) !== null && ref1 !== void 0 ? ref1 : ":"}(?![^[]*\\])`)).pop(),
736
+ base: candidate.split(new RegExp(`\\${(_context_tailwindConfig_separator = context === null || context === void 0 ? void 0 : (_context_tailwindConfig = context.tailwindConfig) === null || _context_tailwindConfig === void 0 ? void 0 : _context_tailwindConfig.separator) !== null && _context_tailwindConfig_separator !== void 0 ? _context_tailwindConfig_separator : ":"}(?![^[]*\\])`)).pop(),
736
737
  isArbitraryVariant: match[0].isArbitraryVariant,
737
738
  context
738
- });
739
+ };
740
+ try {
741
+ rule.selector = (0, _formatVariantSelector.finalizeSelector)(finalFormat, selectorOptions);
742
+ } catch {
743
+ // The selector we produced is invalid
744
+ // This could be because:
745
+ // - A bug exists
746
+ // - A plugin introduced an invalid variant selector (ex: `addVariant('foo', '&;foo')`)
747
+ // - The user used an invalid arbitrary variant (ex: `[&;foo]:underline`)
748
+ // Either way the build will fail because of this
749
+ // We would rather that the build pass "silently" given that this could
750
+ // happen because of picking up invalid things when scanning content
751
+ // So we'll throw out the candidate instead
752
+ isValid = false;
753
+ return false;
754
+ }
739
755
  });
740
756
  match[1] = container.nodes[0];
741
757
  }
758
+ if (!isValid) {
759
+ continue;
760
+ }
742
761
  yield match;
743
762
  }
744
763
  }
@@ -787,8 +806,8 @@ function generateRules(candidates, context) {
787
806
  continue;
788
807
  }
789
808
  context.classCache.set(candidate, matches);
790
- var ref;
791
- let rules = (ref = context.candidateRuleCache.get(candidate)) !== null && ref !== void 0 ? ref : new Set();
809
+ var _context_candidateRuleCache_get;
810
+ let rules = (_context_candidateRuleCache_get = context.candidateRuleCache.get(candidate)) !== null && _context_candidateRuleCache_get !== void 0 ? _context_candidateRuleCache_get : new Set();
792
811
  context.candidateRuleCache.set(candidate, rules);
793
812
  for (const match of matches){
794
813
  let [{ sort , options }, rule] = match;