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.
This commit is contained in:
Jordan Pittman 2023-08-21 11:01:19 -04:00
parent 9fcfea47a6
commit 9a52f90fe9
4 changed files with 6 additions and 292 deletions

View file

@ -17,11 +17,7 @@ export let featureFlags = {
'relativeContentPathsByDefault',
'logicalSiblingUtilities',
],
experimental: [
'optimizeUniversalDefaults',
'oxideParser',
// 'variantGrouping',
],
experimental: ['optimizeUniversalDefaults', 'oxideParser'],
}
export function flagEnabled(config, flag) {

View file

@ -21,7 +21,6 @@ export function defaultExtractor(context) {
function* buildRegExps(context) {
let separator = context.tailwindConfig.separator
let variantGroupingEnabled = flagEnabled(context.tailwindConfig, 'variantGrouping')
let prefix =
context.tailwindConfig.prefix !== ''
? regex.optional(regex.pattern([/-?/, regex.escape(context.tailwindConfig.prefix)]))
@ -103,15 +102,7 @@ function* buildRegExps(context) {
prefix,
variantGroupingEnabled
? regex.any([
// Or any of those things but grouped separated by commas
regex.pattern([/\(/, utility, regex.zeroOrMore([/,/, utility]), /\)/]),
// Arbitrary properties, constrained utilities, arbitrary values, etc…
utility,
])
: utility,
utility,
])
}

View file

@ -569,7 +569,7 @@ function* recordCandidates(matches, classCandidate) {
}
}
function* resolveMatches(candidate, context, original = candidate) {
function* resolveMatches(candidate, context) {
let separator = context.tailwindConfig.separator
let [classCandidate, ...variants] = splitWithSeparator(candidate, separator).reverse()
let important = false
@ -579,15 +579,6 @@ function* resolveMatches(candidate, context, original = candidate) {
classCandidate = classCandidate.slice(1)
}
if (flagEnabled(context.tailwindConfig, 'variantGrouping')) {
if (classCandidate.startsWith('(') && classCandidate.endsWith(')')) {
let base = variants.slice().reverse().join(separator)
for (let part of splitAtTopLevelOnly(classCandidate.slice(1, -1), ',')) {
yield* resolveMatches(base + separator + part, context, original)
}
}
}
// TODO: Reintroduce this in ways that doesn't break on false positives
// function sortAgainst(toSort, against) {
// return toSort.slice().sort((a, z) => {
@ -776,7 +767,7 @@ function* resolveMatches(candidate, context, original = candidate) {
match[1].raws.tailwind = { ...match[1].raws.tailwind, candidate }
// Apply final format selector
match = applyFinalFormat(match, { context, candidate, original })
match = applyFinalFormat(match, { context, candidate })
// Skip rules with invalid selectors
// This will cause the candidate to be added to the "not class"
@ -790,7 +781,7 @@ function* resolveMatches(candidate, context, original = candidate) {
}
}
function applyFinalFormat(match, { context, candidate, original }) {
function applyFinalFormat(match, { context, candidate }) {
if (!match[0].collectedFormats) {
return match
}
@ -801,7 +792,7 @@ function applyFinalFormat(match, { context, candidate, original }) {
try {
finalFormat = formatVariantSelector(match[0].collectedFormats, {
context,
candidate: original,
candidate,
})
} catch {
// The format selector we produced is invalid