MCPcopy
hub / github.com/vitejs/vite / getModulesEntrypoints

Function getModulesEntrypoints

packages/vite/src/module-runner/hmrHandler.ts:97–119  ·  view source on GitHub ↗
(
  runner: ModuleRunner,
  modules: string[],
  visited = new Set<string>(),
  entrypoints = new Set<string>(),
)

Source from the content-addressed store, hash-verified

95}
96
97function getModulesEntrypoints(
98 runner: ModuleRunner,
99 modules: string[],
100 visited = new Set<string>(),
101 entrypoints = new Set<string>(),
102) {
103 for (const moduleId of modules) {
104 if (visited.has(moduleId)) continue
105 visited.add(moduleId)
106 const module = runner.evaluatedModules.getModuleById(moduleId)
107 if (!module) {
108 continue
109 }
110 if (!module.importers.size) {
111 entrypoints.add(module.url)
112 continue
113 }
114 for (const importer of module.importers) {
115 getModulesEntrypoints(runner, [importer], visited, entrypoints)
116 }
117 }
118 return entrypoints
119}
120
121function findAllEntrypoints(
122 runner: ModuleRunner,

Callers 1

Calls 3

hasMethod · 0.80
addMethod · 0.80
getModuleByIdMethod · 0.45

Tested by

no test coverage detected