@@ -26,9 +26,6 @@ const fileNodes = {};
26
26
27
27
function getModuleInfo ( moduleId , parser ) {
28
28
if ( ! moduleInfos [ moduleId ] ) {
29
- const moduleInfo = moduleInfos [ moduleId ] = {
30
- namedExports : { }
31
- } ;
32
29
if ( ! fileNodes [ moduleId ] ) {
33
30
const absolutePath = path . join ( process . cwd ( ) , moduleRoot , moduleId + '.js' ) ;
34
31
if ( ! fs . existsSync ( absolutePath ) ) {
@@ -37,6 +34,9 @@ function getModuleInfo(moduleId, parser) {
37
34
const file = fs . readFileSync ( absolutePath , 'UTF-8' ) ;
38
35
fileNodes [ moduleId ] = parser . astBuilder . build ( file , absolutePath ) ;
39
36
}
37
+ const moduleInfo = moduleInfos [ moduleId ] = {
38
+ namedExports : { }
39
+ } ;
40
40
const node = fileNodes [ moduleId ] ;
41
41
if ( node . program && node . program . body ) {
42
42
const classDeclarations = { } ;
@@ -201,10 +201,10 @@ exports.astNodeVisitor = {
201
201
node . comments . forEach ( comment => {
202
202
// Replace local types with the full `module:` path
203
203
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' ) ;
205
205
replace ( eventRegex ) ;
206
206
207
- const typeRegex = new RegExp ( `@(.*[{<|,]\\s*[!?]? )${ key } (=?\\s*[}>|,] )` , 'g' ) ;
207
+ const typeRegex = new RegExp ( `@(.*[{<|,(!?: ]\\s*)${ key } ([A-Za-z].*?\}|\} )` , 'g' ) ;
208
208
replace ( typeRegex ) ;
209
209
210
210
function replace ( regex ) {
0 commit comments