Skip to content

Commit

Permalink
fix: reduce false positives of isImported fn
Browse files Browse the repository at this point in the history
  • Loading branch information
nvlang committed Jul 17, 2024
1 parent db93a9d commit 9741f5e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ export function isImported(
componentInfo: { name: string; importPath: string },
): boolean {
return new RegExp(
`import\\s*(?:\\s${componentInfo.name}\\s|\\{\\s*default as ${componentInfo.name}\\s*\\})\\s*from\\s*['"]`,
`^\\s*import\\s*(?:\\s${componentInfo.name}\\s|\\{\\s*default as ${componentInfo.name}\\s*\\})\\s*from\\s*['"]`,
'm',
).test(script);
}

Expand Down

0 comments on commit 9741f5e

Please sign in to comment.