@@ -26,9 +26,6 @@ const fileNodes = {};
2626
2727function getModuleInfo ( moduleId , parser ) {
2828 if ( ! moduleInfos [ moduleId ] ) {
29- const moduleInfo = moduleInfos [ moduleId ] = {
30- namedExports : { }
31- } ;
3229 if ( ! fileNodes [ moduleId ] ) {
3330 const absolutePath = path . join ( process . cwd ( ) , moduleRoot , moduleId + '.js' ) ;
3431 if ( ! fs . existsSync ( absolutePath ) ) {
@@ -37,6 +34,9 @@ function getModuleInfo(moduleId, parser) {
3734 const file = fs . readFileSync ( absolutePath , 'UTF-8' ) ;
3835 fileNodes [ moduleId ] = parser . astBuilder . build ( file , absolutePath ) ;
3936 }
37+ const moduleInfo = moduleInfos [ moduleId ] = {
38+ namedExports : { }
39+ } ;
4040 const node = fileNodes [ moduleId ] ;
4141 if ( node . program && node . program . body ) {
4242 const classDeclarations = { } ;
@@ -201,10 +201,10 @@ exports.astNodeVisitor = {
201201 node . comments . forEach ( comment => {
202202 // Replace local types with the full `module:` path
203203 Object . keys ( identifiers ) . forEach ( key => {
204- const eventRegex = new RegExp ( `@(event |fires )${ key } (\\s* )` , 'g' ) ;
204+ const eventRegex = new RegExp ( `@(event |fires )${ key } ([^A-Za-z] )` , 'g' ) ;
205205 replace ( eventRegex ) ;
206206
207- const typeRegex = new RegExp ( `@(.*[{<|,]\\s*[!?]? )${ key } (=?\\s*[}>|,] )` , 'g' ) ;
207+ const typeRegex = new RegExp ( `@(.*[{<|,(!?: ]\\s*)${ key } ([A-Za-z].*?\}|\} )` , 'g' ) ;
208208 replace ( typeRegex ) ;
209209
210210 function replace ( regex ) {
0 commit comments