@@ -20,58 +20,6 @@ import log from '../util/log'
20
20
import negateValue from '../util/negateValue'
21
21
import isValidArbitraryValue from '../util/isValidArbitraryValue'
22
22
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
-
75
23
function parseVariantFormatString ( input ) {
76
24
if ( input . includes ( '{' ) ) {
77
25
if ( ! isBalanced ( input ) ) throw new Error ( `Your { and } are unbalanced.` )
@@ -284,9 +232,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
284
232
context . candidateRuleMap . set ( identifier , [ ] )
285
233
}
286
234
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 ] )
290
236
}
291
237
} ,
292
238
addBase ( base ) {
@@ -300,7 +246,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
300
246
301
247
context . candidateRuleMap
302
248
. get ( prefixedIdentifier )
303
- . push ( ... partitionRules ( rule ) . map ( ( rule ) => [ { sort : offset , layer : 'base' } , rule ] ) )
249
+ . push ( [ { sort : offset , layer : 'base' } , rule ] )
304
250
}
305
251
} ,
306
252
/**
@@ -321,12 +267,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
321
267
322
268
context . candidateRuleMap
323
269
. 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 ] )
330
271
}
331
272
} ,
332
273
addComponents ( components , options ) {
@@ -348,12 +289,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
348
289
349
290
context . candidateRuleMap
350
291
. 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 ] )
357
293
}
358
294
} ,
359
295
addUtilities ( utilities , options ) {
@@ -375,12 +311,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
375
311
376
312
context . candidateRuleMap
377
313
. 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 ] )
384
315
}
385
316
} ,
386
317
matchUtilities : function ( utilities , options ) {
0 commit comments