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

Method isCircularRequest

packages/vite/src/module-runner/runner.ts:136–163  ·  view source on GitHub ↗
(
    mod: EvaluatedModuleNode,
    callstack: string[],
    visited = new Set<string>(),
  )

Source from the content-addressed store, hash-verified

134 }
135
136 private isCircularRequest(
137 mod: EvaluatedModuleNode,
138 callstack: string[],
139 visited = new Set<string>(),
140 ): boolean {
141 if (visited.has(mod.id)) {
142 return false
143 }
144 visited.add(mod.id)
145
146 for (const importedModuleId of mod.imports) {
147 if (callstack.includes(importedModuleId)) {
148 return true
149 }
150
151 const importedModule =
152 this.evaluatedModules.getModuleById(importedModuleId)
153 if (
154 importedModule?.promise &&
155 !importedModule.evaluated &&
156 this.isCircularRequest(importedModule, callstack, visited)
157 ) {
158 return true
159 }
160 }
161
162 return false
163 }
164
165 private async cachedRequest(
166 url: string,

Callers 1

cachedRequestMethod · 0.95

Calls 3

hasMethod · 0.80
addMethod · 0.80
getModuleByIdMethod · 0.45

Tested by

no test coverage detected