From 297cb675dfa8cc8722270529a37c31010eb2ff8c Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Fri, 30 Apr 2021 11:38:23 -0400 Subject: [PATCH] Remove support for returning an array of functions in matchUtilities Can add again if we need it? --- src/jit/lib/setupContext.js | 12 ++++++------ src/plugins/animation.js | 24 +++++++++++------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/jit/lib/setupContext.js b/src/jit/lib/setupContext.js index c4bf0cbe4..2b872cf0a 100644 --- a/src/jit/lib/setupContext.js +++ b/src/jit/lib/setupContext.js @@ -518,15 +518,15 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs for (let identifier in base) { let prefixedIdentifier = prefixIdentifier(identifier, options) - let value = [].concat(base[identifier]) + let rule = base[identifier] - let withOffsets = value.map((rule) => [{ sort: offset, layer: 'base' }, rule]) + let withOffsets = [{ sort: offset, layer: 'base' }, rule] if (!context.candidateRuleMap.has(prefixedIdentifier)) { context.candidateRuleMap.set(prefixedIdentifier, []) } - context.candidateRuleMap.get(prefixedIdentifier).push(...withOffsets) + context.candidateRuleMap.get(prefixedIdentifier).push(withOffsets) } }, matchUtilities: function (utilities, options) { @@ -543,15 +543,15 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs for (let identifier in utilities) { let prefixedIdentifier = prefixIdentifier(identifier, options) - let value = [].concat(utilities[identifier]) + let rule = utilities[identifier] - let withOffsets = value.map((rule) => [{ sort: offset, layer: 'utilities', options }, rule]) + let withOffsets = [{ sort: offset, layer: 'utilities', options }, rule] if (!context.candidateRuleMap.has(prefixedIdentifier)) { context.candidateRuleMap.set(prefixedIdentifier, []) } - context.candidateRuleMap.get(prefixedIdentifier).push(...withOffsets) + context.candidateRuleMap.get(prefixedIdentifier).push(withOffsets) } }, // --- diff --git a/src/plugins/animation.js b/src/plugins/animation.js index 0a055fe28..64f47f7f7 100644 --- a/src/plugins/animation.js +++ b/src/plugins/animation.js @@ -20,22 +20,20 @@ export default function () { ) matchUtilities({ - animate: [ - (modifier, { theme }) => { - let value = theme.animation[modifier] + animate: (modifier, { theme }) => { + let value = theme.animation[modifier] - if (value === undefined) { - return [] - } + if (value === undefined) { + return [] + } - let { name: animationName } = parseAnimationValue(value) + let { name: animationName } = parseAnimationValue(value) - return [ - keyframes[animationName], - { [nameClass('animate', modifier)]: { animation: value } }, - ].filter(Boolean) - }, - ], + return [ + keyframes[animationName], + { [nameClass('animate', modifier)]: { animation: value } }, + ].filter(Boolean) + }, }) } else { const prefixName = (name) => prefix(`.${name}`).slice(1)