@@ -17,7 +17,7 @@ if (!fs.existsSync(moduleRootAbsolute)) {
17
17
}
18
18
19
19
const importRegEx = / i m p o r t \( [ " ' ] ( [ ^ " ' ] * ) [ " ' ] \) \. ( [ ^ \. \| \} > < , \) = # \n ] * ) ( [ \. \| \} > < , \) = # \n ] ) / g;
20
- const typedefRegEx = / @ t y p e d e f \{ [ ^ \} ] * \} ( [ ^ \r ? \n ? ] * ) / ;
20
+ const typedefRegEx = / @ t y p e d e f \{ [ ^ \} ] * \} ( \S * ) / ;
21
21
const noClassdescRegEx = / @ ( t y p e d e f | m o d u l e | t y p e ) / ;
22
22
const slashRegEx = / \\ / g;
23
23
@@ -201,7 +201,8 @@ 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 regex = new RegExp ( `@(event |fires |.*[\{<\|,] ?!?)${ key } ` , 'g' ) ;
204
+ const regex = new RegExp ( `@(event |fires |.*[\{<\|,] ?!?)${ key } ([}>|,\s])` , 'g' ) ;
205
+
205
206
if ( regex . test ( comment . value ) ) {
206
207
const identifier = identifiers [ key ] ;
207
208
const absolutePath = path . resolve ( path . dirname ( currentSourceName ) , identifier . value ) ;
@@ -210,7 +211,7 @@ exports.astNodeVisitor = {
210
211
const exportName = identifier . defaultImport ? getDefaultExportName ( moduleId , parser ) : key ;
211
212
const delimiter = identifier . defaultImport ? '~' : getDelimiter ( moduleId , exportName , parser ) ;
212
213
const replacement = `module:${ moduleId . replace ( slashRegEx , '/' ) } ${ exportName ? delimiter + exportName : '' } ` ;
213
- comment . value = comment . value . replace ( regex , '@$1' + replacement ) ;
214
+ comment . value = comment . value . replace ( regex , '@$1' + replacement + '$2' ) ;
214
215
}
215
216
}
216
217
} ) ;
0 commit comments