There was an error while loading. Please reload this page.
1 parent 2d417ea commit 69f71baCopy full SHA for 69f71ba
1 file changed
packages/vite/src/rpc/graph.ts
@@ -24,7 +24,30 @@ export function getGraphFunctions(ctx: RpcFunctionCtx) {
24
})
25
: null
26
) || []
27
- return modules
+ const filteredModules = modules.filter((m) => {
28
+ return m.id.match(/\.(vue|js|ts|jsx|tsx|html|json)($|\?v=)/)
29
+ })
30
+ const graph = filteredModules.map((i) => {
31
+ function searchForVueDeps(id: string, seen = new Set<string>()): string[] {
32
+ if (seen.has(id))
33
+ return []
34
+ seen.add(id)
35
+ const module = modules.find(m => m.id === id)
36
+ if (!module)
37
38
+ return module.deps.flatMap((i) => {
39
+ if (filteredModules.find(m => m.id === i))
40
+ return [i]
41
+ return searchForVueDeps(i, seen)
42
43
+ }
44
+
45
+ return {
46
+ id: i.id,
47
+ deps: searchForVueDeps(i.id),
48
49
50
+ return graph
51
},
52
}
53
0 commit comments