Home / Function/ _getModuleInfoUnion() — vite Function Reference

_getModuleInfoUnion() — vite Function Reference

Architecture documentation for the _getModuleInfoUnion() function in mixedModuleGraph.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  d4008aef_0d13_178a_065a_328b730fd8ed["_getModuleInfoUnion()"]
  8168c2c0_6927_0878_8876_5fb50d36ade9["ModuleNode"]
  d4008aef_0d13_178a_065a_328b730fd8ed -->|defined in| 8168c2c0_6927_0878_8876_5fb50d36ade9
  3a4eb9e7_275b_dbf1_64d4_0626bd567229["info()"]
  3a4eb9e7_275b_dbf1_64d4_0626bd567229 -->|calls| d4008aef_0d13_178a_065a_328b730fd8ed
  style d4008aef_0d13_178a_065a_328b730fd8ed fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/server/mixedModuleGraph.ts lines 83–108

  _getModuleInfoUnion(prop: 'info'): ModuleInfo | undefined {
    const _clientValue = this._clientModule?.[prop]
    const _ssrValue = this._ssrModule?.[prop]

    if (_clientValue == null && _ssrValue == null) return undefined

    return new Proxy({} as any, {
      get: (_, key: string) => {
        // `meta` refers to `ModuleInfo.meta` so we refer to `this.meta` to
        // handle the object union between client and ssr
        if (key === 'meta') {
          return this.meta || EMPTY_OBJECT
        }
        if (_clientValue) {
          if (key in _clientValue) {
            return _clientValue[key as keyof ModuleInfo]
          }
        }
        if (_ssrValue) {
          if (key in _ssrValue) {
            return _ssrValue[key as keyof ModuleInfo]
          }
        }
      },
    })
  }

Domain

Subdomains

Called By

Frequently Asked Questions

What does _getModuleInfoUnion() do?
_getModuleInfoUnion() is a function in the vite codebase, defined in packages/vite/src/node/server/mixedModuleGraph.ts.
Where is _getModuleInfoUnion() defined?
_getModuleInfoUnion() is defined in packages/vite/src/node/server/mixedModuleGraph.ts at line 83.
What calls _getModuleInfoUnion()?
_getModuleInfoUnion() is called by 1 function(s): info.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free