@@ -20,58 +20,6 @@ import log from '../util/log'
2020import negateValue from '../util/negateValue'
2121import isValidArbitraryValue from '../util/isValidArbitraryValue'
2222
23- function partitionRules ( root ) {
24- if ( ! root . walkAtRules ) return [ root ]
25-
26- let applyParents = new Set ( )
27- let rules = [ ]
28-
29- root . walkAtRules ( 'apply' , ( rule ) => {
30- applyParents . add ( rule . parent )
31- } )
32-
33- if ( applyParents . size === 0 ) {
34- rules . push ( root )
35- }
36-
37- for ( let rule of applyParents ) {
38- let nodeGroups = [ ]
39- let lastGroup = [ ]
40-
41- for ( let node of rule . nodes ) {
42- if ( node . type === 'atrule' && node . name === 'apply' ) {
43- if ( lastGroup . length > 0 ) {
44- nodeGroups . push ( lastGroup )
45- lastGroup = [ ]
46- }
47- nodeGroups . push ( [ node ] )
48- } else {
49- lastGroup . push ( node )
50- }
51- }
52-
53- if ( lastGroup . length > 0 ) {
54- nodeGroups . push ( lastGroup )
55- }
56-
57- if ( nodeGroups . length === 1 ) {
58- rules . push ( rule )
59- continue
60- }
61-
62- for ( let group of [ ...nodeGroups ] . reverse ( ) ) {
63- let clone = rule . clone ( { nodes : [ ] } )
64- clone . append ( group )
65- rules . unshift ( clone )
66- rule . after ( clone )
67- }
68-
69- rule . remove ( )
70- }
71-
72- return rules
73- }
74-
7523function parseVariantFormatString ( input ) {
7624 if ( input . includes ( '{' ) ) {
7725 if ( ! isBalanced ( input ) ) throw new Error ( `Your { and } are unbalanced.` )
@@ -284,9 +232,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
284232 context . candidateRuleMap . set ( identifier , [ ] )
285233 }
286234
287- context . candidateRuleMap
288- . get ( identifier )
289- . push ( ...partitionRules ( rule ) . map ( ( rule ) => [ { sort : offset , layer : 'user' } , rule ] ) )
235+ context . candidateRuleMap . get ( identifier ) . push ( [ { sort : offset , layer : 'user' } , rule ] )
290236 }
291237 } ,
292238 addBase ( base ) {
@@ -300,7 +246,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
300246
301247 context . candidateRuleMap
302248 . get ( prefixedIdentifier )
303- . push ( ... partitionRules ( rule ) . map ( ( rule ) => [ { sort : offset , layer : 'base' } , rule ] ) )
249+ . push ( [ { sort : offset , layer : 'base' } , rule ] )
304250 }
305251 } ,
306252 /**
@@ -321,12 +267,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
321267
322268 context . candidateRuleMap
323269 . get ( prefixedIdentifier )
324- . push (
325- ...partitionRules ( rule ) . map ( ( rule ) => [
326- { sort : offsets . base ++ , layer : 'defaults' } ,
327- rule ,
328- ] )
329- )
270+ . push ( [ { sort : offsets . base ++ , layer : 'defaults' } , rule ] )
330271 }
331272 } ,
332273 addComponents ( components , options ) {
@@ -348,12 +289,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
348289
349290 context . candidateRuleMap
350291 . get ( prefixedIdentifier )
351- . push (
352- ...partitionRules ( rule ) . map ( ( rule ) => [
353- { sort : offsets . components ++ , layer : 'components' , options } ,
354- rule ,
355- ] )
356- )
292+ . push ( [ { sort : offsets . components ++ , layer : 'components' , options } , rule ] )
357293 }
358294 } ,
359295 addUtilities ( utilities , options ) {
@@ -375,12 +311,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
375311
376312 context . candidateRuleMap
377313 . get ( prefixedIdentifier )
378- . push (
379- ...partitionRules ( rule ) . map ( ( rule ) => [
380- { sort : offsets . utilities ++ , layer : 'utilities' , options } ,
381- rule ,
382- ] )
383- )
314+ . push ( [ { sort : offsets . utilities ++ , layer : 'utilities' , options } , rule ] )
384315 }
385316 } ,
386317 matchUtilities : function ( utilities , options ) {
0 commit comments