@@ -179,6 +179,7 @@ const vueTemplateRegex = /(<template.*>)([\s\S]*)(<\/template>)/ig;
179179const vueCommentRegex = / < \! - - [ \s \S ] * ?- - > / ig;
180180const vueBindRegex = / ( : \[ ) ( [ \S ] * ?) ( \] ) / ig;
181181const vuePropRegex = / \s ( [ . : @ ] ) ( [ \S ] * ?= ) / ig;
182+ const vueOpenImgTag = / ( < i m g ) ( (? ! > ) [ \s \S ] + ?) ( [ ^ \/ ] > ) / ig;
182183
183184/**
184185 * Convert a single vue file to AST
@@ -200,7 +201,10 @@ const toVueAst = (file) => {
200201 . replace ( vueTemplateRegex , function ( match , grA , grB , grC ) {
201202 return grA +
202203 grB . replace ( vuePropRegex , function ( match , grA , grB ) {
203- return " " + grA . replace ( / [ . : @ ] / g, " " ) + grB . replaceAll ( "." , "-" )
204+ return " " + grA . replace ( / [ . : @ ] / g, " " ) + grB . replaceAll ( "." , "-" )
205+ } )
206+ . replace ( vueOpenImgTag , function ( match , grA , grB , grC ) {
207+ return grA + grB + grC . replace ( " >" , "/>" )
204208 } )
205209 . replaceAll ( "{{" , "{ " )
206210 . replaceAll ( "}}" , " }" ) +
@@ -327,7 +331,7 @@ const createJSAst = async (options) => {
327331 * Generate AST for .vue files
328332 */
329333const createVueAst = async ( options ) => {
330- const srcFiles = getAllFiles ( options . src , ".vue" ) ;
334+ const srcFiles = await getAllFiles ( options . src , ".vue" ) ;
331335 for ( const file of srcFiles ) {
332336 try {
333337 const ast = toVueAst ( file ) ;
0 commit comments