tailwindcss 0.0.0-insiders.dddaded → 0.0.0-insiders.de00a62

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 (160) hide show
  1. package/lib/cli/build/deps.js +17 -9
  2. package/lib/cli/build/index.js +10 -8
  3. package/lib/cli/build/plugin.js +31 -29
  4. package/lib/cli/build/utils.js +18 -8
  5. package/lib/cli/build/watching.js +13 -11
  6. package/lib/cli/help/index.js +6 -4
  7. package/lib/cli/index.js +4 -4
  8. package/lib/cli/init/index.js +8 -6
  9. package/lib/cli-peer-dependencies.js +12 -4
  10. package/lib/cli.js +1 -1
  11. package/lib/corePluginList.js +8 -2
  12. package/lib/corePlugins.js +211 -48
  13. package/lib/css/preflight.css +24 -8
  14. package/lib/featureFlags.js +14 -9
  15. package/lib/index.js +1 -5
  16. package/lib/lib/cacheInvalidation.js +7 -5
  17. package/lib/lib/collapseAdjacentRules.js +3 -1
  18. package/lib/lib/collapseDuplicateDeclarations.js +10 -8
  19. package/lib/lib/content.js +51 -14
  20. package/lib/lib/defaultExtractor.js +38 -28
  21. package/lib/lib/detectNesting.js +3 -1
  22. package/lib/lib/evaluateTailwindFunctions.js +20 -16
  23. package/lib/lib/expandApplyAtRules.js +41 -33
  24. package/lib/lib/expandTailwindAtRules.js +38 -19
  25. package/lib/lib/findAtConfigPath.js +6 -4
  26. package/lib/lib/generateRules.js +83 -55
  27. package/lib/lib/getModuleDependencies.js +10 -8
  28. package/lib/lib/load-config.js +18 -5
  29. package/lib/lib/normalizeTailwindDirectives.js +5 -3
  30. package/lib/lib/offsets.js +58 -7
  31. package/lib/lib/partitionApplyAtRules.js +3 -1
  32. package/lib/lib/regex.js +21 -7
  33. package/lib/lib/remap-bitfield.js +3 -1
  34. package/lib/lib/resolveDefaultsAtRules.js +27 -21
  35. package/lib/lib/setupContextUtils.js +143 -94
  36. package/lib/lib/setupTrackingContext.js +27 -24
  37. package/lib/lib/sharedState.js +28 -24
  38. package/lib/lib/substituteScreenAtRules.js +5 -3
  39. package/lib/oxide/cli/build/deps.js +16 -8
  40. package/lib/oxide/cli/build/index.js +6 -4
  41. package/lib/oxide/cli/build/plugin.js +25 -23
  42. package/lib/oxide/cli/build/utils.js +18 -8
  43. package/lib/oxide/cli/build/watching.js +10 -8
  44. package/lib/oxide/cli/help/index.js +6 -4
  45. package/lib/oxide/cli/index.js +4 -4
  46. package/lib/oxide/cli/init/index.js +6 -4
  47. package/lib/plugin.js +9 -9
  48. package/lib/postcss-plugins/nesting/index.js +3 -1
  49. package/lib/postcss-plugins/nesting/plugin.js +8 -6
  50. package/lib/processTailwindFeatures.js +16 -14
  51. package/lib/public/colors.js +5 -3
  52. package/lib/public/create-plugin.js +5 -3
  53. package/lib/public/default-config.js +6 -4
  54. package/lib/public/default-theme.js +6 -4
  55. package/lib/public/load-config.js +5 -3
  56. package/lib/public/resolve-config.js +6 -4
  57. package/lib/util/applyImportantSelector.js +7 -5
  58. package/lib/util/bigSign.js +3 -1
  59. package/lib/util/buildMediaQuery.js +3 -1
  60. package/lib/util/cloneDeep.js +3 -1
  61. package/lib/util/cloneNodes.js +36 -14
  62. package/lib/util/color.js +11 -7
  63. package/lib/util/colorNames.js +752 -0
  64. package/lib/util/configurePlugins.js +3 -1
  65. package/lib/util/createPlugin.js +3 -1
  66. package/lib/util/createUtilityPlugin.js +5 -3
  67. package/lib/util/dataTypes.js +180 -31
  68. package/lib/util/defaults.js +6 -4
  69. package/lib/util/escapeClassName.js +7 -5
  70. package/lib/util/escapeCommas.js +3 -1
  71. package/lib/util/flattenColorPalette.js +3 -1
  72. package/lib/util/formatVariantSelector.js +36 -21
  73. package/lib/util/getAllConfigs.js +6 -4
  74. package/lib/util/hashConfig.js +6 -4
  75. package/lib/util/isKeyframeRule.js +3 -1
  76. package/lib/util/isPlainObject.js +4 -2
  77. package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
  78. package/lib/util/log.js +8 -4
  79. package/lib/util/nameClass.js +12 -6
  80. package/lib/util/negateValue.js +3 -1
  81. package/lib/util/normalizeConfig.js +7 -5
  82. package/lib/util/normalizeScreens.js +12 -4
  83. package/lib/util/parseAnimationValue.js +3 -1
  84. package/lib/util/parseBoxShadowValue.js +6 -2
  85. package/lib/util/parseDependency.js +3 -1
  86. package/lib/util/parseGlob.js +6 -4
  87. package/lib/util/parseObjectStyles.js +9 -7
  88. package/lib/util/pluginUtils.js +43 -18
  89. package/lib/util/prefixSelector.js +6 -4
  90. package/lib/util/pseudoElements.js +24 -35
  91. package/lib/util/removeAlphaVariables.js +3 -1
  92. package/lib/util/resolveConfig.js +10 -8
  93. package/lib/util/resolveConfigPath.js +9 -5
  94. package/lib/util/responsive.js +6 -4
  95. package/lib/util/splitAtTopLevelOnly.js +3 -1
  96. package/lib/util/tap.js +3 -1
  97. package/lib/util/toColorValue.js +3 -1
  98. package/lib/util/toPath.js +3 -1
  99. package/lib/util/transformThemeValue.js +6 -4
  100. package/lib/util/validateConfig.js +5 -3
  101. package/lib/util/validateFormalSyntax.js +3 -1
  102. package/lib/util/withAlphaVariable.js +6 -2
  103. package/lib/value-parser/LICENSE +22 -0
  104. package/lib/value-parser/README.md +3 -0
  105. package/lib/value-parser/index.d.js +2 -0
  106. package/lib/value-parser/index.js +22 -0
  107. package/lib/value-parser/parse.js +259 -0
  108. package/lib/value-parser/stringify.js +38 -0
  109. package/lib/value-parser/unit.js +86 -0
  110. package/lib/value-parser/walk.js +16 -0
  111. package/nesting/index.d.ts +4 -0
  112. package/package.json +31 -36
  113. package/peers/index.js +65266 -48224
  114. package/resolveConfig.d.ts +22 -3
  115. package/scripts/generate-types.js +1 -2
  116. package/src/cli/build/plugin.js +7 -7
  117. package/src/cli/build/watching.js +1 -1
  118. package/src/cli.js +1 -1
  119. package/src/corePluginList.js +1 -1
  120. package/src/corePlugins.js +165 -29
  121. package/src/css/preflight.css +24 -8
  122. package/src/featureFlags.js +3 -8
  123. package/src/index.js +1 -5
  124. package/src/lib/content.js +42 -1
  125. package/src/lib/defaultExtractor.js +30 -17
  126. package/src/lib/evaluateTailwindFunctions.js +4 -1
  127. package/src/lib/expandApplyAtRules.js +7 -0
  128. package/src/lib/expandTailwindAtRules.js +26 -9
  129. package/src/lib/generateRules.js +50 -26
  130. package/src/lib/load-config.ts +8 -0
  131. package/src/lib/offsets.js +61 -2
  132. package/src/lib/resolveDefaultsAtRules.js +5 -1
  133. package/src/lib/setupContextUtils.js +77 -38
  134. package/src/lib/setupTrackingContext.js +2 -4
  135. package/src/lib/sharedState.js +0 -15
  136. package/src/oxide/cli/build/plugin.ts +7 -7
  137. package/src/plugin.js +4 -4
  138. package/src/processTailwindFeatures.js +3 -2
  139. package/src/util/cloneNodes.js +35 -14
  140. package/src/util/color.js +2 -2
  141. package/src/util/colorNames.js +150 -0
  142. package/src/util/dataTypes.js +143 -18
  143. package/src/util/formatVariantSelector.js +11 -3
  144. package/src/util/isPlainObject.js +1 -1
  145. package/src/util/pluginUtils.js +17 -5
  146. package/src/util/prefixSelector.js +1 -0
  147. package/src/util/pseudoElements.js +18 -17
  148. package/src/value-parser/LICENSE +22 -0
  149. package/src/value-parser/README.md +3 -0
  150. package/src/value-parser/index.d.ts +177 -0
  151. package/src/value-parser/index.js +28 -0
  152. package/src/value-parser/parse.js +303 -0
  153. package/src/value-parser/stringify.js +41 -0
  154. package/src/value-parser/unit.js +118 -0
  155. package/src/value-parser/walk.js +18 -0
  156. package/stubs/config.full.js +86 -14
  157. package/types/config.d.ts +17 -9
  158. package/types/generated/corePluginList.d.ts +1 -1
  159. package/types/generated/default-theme.d.ts +35 -9
  160. package/types/index.d.ts +7 -3
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>expandTailwindAtRules
7
+ get: function() {
8
+ return expandTailwindAtRules;
9
+ }
8
10
  });
9
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
10
- const _quickLru = /*#__PURE__*/ _interopRequireDefault(require("quick-lru"));
11
- const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
11
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
+ const _quicklru = /*#__PURE__*/ _interop_require_default(require("@alloc/quick-lru"));
13
+ const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
12
14
  const _generateRules = require("./generateRules");
13
- const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
14
- const _cloneNodes = /*#__PURE__*/ _interopRequireDefault(require("../util/cloneNodes"));
15
+ const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
16
+ const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("../util/cloneNodes"));
15
17
  const _defaultExtractor = require("./defaultExtractor");
16
- function _interopRequireDefault(obj) {
18
+ function _interop_require_default(obj) {
17
19
  return obj && obj.__esModule ? obj : {
18
20
  default: obj
19
21
  };
@@ -26,7 +28,7 @@ function _getRequireWildcardCache(nodeInterop) {
26
28
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
27
29
  })(nodeInterop);
28
30
  }
29
- function _interopRequireWildcard(obj, nodeInterop) {
31
+ function _interop_require_wildcard(obj, nodeInterop) {
30
32
  if (!nodeInterop && obj && obj.__esModule) {
31
33
  return obj;
32
34
  }
@@ -79,7 +81,7 @@ let extractorCache = new WeakMap();
79
81
  // up these regexes by 50% that could cut initial build time by like 20%.
80
82
  function getClassCandidates(content, extractor, candidates, seen) {
81
83
  if (!extractorCache.has(extractor)) {
82
- extractorCache.set(extractor, new _quickLru.default({
84
+ extractorCache.set(extractor, new _quicklru.default({
83
85
  maxSize: 25000
84
86
  }));
85
87
  }
@@ -96,8 +98,8 @@ function getClassCandidates(content, extractor, candidates, seen) {
96
98
  } else {
97
99
  let extractorMatches = extractor(line).filter((s)=>s !== "!*");
98
100
  let lineMatchesSet = new Set(extractorMatches);
99
- for (let match1 of lineMatchesSet){
100
- candidates.add(match1);
101
+ for (let match of lineMatchesSet){
102
+ candidates.add(match);
101
103
  }
102
104
  extractorCache.get(extractor).set(line, lineMatchesSet);
103
105
  }
@@ -122,7 +124,7 @@ function getClassCandidates(content, extractor, candidates, seen) {
122
124
  return returnValue;
123
125
  }
124
126
  function expandTailwindAtRules(context) {
125
- return (root)=>{
127
+ return async (root)=>{
126
128
  let layerNodes = {
127
129
  base: null,
128
130
  components: null,
@@ -152,7 +154,7 @@ function expandTailwindAtRules(context) {
152
154
  ]);
153
155
  let seen = new Set();
154
156
  env.DEBUG && console.time("Reading changed files");
155
- if (env.OXIDE) {
157
+ if (false) {
156
158
  // TODO: Pass through or implement `extractor`
157
159
  for (let candidate of require("@tailwindcss/oxide").parseCandidateStringsFromFiles(context.changedContent)){
158
160
  candidates.add(candidate);
@@ -163,11 +165,25 @@ function expandTailwindAtRules(context) {
163
165
  // getClassCandidatesOxide(file, transformer(content), extractor, candidates, seen)
164
166
  // }
165
167
  } else {
166
- for (let { file , content , extension } of context.changedContent){
167
- let transformer = getTransformer(context.tailwindConfig, extension);
168
- let extractor = getExtractor(context, extension);
169
- content = file ? _fs.default.readFileSync(file, "utf8") : content;
170
- getClassCandidates(transformer(content), extractor, candidates, seen);
168
+ /** @type {[item: {file?: string, content?: string}, meta: {transformer: any, extractor: any}][]} */ let regexParserContent = [];
169
+ for (let item of context.changedContent){
170
+ let transformer = getTransformer(context.tailwindConfig, item.extension);
171
+ let extractor = getExtractor(context, item.extension);
172
+ regexParserContent.push([
173
+ item,
174
+ {
175
+ transformer,
176
+ extractor
177
+ }
178
+ ]);
179
+ }
180
+ const BATCH_SIZE = 500;
181
+ for(let i = 0; i < regexParserContent.length; i += BATCH_SIZE){
182
+ let batch = regexParserContent.slice(i, i + BATCH_SIZE);
183
+ await Promise.all(batch.map(async ([{ file , content }, { transformer , extractor }])=>{
184
+ content = file ? await _fs.default.promises.readFile(file, "utf8") : content;
185
+ getClassCandidates(transformer(content), extractor, candidates, seen);
186
+ }));
171
187
  }
172
188
  }
173
189
  env.DEBUG && console.timeEnd("Reading changed files");
@@ -176,7 +192,7 @@ function expandTailwindAtRules(context) {
176
192
  let classCacheCount = context.classCache.size;
177
193
  env.DEBUG && console.time("Generate rules");
178
194
  env.DEBUG && console.time("Sorting candidates");
179
- let sortedCandidates = env.OXIDE ? candidates : new Set([
195
+ let sortedCandidates = false ? candidates : new Set([
180
196
  ...candidates
181
197
  ].sort((a, z)=>{
182
198
  if (a === z) return 0;
@@ -244,6 +260,9 @@ function expandTailwindAtRules(context) {
244
260
  layer: "variants"
245
261
  }));
246
262
  }
263
+ var _root_source_end;
264
+ // TODO: Why is the root node having no source location for `end` possible?
265
+ root.source.end = (_root_source_end = root.source.end) !== null && _root_source_end !== void 0 ? _root_source_end : root.source.start;
247
266
  // If we've got a utility layer and no utilities are generated there's likely something wrong
248
267
  const hasUtilityVariants = variantNodes.some((node)=>{
249
268
  var _node_raws_tailwind;
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "findAtConfigPath", {
6
6
  enumerable: true,
7
- get: ()=>findAtConfigPath
7
+ get: function() {
8
+ return findAtConfigPath;
9
+ }
8
10
  });
9
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
10
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
11
- function _interopRequireDefault(obj) {
11
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
+ function _interop_require_default(obj) {
12
14
  return obj && obj.__esModule ? obj : {
13
15
  default: obj
14
16
  };
@@ -9,27 +9,33 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- getClassNameFromSelector: ()=>getClassNameFromSelector,
13
- resolveMatches: ()=>resolveMatches,
14
- generateRules: ()=>generateRules
12
+ getClassNameFromSelector: function() {
13
+ return getClassNameFromSelector;
14
+ },
15
+ resolveMatches: function() {
16
+ return resolveMatches;
17
+ },
18
+ generateRules: function() {
19
+ return generateRules;
20
+ }
15
21
  });
16
- const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
17
- const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
18
- const _parseObjectStyles = /*#__PURE__*/ _interopRequireDefault(require("../util/parseObjectStyles"));
19
- const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("../util/isPlainObject"));
20
- const _prefixSelector = /*#__PURE__*/ _interopRequireDefault(require("../util/prefixSelector"));
22
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
23
+ const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
24
+ const _parseObjectStyles = /*#__PURE__*/ _interop_require_default(require("../util/parseObjectStyles"));
25
+ const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("../util/isPlainObject"));
26
+ const _prefixSelector = /*#__PURE__*/ _interop_require_default(require("../util/prefixSelector"));
21
27
  const _pluginUtils = require("../util/pluginUtils");
22
- const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
23
- const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
28
+ const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
29
+ const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
24
30
  const _formatVariantSelector = require("../util/formatVariantSelector");
25
31
  const _nameClass = require("../util/nameClass");
26
32
  const _dataTypes = require("../util/dataTypes");
27
33
  const _setupContextUtils = require("./setupContextUtils");
28
- const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interopRequireDefault(require("../util/isSyntacticallyValidPropertyValue"));
29
- const _splitAtTopLevelOnlyJs = require("../util/splitAtTopLevelOnly.js");
34
+ const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interop_require_default(require("../util/isSyntacticallyValidPropertyValue"));
35
+ const _splitAtTopLevelOnly = require("../util/splitAtTopLevelOnly.js");
30
36
  const _featureFlags = require("../featureFlags");
31
37
  const _applyImportantSelector = require("../util/applyImportantSelector");
32
- function _interopRequireDefault(obj) {
38
+ function _interop_require_default(obj) {
33
39
  return obj && obj.__esModule ? obj : {
34
40
  default: obj
35
41
  };
@@ -42,7 +48,7 @@ function _getRequireWildcardCache(nodeInterop) {
42
48
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
43
49
  })(nodeInterop);
44
50
  }
45
- function _interopRequireWildcard(obj, nodeInterop) {
51
+ function _interop_require_wildcard(obj, nodeInterop) {
46
52
  if (!nodeInterop && obj && obj.__esModule) {
47
53
  return obj;
48
54
  }
@@ -73,7 +79,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
73
79
  }
74
80
  return newObj;
75
81
  }
76
- let classNameParser = (0, _postcssSelectorParser.default)((selectors)=>{
82
+ let classNameParser = (0, _postcssselectorparser.default)((selectors)=>{
77
83
  return selectors.first.filter(({ type })=>type === "class").pop().value;
78
84
  });
79
85
  function getClassNameFromSelector(selector) {
@@ -156,6 +162,9 @@ function applyImportant(matches, classCandidate) {
156
162
  return matches;
157
163
  }
158
164
  let result = [];
165
+ function isInKeyframes(rule) {
166
+ return rule.parent && rule.parent.type === "atrule" && rule.parent.name === "keyframes";
167
+ }
159
168
  for (let [meta, rule] of matches){
160
169
  let container = _postcss.default.root({
161
170
  nodes: [
@@ -163,7 +172,12 @@ function applyImportant(matches, classCandidate) {
163
172
  ]
164
173
  });
165
174
  container.walkRules((r)=>{
166
- let ast = (0, _postcssSelectorParser.default)().astSync(r.selector);
175
+ // Declarations inside keyframes cannot be marked as important
176
+ // They will be ignored by the browser
177
+ if (isInKeyframes(r)) {
178
+ return;
179
+ }
180
+ let ast = (0, _postcssselectorparser.default)().astSync(r.selector);
167
181
  // Remove extraneous selectors that do not include the base candidate
168
182
  ast.each((sel)=>(0, _formatVariantSelector.eliminateIrrelevantSelectors)(sel, classCandidate));
169
183
  // Update all instances of the base candidate to include the important marker
@@ -199,7 +213,7 @@ function applyVariant(variant, matches, context) {
199
213
  };
200
214
  // Retrieve "modifier"
201
215
  {
202
- let [baseVariant, ...modifiers] = (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(variant, "/");
216
+ let [baseVariant, ...modifiers] = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(variant, "/");
203
217
  // This is a hack to support variants with `/` in them, like `ar-1/10/20:text-red-500`
204
218
  // In this case 1/10 is a value but /20 is a modifier
205
219
  if (modifiers.length > 1) {
@@ -225,12 +239,12 @@ function applyVariant(variant, matches, context) {
225
239
  // group[:hover] (`-` is missing)
226
240
  let match = /(.)(-?)\[(.*)\]/g.exec(variant);
227
241
  if (match) {
228
- let [, char, seperator, value] = match;
242
+ let [, char, separator, value] = match;
229
243
  // @-[200px] case
230
- if (char === "@" && seperator === "-") return [];
244
+ if (char === "@" && separator === "-") return [];
231
245
  // group[:hover] case
232
- if (char !== "@" && seperator === "") return [];
233
- variant = variant.replace(`${seperator}[${value}]`, "");
246
+ if (char !== "@" && separator === "") return [];
247
+ variant = variant.replace(`${separator}[${value}]`, "");
234
248
  args.value = value;
235
249
  }
236
250
  }
@@ -238,7 +252,7 @@ function applyVariant(variant, matches, context) {
238
252
  if (isArbitraryValue(variant) && !context.variantMap.has(variant)) {
239
253
  let sort = context.offsets.recordVariant(variant);
240
254
  let selector = (0, _dataTypes.normalize)(variant.slice(1, -1));
241
- let selectors = (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(selector, ",");
255
+ let selectors = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(selector, ",");
242
256
  // We do not support multiple selectors for arbitrary variants
243
257
  if (selectors.length > 1) {
244
258
  return [];
@@ -253,9 +267,17 @@ function applyVariant(variant, matches, context) {
253
267
  context.variantMap.set(variant, records);
254
268
  }
255
269
  if (context.variantMap.has(variant)) {
270
+ var _context_variantOptions_get;
256
271
  let isArbitraryVariant = isArbitraryValue(variant);
272
+ var _context_variantOptions_get_INTERNAL_FEATURES;
273
+ let internalFeatures = (_context_variantOptions_get_INTERNAL_FEATURES = (_context_variantOptions_get = context.variantOptions.get(variant)) === null || _context_variantOptions_get === void 0 ? void 0 : _context_variantOptions_get[_setupContextUtils.INTERNAL_FEATURES]) !== null && _context_variantOptions_get_INTERNAL_FEATURES !== void 0 ? _context_variantOptions_get_INTERNAL_FEATURES : {};
257
274
  let variantFunctionTuples = context.variantMap.get(variant).slice();
258
275
  let result = [];
276
+ let respectPrefix = (()=>{
277
+ if (isArbitraryVariant) return false;
278
+ if (internalFeatures.respectPrefix === false) return false;
279
+ return true;
280
+ })();
259
281
  for (let [meta, rule] of matches){
260
282
  // Don't generate variants for user css
261
283
  if (meta.layer === "user") {
@@ -312,7 +334,7 @@ function applyVariant(variant, matches, context) {
312
334
  format (selectorFormat) {
313
335
  collectedFormats.push({
314
336
  format: selectorFormat,
315
- isArbitraryVariant
337
+ respectPrefix
316
338
  });
317
339
  },
318
340
  args
@@ -320,14 +342,14 @@ function applyVariant(variant, matches, context) {
320
342
  // It can happen that a list of format strings is returned from within the function. In that
321
343
  // case, we have to process them as well. We can use the existing `variantSort`.
322
344
  if (Array.isArray(ruleWithVariant)) {
323
- for (let [idx, variantFunction1] of ruleWithVariant.entries()){
345
+ for (let [idx, variantFunction] of ruleWithVariant.entries()){
324
346
  // This is a little bit scary since we are pushing to an array of items that we are
325
347
  // currently looping over. However, you can also think of it like a processing queue
326
348
  // where you keep handling jobs until everything is done and each job can queue more
327
349
  // jobs if needed.
328
350
  variantFunctionTuples.push([
329
351
  context.offsets.applyParallelOffset(variantSort, idx),
330
- variantFunction1,
352
+ variantFunction,
331
353
  // If the clone has been modified we have to pass that back
332
354
  // though so each rule can use the modified container
333
355
  clone.clone()
@@ -338,7 +360,7 @@ function applyVariant(variant, matches, context) {
338
360
  if (typeof ruleWithVariant === "string") {
339
361
  collectedFormats.push({
340
362
  format: ruleWithVariant,
341
- isArbitraryVariant
363
+ respectPrefix
342
364
  });
343
365
  }
344
366
  if (ruleWithVariant === null) {
@@ -359,7 +381,7 @@ function applyVariant(variant, matches, context) {
359
381
  // as well. E.g.: `${variant}${separator}${className}`.
360
382
  // However, plugin authors probably also prepend or append certain
361
383
  // classes, pseudos, ids, ...
362
- let rebuiltBase = (0, _postcssSelectorParser.default)((selectors)=>{
384
+ let rebuiltBase = (0, _postcssselectorparser.default)((selectors)=>{
363
385
  selectors.walkClasses((classNode)=>{
364
386
  classNode.value = `${variant}${context.tailwindConfig.separator}${classNode.value}`;
365
387
  });
@@ -377,7 +399,7 @@ function applyVariant(variant, matches, context) {
377
399
  // format: .foo &
378
400
  collectedFormats.push({
379
401
  format: modified.replace(rebuiltBase, "&"),
380
- isArbitraryVariant
402
+ respectPrefix
381
403
  });
382
404
  rule.selector = before;
383
405
  });
@@ -486,11 +508,13 @@ function extractArbitraryProperty(classCandidate, context) {
486
508
  if (!(0, _isSyntacticallyValidPropertyValue.default)(value)) {
487
509
  return null;
488
510
  }
489
- let normalized = (0, _dataTypes.normalize)(value);
511
+ let normalized = (0, _dataTypes.normalize)(value, {
512
+ property
513
+ });
490
514
  if (!isParsableCssValue(property, normalized)) {
491
515
  return null;
492
516
  }
493
- let sort = context.offsets.arbitraryProperty();
517
+ let sort = context.offsets.arbitraryProperty(classCandidate);
494
518
  return [
495
519
  [
496
520
  {
@@ -550,7 +574,7 @@ function splitWithSeparator(input, separator) {
550
574
  _sharedState.NOT_ON_DEMAND
551
575
  ];
552
576
  }
553
- return (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(input, separator);
577
+ return (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, separator);
554
578
  }
555
579
  function* recordCandidates(matches, classCandidate) {
556
580
  for (const match of matches){
@@ -564,7 +588,7 @@ function* recordCandidates(matches, classCandidate) {
564
588
  yield match;
565
589
  }
566
590
  }
567
- function* resolveMatches(candidate, context, original = candidate) {
591
+ function* resolveMatches(candidate, context) {
568
592
  let separator = context.tailwindConfig.separator;
569
593
  let [classCandidate, ...variants] = splitWithSeparator(candidate, separator).reverse();
570
594
  let important = false;
@@ -572,14 +596,6 @@ function* resolveMatches(candidate, context, original = candidate) {
572
596
  important = true;
573
597
  classCandidate = classCandidate.slice(1);
574
598
  }
575
- if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping")) {
576
- if (classCandidate.startsWith("(") && classCandidate.endsWith(")")) {
577
- let base = variants.slice().reverse().join(separator);
578
- for (let part of (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(classCandidate.slice(1, -1), ",")){
579
- yield* resolveMatches(base + separator + part, context, original);
580
- }
581
- }
582
- }
583
599
  // TODO: Reintroduce this in ways that doesn't break on false positives
584
600
  // function sortAgainst(toSort, against) {
585
601
  // return toSort.slice().sort((a, z) => {
@@ -617,18 +633,18 @@ function* resolveMatches(candidate, context, original = candidate) {
617
633
  }
618
634
  }
619
635
  } else if (modifier === "DEFAULT" || modifier === "-DEFAULT") {
620
- let ruleSet1 = plugin;
621
- let [rules1, options1] = parseRules(ruleSet1, context.postCssNodeCache);
622
- for (let rule1 of rules1){
636
+ let ruleSet = plugin;
637
+ let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
638
+ for (let rule of rules){
623
639
  matchesPerPlugin.push([
624
640
  {
625
641
  ...sort,
626
642
  options: {
627
643
  ...sort.options,
628
- ...options1
644
+ ...options
629
645
  }
630
646
  },
631
- rule1
647
+ rule
632
648
  ]);
633
649
  }
634
650
  }
@@ -704,11 +720,11 @@ function* resolveMatches(candidate, context, original = candidate) {
704
720
  }
705
721
  let messages = [];
706
722
  for (let [idx, group] of typesPerPlugin.entries()){
707
- for (let type1 of group){
708
- let rules2 = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
723
+ for (let type of group){
724
+ let rules = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
709
725
  .map((line)=>line.trim()).map((x)=>` ${x}`) // Re-indent
710
726
  .join("\n")).join("\n\n");
711
- messages.push(` Use \`${candidate.replace("[", `[${type1}:`)}\` for \`${rules2.trim()}\``);
727
+ messages.push(` Use \`${candidate.replace("[", `[${type}:`)}\` for \`${rules.trim()}\``);
712
728
  break;
713
729
  }
714
730
  }
@@ -739,8 +755,7 @@ function* resolveMatches(candidate, context, original = candidate) {
739
755
  // Apply final format selector
740
756
  match = applyFinalFormat(match, {
741
757
  context,
742
- candidate,
743
- original
758
+ candidate
744
759
  });
745
760
  // Skip rules with invalid selectors
746
761
  // This will cause the candidate to be added to the "not class"
@@ -752,7 +767,7 @@ function* resolveMatches(candidate, context, original = candidate) {
752
767
  }
753
768
  }
754
769
  }
755
- function applyFinalFormat(match, { context , candidate , original }) {
770
+ function applyFinalFormat(match, { context , candidate }) {
756
771
  if (!match[0].collectedFormats) {
757
772
  return match;
758
773
  }
@@ -785,10 +800,17 @@ function applyFinalFormat(match, { context , candidate , original }) {
785
800
  return;
786
801
  }
787
802
  try {
788
- rule.selector = (0, _formatVariantSelector.finalizeSelector)(rule.selector, finalFormat, {
789
- candidate: original,
803
+ let selector = (0, _formatVariantSelector.finalizeSelector)(rule.selector, finalFormat, {
804
+ candidate,
790
805
  context
791
806
  });
807
+ // Finalize Selector determined that this candidate is irrelevant
808
+ // TODO: This elimination should happen earlier so this never happens
809
+ if (selector === null) {
810
+ rule.remove();
811
+ return;
812
+ }
813
+ rule.selector = selector;
792
814
  } catch {
793
815
  // If this selector is invalid we also want to skip it
794
816
  // But it's likely that being invalid here means there's a bug in a plugin rather than too loosely matching content
@@ -799,6 +821,10 @@ function applyFinalFormat(match, { context , candidate , original }) {
799
821
  if (!isValid) {
800
822
  return null;
801
823
  }
824
+ // If all rules have been eliminated we can skip this candidate entirely
825
+ if (container.nodes.length === 0) {
826
+ return null;
827
+ }
802
828
  match[1] = container.nodes[0];
803
829
  return match;
804
830
  }
@@ -829,7 +855,7 @@ function getImportantStrategy(important) {
829
855
  };
830
856
  }
831
857
  }
832
- function generateRules(candidates, context) {
858
+ function generateRules(candidates, context, isSorting = false) {
833
859
  let allRules = [];
834
860
  let strategy = getImportantStrategy(context.tailwindConfig.important);
835
861
  for (let candidate of candidates){
@@ -860,9 +886,11 @@ function generateRules(candidates, context) {
860
886
  container.walkRules(strategy);
861
887
  rule = container.nodes[0];
862
888
  }
889
+ // Note: We have to clone rules during sorting
890
+ // so we eliminate some shared mutable state
863
891
  let newEntry = [
864
892
  sort,
865
- rule
893
+ isSorting ? rule.clone() : rule
866
894
  ];
867
895
  rules.add(newEntry);
868
896
  context.ruleCache.add(newEntry);
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>getModuleDependencies
7
+ get: function() {
8
+ return getModuleDependencies;
9
+ }
8
10
  });
9
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
10
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
11
- function _interopRequireDefault(obj) {
11
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
+ function _interop_require_default(obj) {
12
14
  return obj && obj.__esModule ? obj : {
13
15
  default: obj
14
16
  };
@@ -59,10 +61,10 @@ function resolveWithExtension(file, extensions) {
59
61
  }
60
62
  }
61
63
  // Try to find `./a/index.js` from `./a`
62
- for (let ext1 of extensions){
63
- let full1 = `${file}/index${ext1}`;
64
- if (_fs.default.existsSync(full1)) {
65
- return full1;
64
+ for (let ext of extensions){
65
+ let full = `${file}/index${ext}`;
66
+ if (_fs.default.existsSync(full)) {
67
+ return full;
66
68
  }
67
69
  }
68
70
  return null;
@@ -2,18 +2,31 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "loadConfig", {
6
- enumerable: true,
7
- get: ()=>loadConfig
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ useCustomJiti: function() {
13
+ return useCustomJiti;
14
+ },
15
+ loadConfig: function() {
16
+ return loadConfig;
17
+ }
8
18
  });
9
- const _jiti = /*#__PURE__*/ _interopRequireDefault(require("jiti"));
19
+ const _jiti = /*#__PURE__*/ _interop_require_default(require("jiti"));
10
20
  const _sucrase = require("sucrase");
11
- function _interopRequireDefault(obj) {
21
+ function _interop_require_default(obj) {
12
22
  return obj && obj.__esModule ? obj : {
13
23
  default: obj
14
24
  };
15
25
  }
16
26
  let jiti = null;
27
+ function useCustomJiti(_jiti) {
28
+ jiti = _jiti();
29
+ }
17
30
  function lazyJiti() {
18
31
  return jiti !== null && jiti !== void 0 ? jiti : jiti = (0, _jiti.default)(__filename, {
19
32
  interopDefault: true,
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>normalizeTailwindDirectives
7
+ get: function() {
8
+ return normalizeTailwindDirectives;
9
+ }
8
10
  });
9
- const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
10
- function _interopRequireDefault(obj) {
11
+ const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
12
+ function _interop_require_default(obj) {
11
13
  return obj && obj.__esModule ? obj : {
12
14
  default: obj
13
15
  };