Home / File/ mixedModuleGraph.ts — vite Source File

mixedModuleGraph.ts — vite Source File

Architecture documentation for mixedModuleGraph.ts, a typescript file in the vite codebase. 9 imports, 4 dependents.

File typescript ViteCore ConfigEngine 9 imports 4 dependents 4 functions 3 classes

Entity Profile

Dependency Diagram

graph LR
  cd2f5017_5d73_e10a_7c43_22b962517f0c["mixedModuleGraph.ts"]
  031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"]
  cd2f5017_5d73_e10a_7c43_22b962517f0c --> 031bc221_67a8_c579_f2bf_bb30a08beeb2
  74ee9886_2456_3964_e90e_5fc67925229d["monotonicDateNow"]
  cd2f5017_5d73_e10a_7c43_22b962517f0c --> 74ee9886_2456_3964_e90e_5fc67925229d
  ee4fcff9_3096_e290_234c_be9d1a2c8a4b["transformRequest.ts"]
  cd2f5017_5d73_e10a_7c43_22b962517f0c --> ee4fcff9_3096_e290_234c_be9d1a2c8a4b
  0d0da384_0353_2feb_0949_4e35f8f5b097["TransformResult"]
  cd2f5017_5d73_e10a_7c43_22b962517f0c --> 0d0da384_0353_2feb_0949_4e35f8f5b097
  a3adc511_3c03_7f25_9d76_5d3ed9987eb5["moduleGraph.ts"]
  cd2f5017_5d73_e10a_7c43_22b962517f0c --> a3adc511_3c03_7f25_9d76_5d3ed9987eb5
  cdb618b6_fede_c732_1a58_98b86b491151["EnvironmentModuleGraph"]
  cd2f5017_5d73_e10a_7c43_22b962517f0c --> cdb618b6_fede_c732_1a58_98b86b491151
  fc3efa20_5545_5daf_3cf9_fa65c8365591["EnvironmentModuleNode"]
  cd2f5017_5d73_e10a_7c43_22b962517f0c --> fc3efa20_5545_5daf_3cf9_fa65c8365591
  f591e2fa_7373_b299_fca2_52eace1088a5["ResolvedUrl"]
  cd2f5017_5d73_e10a_7c43_22b962517f0c --> f591e2fa_7373_b299_fca2_52eace1088a5
  693ca867_249b_3e5a_0ce1_8930413b7fcd["rolldown"]
  cd2f5017_5d73_e10a_7c43_22b962517f0c --> 693ca867_249b_3e5a_0ce1_8930413b7fcd
  5abb8c87_ffcb_f2d4_7421_e36705d9e5c7["plugin.ts"]
  5abb8c87_ffcb_f2d4_7421_e36705d9e5c7 --> cd2f5017_5d73_e10a_7c43_22b962517f0c
  782edff7_d16a_7086_847f_81dcc4da4404["moduleGraph.spec.ts"]
  782edff7_d16a_7086_847f_81dcc4da4404 --> cd2f5017_5d73_e10a_7c43_22b962517f0c
  18db4f26_79f1_5b7d_b291_4feeaf95538f["hmr.ts"]
  18db4f26_79f1_5b7d_b291_4feeaf95538f --> cd2f5017_5d73_e10a_7c43_22b962517f0c
  a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e["index.ts"]
  a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e --> cd2f5017_5d73_e10a_7c43_22b962517f0c
  style cd2f5017_5d73_e10a_7c43_22b962517f0c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { ModuleInfo } from 'rolldown'
import { monotonicDateNow } from '../utils'
import type { TransformResult } from './transformRequest'
import type {
  EnvironmentModuleGraph,
  EnvironmentModuleNode,
  ResolvedUrl,
} from './moduleGraph'

/**
 * Backward compatible ModuleNode and ModuleGraph with mixed nodes from both the client and ssr environments
 * It would be good to take the types names for the new EnvironmentModuleNode and EnvironmentModuleGraph but we can't
 * do that at this point without breaking to much code in the ecosystem.
 * We are going to deprecate these types and we can try to use them back in the future.
 */

// same default value of "moduleInfo.meta" as in Rollup
const EMPTY_OBJECT = Object.freeze({})

export class ModuleNode {
  _moduleGraph: ModuleGraph
  _clientModule: EnvironmentModuleNode | undefined
  _ssrModule: EnvironmentModuleNode | undefined
  constructor(
    moduleGraph: ModuleGraph,
    clientModule?: EnvironmentModuleNode,
    ssrModule?: EnvironmentModuleNode,
  ) {
    this._moduleGraph = moduleGraph
    this._clientModule = clientModule
    this._ssrModule = ssrModule
  }
  _get<T extends keyof EnvironmentModuleNode>(
    prop: T,
  ): EnvironmentModuleNode[T] {
    return (this._clientModule?.[prop] ?? this._ssrModule?.[prop])!
  }
  _set<T extends keyof EnvironmentModuleNode>(
    prop: T,
    value: EnvironmentModuleNode[T],
  ): void {
    if (this._clientModule) {
      this._clientModule[prop] = value
    }
    if (this._ssrModule) {
      this._ssrModule[prop] = value
    }
  }

  _wrapModuleSet(
    prop: ModuleSetNames,
    module: EnvironmentModuleNode | undefined,
  ): Set<ModuleNode> {
    if (!module) {
      return new Set()
    }
    return createBackwardCompatibleModuleSet(this._moduleGraph, prop, module)
  }
  _getModuleSetUnion(prop: 'importedModules' | 'importers'): Set<ModuleNode> {
    // A good approximation to the previous logic that returned the union of
// ... (682 more lines)

Domain

Subdomains

Frequently Asked Questions

What does mixedModuleGraph.ts do?
mixedModuleGraph.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain, ConfigEngine subdomain.
What functions are defined in mixedModuleGraph.ts?
mixedModuleGraph.ts defines 4 function(s): createBackwardCompatibleFileToModulesMap, createBackwardCompatibleModuleMap, createBackwardCompatibleModuleSet, mapIterator.
What does mixedModuleGraph.ts depend on?
mixedModuleGraph.ts imports 9 module(s): EnvironmentModuleGraph, EnvironmentModuleNode, ResolvedUrl, TransformResult, moduleGraph.ts, monotonicDateNow, rolldown, transformRequest.ts, and 1 more.
What files import mixedModuleGraph.ts?
mixedModuleGraph.ts is imported by 4 file(s): hmr.ts, index.ts, moduleGraph.spec.ts, plugin.ts.
Where is mixedModuleGraph.ts in the architecture?
mixedModuleGraph.ts is located at packages/vite/src/node/server/mixedModuleGraph.ts (domain: ViteCore, subdomain: ConfigEngine, directory: packages/vite/src/node/server).

Analyze Your Own Codebase

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

Try Supermodel Free