@@ -1499,14 +1499,23 @@ export function findTargetClassNameNodesForHtml(
14991499 */
15001500 const classNameNodes : ClassNameNode [ ] = [ ] ;
15011501
1502- function recursion ( node : unknown , parentNode ?: { type ?: unknown } ) : void {
1503- if ( ! isTypeof ( node , z . object ( { type : z . string ( ) } ) ) ) {
1502+ function recursion (
1503+ node : unknown ,
1504+ parentNode ?: { kind : string ; type ?: undefined } | { kind ?: undefined ; type : string } ,
1505+ ) : void {
1506+ if (
1507+ ! isTypeof ( node , z . object ( { kind : z . string ( ) } ) ) &&
1508+ ! isTypeof ( node , z . object ( { type : z . string ( ) } ) )
1509+ ) {
15041510 return ;
15051511 }
15061512
1513+ const nodeType = isTypeof ( node , z . object ( { kind : z . string ( ) } ) ) ? node . kind : node . type ;
1514+ const parentNodeType = parentNode ?. kind ?? parentNode ?. type ;
1515+
15071516 let recursiveProps : string [ ] = [ ] ;
15081517
1509- switch ( node . type ) {
1518+ switch ( nodeType ) {
15101519 case 'element' : {
15111520 recursiveProps = [ 'attrs' , 'children' ] ;
15121521 break ;
@@ -1558,11 +1567,11 @@ export function findTargetClassNameNodesForHtml(
15581567 node . sourceSpan . end . offset ,
15591568 ] ;
15601569 const currentASTNode : ASTNode = {
1561- type : node . type ,
1570+ type : nodeType ,
15621571 range : [ currentNodeRangeStart , currentNodeRangeEnd ] ,
15631572 } ;
15641573
1565- switch ( node . type ) {
1574+ switch ( nodeType ) {
15661575 case 'attribute' : {
15671576 nonCommentNodes . push ( currentASTNode ) ;
15681577
@@ -1578,7 +1587,7 @@ export function findTargetClassNameNodesForHtml(
15781587 name : z . string ( ) ,
15791588 } ) ,
15801589 ) &&
1581- parentNode . type === 'element' &&
1590+ parentNodeType === 'element' &&
15821591 isTypeof (
15831592 node ,
15841593 z . object ( {
@@ -1779,14 +1788,23 @@ export function findTargetClassNameNodesForVue(
17791788 */
17801789 const classNameNodes : ClassNameNode [ ] = [ ] ;
17811790
1782- function recursion ( node : unknown , parentNode ?: { type ?: unknown } ) : void {
1783- if ( ! isTypeof ( node , z . object ( { type : z . string ( ) } ) ) ) {
1791+ function recursion (
1792+ node : unknown ,
1793+ parentNode ?: { kind : string ; type ?: undefined } | { kind ?: undefined ; type : string } ,
1794+ ) : void {
1795+ if (
1796+ ! isTypeof ( node , z . object ( { kind : z . string ( ) } ) ) &&
1797+ ! isTypeof ( node , z . object ( { type : z . string ( ) } ) )
1798+ ) {
17841799 return ;
17851800 }
17861801
1802+ const nodeType = isTypeof ( node , z . object ( { kind : z . string ( ) } ) ) ? node . kind : node . type ;
1803+ const parentNodeType = parentNode ?. kind ?? parentNode ?. type ;
1804+
17871805 let recursiveProps : string [ ] = [ ] ;
17881806
1789- switch ( node . type ) {
1807+ switch ( nodeType ) {
17901808 case 'element' : {
17911809 recursiveProps = [ 'attrs' , 'children' ] ;
17921810 break ;
@@ -1838,11 +1856,11 @@ export function findTargetClassNameNodesForVue(
18381856 node . sourceSpan . end . offset ,
18391857 ] ;
18401858 const currentASTNode : ASTNode = {
1841- type : node . type ,
1859+ type : nodeType ,
18421860 range : [ currentNodeRangeStart , currentNodeRangeEnd ] ,
18431861 } ;
18441862
1845- switch ( node . type ) {
1863+ switch ( nodeType ) {
18461864 case 'attribute' : {
18471865 nonCommentNodes . push ( currentASTNode ) ;
18481866
@@ -1860,7 +1878,7 @@ export function findTargetClassNameNodesForVue(
18601878 name : z . string ( ) ,
18611879 } ) ,
18621880 ) &&
1863- parentNode . type === 'element' &&
1881+ parentNodeType === 'element' &&
18641882 isTypeof (
18651883 node ,
18661884 z . object ( {
@@ -2074,14 +2092,23 @@ export function findTargetClassNameNodesForAngular(
20742092 */
20752093 const classNameNodes : ClassNameNode [ ] = [ ] ;
20762094
2077- function recursion ( node : unknown , parentNode ?: { type ?: unknown } ) : void {
2078- if ( ! isTypeof ( node , z . object ( { type : z . string ( ) } ) ) ) {
2095+ function recursion (
2096+ node : unknown ,
2097+ parentNode ?: { kind : string ; type ?: undefined } | { kind ?: undefined ; type : string } ,
2098+ ) : void {
2099+ if (
2100+ ! isTypeof ( node , z . object ( { kind : z . string ( ) } ) ) &&
2101+ ! isTypeof ( node , z . object ( { type : z . string ( ) } ) )
2102+ ) {
20792103 return ;
20802104 }
20812105
2106+ const nodeType = isTypeof ( node , z . object ( { kind : z . string ( ) } ) ) ? node . kind : node . type ;
2107+ const parentNodeType = parentNode ?. kind ?? parentNode ?. type ;
2108+
20822109 let recursiveProps : string [ ] = [ ] ;
20832110
2084- switch ( node . type ) {
2111+ switch ( nodeType ) {
20852112 case 'angularControlFlowBlock' :
20862113 case 'root' : {
20872114 recursiveProps = [ 'children' ] ;
@@ -2134,11 +2161,11 @@ export function findTargetClassNameNodesForAngular(
21342161 node . sourceSpan . end . offset ,
21352162 ] ;
21362163 const currentASTNode : ASTNode = {
2137- type : node . type ,
2164+ type : nodeType ,
21382165 range : [ currentNodeRangeStart , currentNodeRangeEnd ] ,
21392166 } ;
21402167
2141- switch ( node . type ) {
2168+ switch ( nodeType ) {
21422169 case 'attribute' : {
21432170 nonCommentNodes . push ( currentASTNode ) ;
21442171
@@ -2156,7 +2183,7 @@ export function findTargetClassNameNodesForAngular(
21562183 name : z . string ( ) ,
21572184 } ) ,
21582185 ) &&
2159- parentNode . type === 'element' &&
2186+ parentNodeType === 'element' &&
21602187 isTypeof (
21612188 node ,
21622189 z . object ( {
0 commit comments