Skip to content

Commit

Permalink
fix(components): improve graph relationship filtering, close #192
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed May 16, 2023
1 parent dce9968 commit c27f80b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/devtools/src/integrations/vite-inspect.ts
Expand Up @@ -27,7 +27,13 @@ export async function setup({ nuxt, rpc }: NuxtDevtoolsServerContext) {

async function getComponentsRelationships() {
const modules = (await api?.rpc.list())?.modules || []
const vueModules = modules.filter(i => i.id.match(/\.vue($|\?v=)/))
const components = await rpc.functions.getComponents() || []
const vueModules = modules.filter((m) => {
const plainId = m.id.replace(/\?v=[\w\d]+$/, '')
if (components.some(c => c.filePath === plainId))
return true
return m.id.match(/\.vue($|\?v=)/)
})

const graph = vueModules.map((i) => {
function searchForVueDeps(id: string, seen = new Set<string>()): string[] {
Expand Down

0 comments on commit c27f80b

Please sign in to comment.