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

Function toDiscoveredDependencies

packages/vite/src/node/optimizer/index.ts:488–510  ·  view source on GitHub ↗
(
  environment: Environment,
  deps: Record<string, string>,
  timestamp?: string,
)

Source from the content-addressed store, hash-verified

486}
487
488export function toDiscoveredDependencies(
489 environment: Environment,
490 deps: Record<string, string>,
491 timestamp?: string,
492): Record<string, OptimizedDepInfo> {
493 const browserHash = getOptimizedBrowserHash(
494 getDepHash(environment).hash,
495 deps,
496 timestamp,
497 )
498 const discovered: Record<string, OptimizedDepInfo> = {}
499 for (const id in deps) {
500 const src = deps[id]
501 discovered[id] = {
502 id,
503 file: getOptimizedDepPath(environment, id),
504 src,
505 browserHash: browserHash,
506 exportsData: extractExportsData(environment, src),
507 }
508 }
509 return discovered
510}
511
512export function depsLogString(qualifiedIds: string[]): string {
513 return colors.yellow(qualifiedIds.join(`, `))

Callers 3

initFunction · 0.90
optimizeDepsFunction · 0.85

Calls 4

getOptimizedBrowserHashFunction · 0.85
getDepHashFunction · 0.85
getOptimizedDepPathFunction · 0.85
extractExportsDataFunction · 0.85

Tested by

no test coverage detected