Skip to content

Commit afd3923

Browse files
authored
Merge pull request #9 from KlausBenndorf/fix-local-types-conversion
fix local type paths replacement
2 parents b10398a + 3af3f14 commit afd3923

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ exports.astNodeVisitor = {
199199

200200
// Replace local types with the full `module:` path
201201
Object.keys(identifiers).forEach(key => {
202-
const regex = new RegExp(`(@event |@fires |[\{<\|,] ?!?)${key}`, 'g');
202+
const regex = new RegExp(`@(event |fires |.*[\{<\|,] ?!?)${key}`, 'g');
203203
if (regex.test(comment.value)) {
204204
const identifier = identifiers[key];
205205
const absolutePath = path.resolve(path.dirname(currentSourceName), identifier.value);
@@ -208,7 +208,7 @@ exports.astNodeVisitor = {
208208
const exportName = identifier.defaultImport ? getDefaultExportName(moduleId, parser) : key;
209209
const delimiter = identifier.defaultImport ? '~' : getDelimiter(moduleId, exportName, parser);
210210
const replacement = `module:${moduleId.replace(slashRegEx, '/')}${exportName ? delimiter + exportName : ''}`;
211-
comment.value = comment.value.replace(regex, '$1' + replacement);
211+
comment.value = comment.value.replace(regex, '@$1' + replacement);
212212
}
213213
}
214214
});

0 commit comments

Comments
 (0)