File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -1015,7 +1015,7 @@ export default class Component {
10151015 let scope = instance_scope ;
10161016
10171017 walk ( this . ast . instance . content , {
1018- enter ( node : Node ) {
1018+ enter ( node : Node , parent : Node , key , index ) {
10191019 if ( regex_contains_term_function . test ( node . type ) ) {
10201020 return this . skip ( ) ;
10211021 }
@@ -1138,11 +1138,16 @@ export default class Component {
11381138 }
11391139 }
11401140
1141- this . replace ( b `
1142- ${ node . declarations . length ? node : null }
1143- ${ props . length > 0 && b `let { ${ props } } = $$props;` }
1144- ${ inserts }
1145- ` as any ) ;
1141+ if ( inserts . length > 0 ) {
1142+ parent [ key ] . splice ( index + 1 , 0 , ...inserts ) ;
1143+ }
1144+ if ( props . length > 0 ) {
1145+ parent [ key ] . splice ( index + 1 , 0 , b `let { ${ props } } = $$props;` ) ;
1146+ }
1147+ if ( node . declarations . length == 0 ) {
1148+ parent [ key ] . splice ( index , 1 ) ;
1149+ }
1150+
11461151 return this . skip ( ) ;
11471152 }
11481153 }
You can’t perform that action at this time.
0 commit comments