tailwindcss 0.0.0-insiders.28e8fdf → 0.0.0-insiders.28e96ba

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 (62) hide show
  1. package/lib/cli/build/plugin.js +5 -7
  2. package/lib/cli/build/utils.js +7 -7
  3. package/lib/cli/build/watching.js +1 -1
  4. package/lib/cli/index.js +2 -2
  5. package/lib/corePluginList.js +1 -0
  6. package/lib/corePlugins.js +18 -4
  7. package/lib/css/preflight.css +4 -1
  8. package/lib/featureFlags.js +8 -9
  9. package/lib/lib/cacheInvalidation.js +3 -1
  10. package/lib/lib/collapseAdjacentRules.js +4 -2
  11. package/lib/lib/defaultExtractor.js +19 -23
  12. package/lib/lib/evaluateTailwindFunctions.js +2 -2
  13. package/lib/lib/expandApplyAtRules.js +6 -0
  14. package/lib/lib/expandTailwindAtRules.js +31 -33
  15. package/lib/lib/generateRules.js +30 -25
  16. package/lib/lib/regex.js +12 -12
  17. package/lib/lib/resolveDefaultsAtRules.js +3 -3
  18. package/lib/lib/setupContextUtils.js +60 -63
  19. package/lib/lib/setupTrackingContext.js +1 -2
  20. package/lib/lib/sharedState.js +12 -12
  21. package/lib/plugin.js +4 -2
  22. package/lib/postcss-plugins/nesting/plugin.js +2 -2
  23. package/lib/util/color.js +4 -4
  24. package/lib/util/dataTypes.js +79 -31
  25. package/lib/util/defaults.js +4 -4
  26. package/lib/util/escapeClassName.js +2 -2
  27. package/lib/util/formatVariantSelector.js +12 -7
  28. package/lib/util/getAllConfigs.js +1 -2
  29. package/lib/util/isPlainObject.js +1 -1
  30. package/lib/util/log.js +3 -3
  31. package/lib/util/normalizeConfig.js +15 -18
  32. package/lib/util/normalizeScreens.js +4 -4
  33. package/lib/util/parseBoxShadowValue.js +3 -3
  34. package/lib/util/pluginUtils.js +11 -11
  35. package/lib/util/resolveConfig.js +44 -41
  36. package/lib/util/withAlphaVariable.js +3 -3
  37. package/nesting/index.d.ts +4 -0
  38. package/package.json +12 -12
  39. package/resolveConfig.d.ts +22 -3
  40. package/scripts/generate-types.js +1 -2
  41. package/src/cli/build/plugin.js +1 -4
  42. package/src/cli/build/watching.js +1 -1
  43. package/src/corePluginList.js +1 -1
  44. package/src/corePlugins.js +3 -0
  45. package/src/css/preflight.css +4 -1
  46. package/src/featureFlags.js +1 -5
  47. package/src/lib/defaultExtractor.js +12 -14
  48. package/src/lib/expandApplyAtRules.js +7 -0
  49. package/src/lib/expandTailwindAtRules.js +36 -32
  50. package/src/lib/generateRules.js +19 -18
  51. package/src/lib/setupContextUtils.js +32 -30
  52. package/src/plugin.js +1 -1
  53. package/src/util/color.js +1 -1
  54. package/src/util/dataTypes.js +61 -9
  55. package/src/util/formatVariantSelector.js +7 -0
  56. package/src/util/isPlainObject.js +1 -1
  57. package/src/util/resolveConfig.js +42 -24
  58. package/stubs/config.full.js +67 -7
  59. package/types/config.d.ts +6 -3
  60. package/types/generated/corePluginList.d.ts +1 -1
  61. package/types/generated/default-theme.d.ts +28 -9
  62. package/types/index.d.ts +7 -3
@@ -61,7 +61,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
61
61
  if (cache && cache.has(obj)) {
62
62
  return cache.get(obj);
63
63
  }
64
- var newObj = {};
64
+ var newObj = {
65
+ __proto__: null
66
+ };
65
67
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
66
68
  for(var key in obj){
67
69
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -96,14 +98,11 @@ async function lightningcss(result, { map = true, minify = true } = {}) {
96
98
  sourceMap: result.map === undefined ? map : !!result.map,
97
99
  inputSourceMap: result.map ? result.map.toString() : undefined,
98
100
  targets: _lightningcss.default.browserslistToTargets((0, _browserslist.default)(browsersListConfig)),
99
- drafts: {
100
- nesting: true
101
- },
102
101
  include: _lightningcss.Features.Nesting,
103
102
  exclude: _lightningcss.Features.LogicalProperties
104
103
  });
105
104
  return Object.assign(result, {
106
- css: transformed.code.toString('utf8'),
105
+ css: transformed.code.toString(),
107
106
  map: result.map ? Object.assign(result.map, {
108
107
  toString () {
109
108
  var _transformed_map;
@@ -180,7 +179,6 @@ let state = {
180
179
  };
181
180
  },
182
181
  loadConfig (configPath, content) {
183
- var _content;
184
182
  if (this.watcher && configPath) {
185
183
  this.refreshConfigDependencies();
186
184
  }
@@ -197,7 +195,7 @@ let state = {
197
195
  };
198
196
  this.configBag.config = (0, _validateConfig.validateConfig)((0, _resolveConfig.default)(this.configBag.config));
199
197
  // Override content files if `--content` has been passed explicitly
200
- if (((_content = content) === null || _content === void 0 ? void 0 : _content.length) > 0) {
198
+ if ((content === null || content === void 0 ? void 0 : content.length) > 0) {
201
199
  this.configBag.config.content.files = content;
202
200
  }
203
201
  return this.configBag.config;
@@ -10,20 +10,20 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- indentRecursive: function() {
14
- return indentRecursive;
13
+ drainStdin: function() {
14
+ return drainStdin;
15
15
  },
16
16
  formatNodes: function() {
17
17
  return formatNodes;
18
18
  },
19
- readFileWithRetries: function() {
20
- return readFileWithRetries;
21
- },
22
- drainStdin: function() {
23
- return drainStdin;
19
+ indentRecursive: function() {
20
+ return indentRecursive;
24
21
  },
25
22
  outputFile: function() {
26
23
  return outputFile;
24
+ },
25
+ readFileWithRetries: function() {
26
+ return readFileWithRetries;
27
27
  }
28
28
  });
29
29
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
@@ -126,7 +126,7 @@ function createWatcher(args, { state, rebuild }) {
126
126
  // This is very likely a chokidar bug but it's one we need to work around
127
127
  // We treat this as a change event and rebuild the CSS
128
128
  watcher.on('raw', (evt, filePath, meta)=>{
129
- if (evt !== 'rename') {
129
+ if (evt !== 'rename' || filePath === null) {
130
130
  return;
131
131
  }
132
132
  let watchedPath = meta.watchedPath;
package/lib/cli/index.js CHANGED
@@ -151,8 +151,8 @@ let args = (()=>{
151
151
  ...flags,
152
152
  ...sharedFlags
153
153
  }).filter(([_key, value])=>{
154
- var _value_type, _value;
155
- return !((_value = value) === null || _value === void 0 ? void 0 : (_value_type = _value.type) === null || _value_type === void 0 ? void 0 : _value_type.manualParsing);
154
+ var _value_type;
155
+ return !(value === null || value === void 0 ? void 0 : (_value_type = value.type) === null || _value_type === void 0 ? void 0 : _value_type.manualParsing);
156
156
  }).map(([key, value])=>[
157
157
  key,
158
158
  typeof value === 'object' ? value.type : value
@@ -32,6 +32,7 @@ const _default = [
32
32
  "lineClamp",
33
33
  "display",
34
34
  "aspectRatio",
35
+ "size",
35
36
  "height",
36
37
  "maxHeight",
37
38
  "minHeight",
@@ -9,11 +9,11 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- variantPlugins: function() {
13
- return variantPlugins;
14
- },
15
12
  corePlugins: function() {
16
13
  return corePlugins;
14
+ },
15
+ variantPlugins: function() {
16
+ return variantPlugins;
17
17
  }
18
18
  });
19
19
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
@@ -61,7 +61,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
61
61
  if (cache && cache.has(obj)) {
62
62
  return cache.get(obj);
63
63
  }
64
- var newObj = {};
64
+ var newObj = {
65
+ __proto__: null
66
+ };
65
67
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
66
68
  for(var key in obj){
67
69
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -975,6 +977,15 @@ let corePlugins = {
975
977
  ]
976
978
  ]
977
979
  ]),
980
+ size: (0, _createUtilityPlugin.default)('size', [
981
+ [
982
+ 'size',
983
+ [
984
+ 'width',
985
+ 'height'
986
+ ]
987
+ ]
988
+ ]),
978
989
  height: (0, _createUtilityPlugin.default)('height', [
979
990
  [
980
991
  'h',
@@ -2312,6 +2323,9 @@ let corePlugins = {
2312
2323
  },
2313
2324
  '.text-balance': {
2314
2325
  'text-wrap': 'balance'
2326
+ },
2327
+ '.text-pretty': {
2328
+ 'text-wrap': 'pretty'
2315
2329
  }
2316
2330
  });
2317
2331
  },
@@ -24,9 +24,11 @@
24
24
  4. Use the user's configured `sans` font-family by default.
25
25
  5. Use the user's configured `sans` font-feature-settings by default.
26
26
  6. Use the user's configured `sans` font-variation-settings by default.
27
+ 7. Disable tap highlights on iOS
27
28
  */
28
29
 
29
- html {
30
+ html,
31
+ :host {
30
32
  line-height: 1.5; /* 1 */
31
33
  -webkit-text-size-adjust: 100%; /* 2 */
32
34
  -moz-tab-size: 4; /* 3 */
@@ -34,6 +36,7 @@ html {
34
36
  font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
35
37
  font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
36
38
  font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
39
+ -webkit-tap-highlight-color: transparent; /* 7 */
37
40
  }
38
41
 
39
42
  /*
@@ -9,6 +9,9 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ default: function() {
13
+ return _default;
14
+ },
12
15
  featureFlags: function() {
13
16
  return featureFlags;
14
17
  },
@@ -17,9 +20,6 @@ _export(exports, {
17
20
  },
18
21
  issueFlagNotices: function() {
19
22
  return issueFlagNotices;
20
- },
21
- default: function() {
22
- return _default;
23
23
  }
24
24
  });
25
25
  const _picocolors = /*#__PURE__*/ _interop_require_default(require("picocolors"));
@@ -51,24 +51,23 @@ let featureFlags = {
51
51
  };
52
52
  function flagEnabled(config, flag) {
53
53
  if (featureFlags.future.includes(flag)) {
54
- var _config_future, _config;
54
+ var _config_future;
55
55
  var _config_future_flag, _ref;
56
- return config.future === 'all' || ((_ref = (_config_future_flag = (_config = 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);
56
+ 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);
57
57
  }
58
58
  if (featureFlags.experimental.includes(flag)) {
59
- var _config_experimental, _config1;
59
+ var _config_experimental;
60
60
  var _config_experimental_flag, _ref1;
61
- return config.experimental === 'all' || ((_ref1 = (_config_experimental_flag = (_config1 = config) === null || _config1 === void 0 ? void 0 : (_config_experimental = _config1.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);
61
+ 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);
62
62
  }
63
63
  return false;
64
64
  }
65
65
  function experimentalFlagsEnabled(config) {
66
- var _config;
67
66
  if (config.experimental === 'all') {
68
67
  return featureFlags.experimental;
69
68
  }
70
69
  var _config_experimental;
71
- return Object.keys((_config_experimental = (_config = 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]);
70
+ 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]);
72
71
  }
73
72
  function issueFlagNotices(config) {
74
73
  if (process.env.JEST_WORKER_ID !== undefined) {
@@ -36,7 +36,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
36
36
  if (cache && cache.has(obj)) {
37
37
  return cache.get(obj);
38
38
  }
39
- var newObj = {};
39
+ var newObj = {
40
+ __proto__: null
41
+ };
40
42
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
41
43
  for(var key in obj){
42
44
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -31,10 +31,12 @@ function collapseAdjacentRules() {
31
31
  return;
32
32
  }
33
33
  let properties = comparisonMap[node.type];
34
- var _node_property, _currentRule_property;
35
34
  if (node.type === 'atrule' && node.name === 'font-face') {
36
35
  currentRule = node;
37
- } 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
+ } else if (properties.every((property)=>{
37
+ var _node_property, _currentRule_property;
38
+ return ((_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, ' ');
39
+ })) {
38
40
  // An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
39
41
  if (node.nodes) {
40
42
  currentRule.append(node.nodes);
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "defaultExtractor", {
8
8
  return defaultExtractor;
9
9
  }
10
10
  });
11
- const _featureFlags = require("../featureFlags");
12
11
  const _regex = /*#__PURE__*/ _interop_require_wildcard(require("./regex"));
13
12
  function _getRequireWildcardCache(nodeInterop) {
14
13
  if (typeof WeakMap !== "function") return null;
@@ -31,7 +30,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
31
30
  if (cache && cache.has(obj)) {
32
31
  return cache.get(obj);
33
32
  }
34
- var newObj = {};
33
+ var newObj = {
34
+ __proto__: null
35
+ };
35
36
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
36
37
  for(var key in obj){
37
38
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -57,17 +58,15 @@ function defaultExtractor(context) {
57
58
  /** @type {(string|string)[]} */ let results = [];
58
59
  for (let pattern of patterns){
59
60
  var _content_match;
60
- results = [
61
- ...results,
62
- ...(_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []
63
- ];
61
+ for (let result of (_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []){
62
+ results.push(clipAtBalancedParens(result));
63
+ }
64
64
  }
65
- return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
65
+ return results;
66
66
  };
67
67
  }
68
68
  function* buildRegExps(context) {
69
69
  let separator = context.tailwindConfig.separator;
70
- let variantGroupingEnabled = (0, _featureFlags.flagEnabled)(context.tailwindConfig, 'variantGrouping');
71
70
  let prefix = context.tailwindConfig.prefix !== '' ? _regex.optional(_regex.pattern([
72
71
  /-?/,
73
72
  _regex.escape(context.tailwindConfig.prefix)
@@ -79,7 +78,7 @@ function* buildRegExps(context) {
79
78
  // This is a targeted fix to continue to allow theme()
80
79
  // with square brackets to work in arbitrary properties
81
80
  // while fixing a problem with the regex matching too much
82
- /\[[^\s:'"`]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
81
+ /\[[^\s:'"`\]]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
83
82
  // Utilities
84
83
  _regex.pattern([
85
84
  // Utility Name / Group Name
@@ -115,6 +114,11 @@ function* buildRegExps(context) {
115
114
  /@\[[^\s"'`]+\](\/[^\s"'`]+)?/,
116
115
  separator
117
116
  ]),
117
+ // With variant modifier (e.g.: group-[..]/modifier)
118
+ _regex.pattern([
119
+ /([^\s"'`\[\\]+-)?\[[^\s"'`]+\]\/\w+/,
120
+ separator
121
+ ]),
118
122
  _regex.pattern([
119
123
  /([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/,
120
124
  separator
@@ -126,6 +130,11 @@ function* buildRegExps(context) {
126
130
  ]),
127
131
  // With quotes allowed
128
132
  _regex.any([
133
+ // With variant modifier (e.g.: group-[..]/modifier)
134
+ _regex.pattern([
135
+ /([^\s"'`\[\\]+-)?\[[^\s`]+\]\/\w+/,
136
+ separator
137
+ ]),
129
138
  _regex.pattern([
130
139
  /([^\s"'`\[\\]+-)?\[[^\s`]+\]/,
131
140
  separator
@@ -145,20 +154,7 @@ function* buildRegExps(context) {
145
154
  // Important (optional)
146
155
  /!?/,
147
156
  prefix,
148
- variantGroupingEnabled ? _regex.any([
149
- // Or any of those things but grouped separated by commas
150
- _regex.pattern([
151
- /\(/,
152
- utility,
153
- _regex.zeroOrMore([
154
- /,/,
155
- utility
156
- ]),
157
- /\)/
158
- ]),
159
- // Arbitrary properties, constrained utilities, arbitrary values, etc…
160
- utility
161
- ]) : utility
157
+ utility
162
158
  ]);
163
159
  }
164
160
  // 5. Inner matches
@@ -190,9 +190,9 @@ function _default(context) {
190
190
  theme: (node, path, ...defaultValue)=>{
191
191
  let { isValid, value, error, alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
192
192
  if (!isValid) {
193
- var _parentNode_raws_tailwind, _parentNode;
193
+ var _parentNode_raws_tailwind;
194
194
  let parentNode = node.parent;
195
- let candidate = (_parentNode = parentNode) === null || _parentNode === void 0 ? void 0 : (_parentNode_raws_tailwind = _parentNode.raws.tailwind) === null || _parentNode_raws_tailwind === void 0 ? void 0 : _parentNode_raws_tailwind.candidate;
195
+ let candidate = parentNode === null || parentNode === void 0 ? void 0 : (_parentNode_raws_tailwind = parentNode.raws.tailwind) === null || _parentNode_raws_tailwind === void 0 ? void 0 : _parentNode_raws_tailwind.candidate;
196
196
  if (parentNode && candidate !== undefined) {
197
197
  // Remove this utility from any caches
198
198
  context.markInvalidUtilityNode(parentNode);
@@ -482,6 +482,12 @@ function processApply(root, context, localCache) {
482
482
  // We do *not* want to do this for user CSS that happens to be structured the same
483
483
  let isGenerated = parent.raws.tailwind !== undefined;
484
484
  let parentSelector = isGenerated && importantSelector && parent.selector.indexOf(importantSelector) === 0 ? parent.selector.slice(importantSelector.length) : parent.selector;
485
+ // If the selector becomes empty after replacing the important selector
486
+ // This means that it's the same as the parent selector and we don't want to replace it
487
+ // Otherwise we'll crash
488
+ if (parentSelector === '') {
489
+ parentSelector = parent.selector;
490
+ }
485
491
  rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate);
486
492
  // And then re-add it if it was removed
487
493
  if (importantSelector && parentSelector !== parent.selector) {
@@ -43,7 +43,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
43
43
  if (cache && cache.has(obj)) {
44
44
  return cache.get(obj);
45
45
  }
46
- var newObj = {};
46
+ var newObj = {
47
+ __proto__: null
48
+ };
47
49
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
48
50
  for(var key in obj){
49
51
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -161,40 +163,36 @@ function expandTailwindAtRules(context) {
161
163
  ]);
162
164
  let seen = new Set();
163
165
  env.DEBUG && console.time('Reading changed files');
164
- if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, 'oxideParser')) {
165
- let rustParserContent = [];
166
- let regexParserContent = [];
167
- for (let item of context.changedContent){
168
- var _extractor;
169
- let transformer = getTransformer(context.tailwindConfig, item.extension);
170
- let extractor = getExtractor(context, item.extension);
171
- if (transformer === builtInTransformers.DEFAULT && ((_extractor = extractor) === null || _extractor === void 0 ? void 0 : _extractor.DEFAULT_EXTRACTOR) === true) {
172
- rustParserContent.push(item);
173
- } else {
174
- regexParserContent.push([
175
- item,
176
- {
177
- transformer,
178
- extractor
179
- }
180
- ]);
181
- }
182
- }
183
- if (rustParserContent.length > 0) {
184
- for (let candidate of (0, _oxide.parseCandidateStrings)(rustParserContent, _oxide.IO.Parallel | _oxide.Parsing.Parallel)){
185
- candidates.add(candidate);
186
- }
166
+ /** @type {[item: {file?: string, content?: string}, meta: {transformer: any, extractor: any}][]} */ let regexParserContent = [];
167
+ /** @type {{file?: string, content?: string}[]} */ let rustParserContent = [];
168
+ for (let item of context.changedContent){
169
+ let transformer = getTransformer(context.tailwindConfig, item.extension);
170
+ let extractor = getExtractor(context, item.extension);
171
+ if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, 'oxideParser') && transformer === builtInTransformers.DEFAULT && (extractor === null || extractor === void 0 ? void 0 : extractor.DEFAULT_EXTRACTOR) === true) {
172
+ rustParserContent.push(item);
173
+ } else {
174
+ regexParserContent.push([
175
+ item,
176
+ {
177
+ transformer,
178
+ extractor
179
+ }
180
+ ]);
187
181
  }
188
- if (regexParserContent.length > 0) {
189
- await Promise.all(regexParserContent.map(async ([{ file, content }, { transformer, extractor }])=>{
190
- content = file ? await _fs.default.promises.readFile(file, 'utf8') : content;
191
- getClassCandidates(transformer(content), extractor, candidates, seen);
192
- }));
182
+ }
183
+ // Read files using our newer, faster parser when:
184
+ // - Oxide is enabled; AND
185
+ // - The file is using default transfomers and extractors
186
+ if (rustParserContent.length > 0) {
187
+ for (let candidate of (0, _oxide.parseCandidateStrings)(rustParserContent, _oxide.IO.Parallel | _oxide.Parsing.Parallel)){
188
+ candidates.add(candidate);
193
189
  }
194
- } else {
195
- await Promise.all(context.changedContent.map(async ({ file, content, extension })=>{
196
- let transformer = getTransformer(context.tailwindConfig, extension);
197
- let extractor = getExtractor(context, extension);
190
+ }
191
+ // Otherwise, read any files in node and parse with regexes
192
+ const BATCH_SIZE = 500;
193
+ for(let i = 0; i < regexParserContent.length; i += BATCH_SIZE){
194
+ let batch = regexParserContent.slice(i, i + BATCH_SIZE);
195
+ await Promise.all(batch.map(async ([{ file, content }, { transformer, extractor }])=>{
198
196
  content = file ? await _fs.default.promises.readFile(file, 'utf8') : content;
199
197
  getClassCandidates(transformer(content), extractor, candidates, seen);
200
198
  }));
@@ -9,14 +9,14 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ generateRules: function() {
13
+ return generateRules;
14
+ },
12
15
  getClassNameFromSelector: function() {
13
16
  return getClassNameFromSelector;
14
17
  },
15
18
  resolveMatches: function() {
16
19
  return resolveMatches;
17
- },
18
- generateRules: function() {
19
- return generateRules;
20
20
  }
21
21
  });
22
22
  const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
@@ -33,7 +33,6 @@ const _dataTypes = require("../util/dataTypes");
33
33
  const _setupContextUtils = require("./setupContextUtils");
34
34
  const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interop_require_default(require("../util/isSyntacticallyValidPropertyValue"));
35
35
  const _splitAtTopLevelOnly = require("../util/splitAtTopLevelOnly.js");
36
- const _featureFlags = require("../featureFlags");
37
36
  const _applyImportantSelector = require("../util/applyImportantSelector");
38
37
  function _interop_require_default(obj) {
39
38
  return obj && obj.__esModule ? obj : {
@@ -61,7 +60,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
61
60
  if (cache && cache.has(obj)) {
62
61
  return cache.get(obj);
63
62
  }
64
- var newObj = {};
63
+ var newObj = {
64
+ __proto__: null
65
+ };
65
66
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
66
67
  for(var key in obj){
67
68
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -497,7 +498,9 @@ function extractArbitraryProperty(classCandidate, context) {
497
498
  if (!(0, _isSyntacticallyValidPropertyValue.default)(value)) {
498
499
  return null;
499
500
  }
500
- let normalized = (0, _dataTypes.normalize)(value);
501
+ let normalized = (0, _dataTypes.normalize)(value, {
502
+ property
503
+ });
501
504
  if (!isParsableCssValue(property, normalized)) {
502
505
  return null;
503
506
  }
@@ -575,7 +578,7 @@ function* recordCandidates(matches, classCandidate) {
575
578
  yield match;
576
579
  }
577
580
  }
578
- function* resolveMatches(candidate, context, original = candidate) {
581
+ function* resolveMatches(candidate, context) {
579
582
  let separator = context.tailwindConfig.separator;
580
583
  let [classCandidate, ...variants] = splitWithSeparator(candidate, separator).reverse();
581
584
  let important = false;
@@ -583,14 +586,6 @@ function* resolveMatches(candidate, context, original = candidate) {
583
586
  important = true;
584
587
  classCandidate = classCandidate.slice(1);
585
588
  }
586
- if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, 'variantGrouping')) {
587
- if (classCandidate.startsWith('(') && classCandidate.endsWith(')')) {
588
- let base = variants.slice().reverse().join(separator);
589
- for (let part of (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(classCandidate.slice(1, -1), ',')){
590
- yield* resolveMatches(base + separator + part, context, original);
591
- }
592
- }
593
- }
594
589
  // TODO: Reintroduce this in ways that doesn't break on false positives
595
590
  // function sortAgainst(toSort, against) {
596
591
  // return toSort.slice().sort((a, z) => {
@@ -695,10 +690,12 @@ function* resolveMatches(candidate, context, original = candidate) {
695
690
  fallback
696
691
  ];
697
692
  } else {
698
- var _typesByMatches_get;
699
- let typesPerPlugin = matches.map((match)=>new Set([
693
+ let typesPerPlugin = matches.map((match)=>{
694
+ var _typesByMatches_get;
695
+ return new Set([
700
696
  ...(_typesByMatches_get = typesByMatches.get(match)) !== null && _typesByMatches_get !== void 0 ? _typesByMatches_get : []
701
- ]));
697
+ ]);
698
+ });
702
699
  // Remove duplicates, so that we can detect proper unique types for each plugin.
703
700
  for (let pluginTypes of typesPerPlugin){
704
701
  for (let type of pluginTypes){
@@ -750,8 +747,7 @@ function* resolveMatches(candidate, context, original = candidate) {
750
747
  // Apply final format selector
751
748
  match = applyFinalFormat(match, {
752
749
  context,
753
- candidate,
754
- original
750
+ candidate
755
751
  });
756
752
  // Skip rules with invalid selectors
757
753
  // This will cause the candidate to be added to the "not class"
@@ -763,7 +759,7 @@ function* resolveMatches(candidate, context, original = candidate) {
763
759
  }
764
760
  }
765
761
  }
766
- function applyFinalFormat(match, { context, candidate, original }) {
762
+ function applyFinalFormat(match, { context, candidate }) {
767
763
  if (!match[0].collectedFormats) {
768
764
  return match;
769
765
  }
@@ -772,7 +768,7 @@ function applyFinalFormat(match, { context, candidate, original }) {
772
768
  try {
773
769
  finalFormat = (0, _formatVariantSelector.formatVariantSelector)(match[0].collectedFormats, {
774
770
  context,
775
- candidate: original
771
+ candidate
776
772
  });
777
773
  } catch (e) {
778
774
  // The format selector we produced is invalid
@@ -796,10 +792,17 @@ function applyFinalFormat(match, { context, candidate, original }) {
796
792
  return;
797
793
  }
798
794
  try {
799
- rule.selector = (0, _formatVariantSelector.finalizeSelector)(rule.selector, finalFormat, {
795
+ let selector = (0, _formatVariantSelector.finalizeSelector)(rule.selector, finalFormat, {
800
796
  candidate,
801
797
  context
802
798
  });
799
+ // Finalize Selector determined that this candidate is irrelevant
800
+ // TODO: This elimination should happen earlier so this never happens
801
+ if (selector === null) {
802
+ rule.remove();
803
+ return;
804
+ }
805
+ rule.selector = selector;
803
806
  } catch (e) {
804
807
  // If this selector is invalid we also want to skip it
805
808
  // But it's likely that being invalid here means there's a bug in a plugin rather than too loosely matching content
@@ -840,7 +843,7 @@ function getImportantStrategy(important) {
840
843
  };
841
844
  }
842
845
  }
843
- function generateRules(candidates, context) {
846
+ function generateRules(candidates, context, isSorting = false) {
844
847
  let allRules = [];
845
848
  let strategy = getImportantStrategy(context.tailwindConfig.important);
846
849
  for (let candidate of candidates){
@@ -871,9 +874,11 @@ function generateRules(candidates, context) {
871
874
  container.walkRules(strategy);
872
875
  rule = container.nodes[0];
873
876
  }
877
+ // Note: We have to clone rules during sorting
878
+ // so we eliminate some shared mutable state
874
879
  let newEntry = [
875
880
  sort,
876
- rule
881
+ isSorting ? rule.clone() : rule
877
882
  ];
878
883
  rules.add(newEntry);
879
884
  context.ruleCache.add(newEntry);
package/lib/lib/regex.js CHANGED
@@ -9,26 +9,26 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- pattern: function() {
13
- return pattern;
14
- },
15
- withoutCapturing: function() {
16
- return withoutCapturing;
17
- },
18
12
  any: function() {
19
13
  return any;
20
14
  },
15
+ escape: function() {
16
+ return escape;
17
+ },
18
+ nestedBrackets: function() {
19
+ return nestedBrackets;
20
+ },
21
21
  optional: function() {
22
22
  return optional;
23
23
  },
24
- zeroOrMore: function() {
25
- return zeroOrMore;
24
+ pattern: function() {
25
+ return pattern;
26
26
  },
27
- nestedBrackets: function() {
28
- return nestedBrackets;
27
+ withoutCapturing: function() {
28
+ return withoutCapturing;
29
29
  },
30
- escape: function() {
31
- return escape;
30
+ zeroOrMore: function() {
31
+ return zeroOrMore;
32
32
  }
33
33
  });
34
34
  const REGEX_SPECIAL = /[\\^$.*+?()[\]{}|]/g;