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

Method cachedModule

packages/vite/src/module-runner/runner.ts:219–237  ·  packages/vite/src/module-runner/runner.ts::ModuleRunner.cachedModule
(
    url: string,
    importer?: string,
  )

Source from the content-addressed store, hash-verified

217 }
218
219 private async cachedModule(
220 url: string,
221 importer?: string,
222 ): Promise<EvaluatedModuleNode> {
223 let cached = this.concurrentModuleNodePromises.get(url)
224 if (!cached) {
225 const cachedModule = this.evaluatedModules.getModuleByUrl(url)
226 cached = this.getModuleInformation(url, importer, cachedModule).finally(
227 () => {
228 this.concurrentModuleNodePromises.delete(url)
229 },
230 )
231 this.concurrentModuleNodePromises.set(url, cached)
232 } else {
233 this.debug?.(class="st">'[module runner] using cached module info for', url)
234 }
235
236 return cached
237 }
238
239 private ensureBuiltins(): Promise<void> | undefined {
240 if (this.isBuiltin) return

Callers 2

importMethod · 0.95
requestMethod · 0.95

Calls 6

getModuleInformationMethod · 0.95
deleteMethod · 0.80
debugMethod · 0.65
getMethod · 0.45
getModuleByUrlMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected