Skip to content

Commit 9a52f90

Browse files
committed
Remove grouping prototype
This code has been sitting around for a while disabled and untested. And it does not work with the Oxide parser. So we’re gonna remove it.
1 parent 9fcfea4 commit 9a52f90

File tree

4 files changed

+6
-292
lines changed

4 files changed

+6
-292
lines changed

src/featureFlags.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ export let featureFlags = {
1717
'relativeContentPathsByDefault',
1818
'logicalSiblingUtilities',
1919
],
20-
experimental: [
21-
'optimizeUniversalDefaults',
22-
'oxideParser',
23-
// 'variantGrouping',
24-
],
20+
experimental: ['optimizeUniversalDefaults', 'oxideParser'],
2521
}
2622

2723
export function flagEnabled(config, flag) {

src/lib/defaultExtractor.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export function defaultExtractor(context) {
2121

2222
function* buildRegExps(context) {
2323
let separator = context.tailwindConfig.separator
24-
let variantGroupingEnabled = flagEnabled(context.tailwindConfig, 'variantGrouping')
2524
let prefix =
2625
context.tailwindConfig.prefix !== ''
2726
? regex.optional(regex.pattern([/-?/, regex.escape(context.tailwindConfig.prefix)]))
@@ -103,15 +102,7 @@ function* buildRegExps(context) {
103102

104103
prefix,
105104

106-
variantGroupingEnabled
107-
? regex.any([
108-
// Or any of those things but grouped separated by commas
109-
regex.pattern([/\(/, utility, regex.zeroOrMore([/,/, utility]), /\)/]),
110-
111-
// Arbitrary properties, constrained utilities, arbitrary values, etc…
112-
utility,
113-
])
114-
: utility,
105+
utility,
115106
])
116107
}
117108

src/lib/generateRules.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ function* recordCandidates(matches, classCandidate) {
569569
}
570570
}
571571

572-
function* resolveMatches(candidate, context, original = candidate) {
572+
function* resolveMatches(candidate, context) {
573573
let separator = context.tailwindConfig.separator
574574
let [classCandidate, ...variants] = splitWithSeparator(candidate, separator).reverse()
575575
let important = false
@@ -579,15 +579,6 @@ function* resolveMatches(candidate, context, original = candidate) {
579579
classCandidate = classCandidate.slice(1)
580580
}
581581

582-
if (flagEnabled(context.tailwindConfig, 'variantGrouping')) {
583-
if (classCandidate.startsWith('(') && classCandidate.endsWith(')')) {
584-
let base = variants.slice().reverse().join(separator)
585-
for (let part of splitAtTopLevelOnly(classCandidate.slice(1, -1), ',')) {
586-
yield* resolveMatches(base + separator + part, context, original)
587-
}
588-
}
589-
}
590-
591582
// TODO: Reintroduce this in ways that doesn't break on false positives
592583
// function sortAgainst(toSort, against) {
593584
// return toSort.slice().sort((a, z) => {
@@ -776,7 +767,7 @@ function* resolveMatches(candidate, context, original = candidate) {
776767
match[1].raws.tailwind = { ...match[1].raws.tailwind, candidate }
777768

778769
// Apply final format selector
779-
match = applyFinalFormat(match, { context, candidate, original })
770+
match = applyFinalFormat(match, { context, candidate })
780771

781772
// Skip rules with invalid selectors
782773
// This will cause the candidate to be added to the "not class"
@@ -790,7 +781,7 @@ function* resolveMatches(candidate, context, original = candidate) {
790781
}
791782
}
792783

793-
function applyFinalFormat(match, { context, candidate, original }) {
784+
function applyFinalFormat(match, { context, candidate }) {
794785
if (!match[0].collectedFormats) {
795786
return match
796787
}
@@ -801,7 +792,7 @@ function applyFinalFormat(match, { context, candidate, original }) {
801792
try {
802793
finalFormat = formatVariantSelector(match[0].collectedFormats, {
803794
context,
804-
candidate: original,
795+
candidate,
805796
})
806797
} catch {
807798
// The format selector we produced is invalid

tests/variant-grouping.test.skip.js

Lines changed: 0 additions & 264 deletions
This file was deleted.

0 commit comments

Comments
 (0)