EnvironmentModuleNode Class — vite Architecture
Architecture documentation for the EnvironmentModuleNode class in moduleGraph.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD fc3efa20_5545_5daf_3cf9_fa65c8365591["EnvironmentModuleNode"] a3adc511_3c03_7f25_9d76_5d3ed9987eb5["moduleGraph.ts"] fc3efa20_5545_5daf_3cf9_fa65c8365591 -->|defined in| a3adc511_3c03_7f25_9d76_5d3ed9987eb5 6497c3c9_5d65_a10d_0f25_f07b57b4d40e["constructor()"] fc3efa20_5545_5daf_3cf9_fa65c8365591 -->|method| 6497c3c9_5d65_a10d_0f25_f07b57b4d40e
Relationship Graph
Source Code
packages/vite/src/node/server/moduleGraph.ts lines 14–82
export class EnvironmentModuleNode {
environment: string
/**
* Public served url path, starts with /
*/
url: string
/**
* Resolved file system path + query
*/
id: string | null = null
file: string | null = null
type: 'js' | 'css' | 'asset'
info?: ModuleInfo
meta?: Record<string, any>
importers: Set<EnvironmentModuleNode> = new Set()
importedModules: Set<EnvironmentModuleNode> = new Set()
acceptedHmrDeps: Set<EnvironmentModuleNode> = new Set()
acceptedHmrExports: Set<string> | null = null
importedBindings: Map<string, Set<string>> | null = null
isSelfAccepting?: boolean
transformResult: TransformResult | null = null
// ssrModule and ssrError are no longer needed. They are on the module runner module cache.
// Once `ssrLoadModule` is re-implemented on top of the new APIs, we can delete these.
ssrModule: Record<string, any> | null = null
ssrError: Error | null = null
lastHMRTimestamp = 0
/**
* `import.meta.hot.invalidate` is called by the client.
* If there's multiple clients, multiple `invalidate` request is received.
* This property is used to dedupe those request to avoid multiple updates happening.
* @internal
*/
lastHMRInvalidationReceived = false
lastInvalidationTimestamp = 0
/**
* If the module only needs to update its imports timestamp (e.g. within an HMR chain),
* it is considered soft-invalidated. In this state, its `transformResult` should exist,
* and the next `transformRequest` for this module will replace the timestamps.
*
* By default the value is `undefined` if it's not soft/hard-invalidated. If it gets
* soft-invalidated, this will contain the previous `transformResult` value. If it gets
* hard-invalidated, this will be set to `'HARD_INVALIDATED'`.
* @internal
*/
invalidationState: TransformResult | 'HARD_INVALIDATED' | undefined
/**
* The module urls that are statically imported in the code. This information is separated
* out from `importedModules` as only importers that statically import the module can be
* soft invalidated. Other imports (e.g. watched files) needs the importer to be hard invalidated.
* @internal
*/
staticImportedUrls?: Set<string>
/**
* @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
*/
constructor(url: string, environment: string, setIsSelfAccepting = true) {
this.environment = environment
this.url = url
this.type = isDirectCSSRequest(url) ? 'css' : 'js'
if (setIsSelfAccepting) {
this.isSelfAccepting = false
}
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the EnvironmentModuleNode class?
EnvironmentModuleNode is a class in the vite codebase, defined in packages/vite/src/node/server/moduleGraph.ts.
Where is EnvironmentModuleNode defined?
EnvironmentModuleNode is defined in packages/vite/src/node/server/moduleGraph.ts at line 14.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free