@@ -8416,7 +8416,6 @@ const notEndingWith = ['(', '['].concat(combinators);
84168416// @ts -ignore
84178417const features = Object . values ( allFeatures ) . sort ( ( a , b ) => a . ordering - b . ordering ) ;
84188418function minify ( ast , options = { } , recursive = false , errors , nestingContent , context = { } ) {
8419- // console.debug(JSON.stringify({ast}, null, 1));
84208419 if ( ! ( 'nodes' in context ) ) {
84218420 context . nodes = new Set ;
84228421 }
@@ -8447,7 +8446,7 @@ function minify(ast, options = {}, recursive = false, errors, nestingContent, co
84478446 curr . splice ( 0 , 2 ) ;
84488447 }
84498448 else if ( combinators . includes ( curr [ 1 ] ) ) {
8450- curr . splice ( 0 , 1 ) ;
8449+ curr . shift ( ) ;
84518450 }
84528451 }
84538452 else if ( ast . typ == exports . EnumToken . RuleNodeType && ( isIdent ( curr [ 0 ] ) || isFunction ( curr [ 0 ] ) ) ) {
@@ -8824,19 +8823,24 @@ function reduceSelector(selector) {
88248823 // combinator
88258824 if ( combinators . includes ( optimized . at ( - 1 ) ) ) {
88268825 const combinator = optimized . pop ( ) ;
8827- selector . forEach ( selector => selector . unshift ( combinator ) ) ;
8826+ selector . forEach ( ( selector ) => selector . unshift ( combinator ) ) ;
88288827 }
88298828 let reducible = optimized . length == 1 ;
8830- if ( optimized [ 0 ] == '&' && optimized [ 1 ] == ' ' ) {
8831- optimized . splice ( 0 , 2 ) ;
8829+ if ( optimized [ 0 ] == '&' ) {
8830+ if ( optimized [ 1 ] == ' ' ) {
8831+ optimized . splice ( 0 , 2 ) ;
8832+ }
8833+ // else if (combinators.includes(optimized[1])) {
8834+ //
8835+ // }
88328836 }
88338837 if ( optimized . length == 0 ||
88348838 ( optimized [ 0 ] . charAt ( 0 ) == '&' ||
88358839 selector . length == 1 ) ) {
88368840 return {
88378841 match : false ,
88388842 optimized,
8839- selector : selector . map ( selector => selector [ 0 ] == '&' && selector [ 1 ] == ' ' ? selector . slice ( 2 ) : selector ) ,
8843+ selector : selector . map ( ( selector ) => selector [ 0 ] == '&' && selector [ 1 ] == ' ' ? selector . slice ( 2 ) : ( selector ) ) ,
88408844 reducible : selector . length > 1 && selector . every ( ( selector ) => ! combinators . includes ( selector [ 0 ] ) )
88418845 } ;
88428846 }
@@ -8846,7 +8850,7 @@ function reduceSelector(selector) {
88468850 selector : selector . reduce ( ( acc , curr ) => {
88478851 let hasCompound = true ;
88488852 if ( hasCompound && curr . length > 0 ) {
8849- hasCompound = ! [ '&' ] . concat ( combinators ) . includes ( curr [ 0 ] . charAt ( 0 ) ) ;
8853+ hasCompound = ':' != curr [ 0 ] || ! [ '&' ] . concat ( combinators ) . includes ( curr [ 0 ] . charAt ( 0 ) ) ;
88508854 }
88518855 // @ts -ignore
88528856 if ( hasCompound && curr [ 0 ] == ' ' ) {
@@ -9335,6 +9339,11 @@ function reduceRuleSelector(node) {
93359339 Object . defineProperty ( node , 'optimized' , { ...definedPropertySettings , value : optimized } ) ;
93369340 }
93379341 if ( optimized != null && optimized . match && optimized . reducible && optimized . selector . length > 1 ) {
9342+ for ( const selector of optimized . selector ) {
9343+ if ( selector . length > 1 && selector [ 0 ] == '&' && combinators . includes ( selector [ 1 ] ) ) {
9344+ selector . shift ( ) ;
9345+ }
9346+ }
93389347 const raw = [
93399348 [
93409349 optimized . optimized [ 0 ] , ':is('
0 commit comments