constructor() — vite Function Reference
Architecture documentation for the constructor() function in baseEnvironment.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD fc780328_0dd4_ca48_1adb_4d931698bd4f["constructor()"] dc928824_33f2_0b61_b231_90d8800b77a5["PartialEnvironment"] fc780328_0dd4_ca48_1adb_4d931698bd4f -->|defined in| dc928824_33f2_0b61_b231_90d8800b77a5 82d12574_f119_34e7_d373_4b99a2a1fd6c["constructor()"] 82d12574_f119_34e7_d373_4b99a2a1fd6c -->|calls| fc780328_0dd4_ca48_1adb_4d931698bd4f 82d12574_f119_34e7_d373_4b99a2a1fd6c["constructor()"] fc780328_0dd4_ca48_1adb_4d931698bd4f -->|calls| 82d12574_f119_34e7_d373_4b99a2a1fd6c 62cf2425_32ce_8e8e_500a_902dc166b097["clearScreen()"] fc780328_0dd4_ca48_1adb_4d931698bd4f -->|calls| 62cf2425_32ce_8e8e_500a_902dc166b097 style fc780328_0dd4_ca48_1adb_4d931698bd4f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/baseEnvironment.ts lines 32–101
constructor(
name: string,
topLevelConfig: ResolvedConfig,
options: ResolvedEnvironmentOptions = topLevelConfig.environments[name],
) {
// only allow some characters so that we can use name without escaping for directory names
// and make users easier to access with `environments.*`
if (!/^[\w$]+$/.test(name)) {
throw new Error(
`Invalid environment name "${name}". Environment names must only contain alphanumeric characters and "$", "_".`,
)
}
this.name = name
this._topLevelConfig = topLevelConfig
this._options = options
this.config = new Proxy(
options as ResolvedConfig & ResolvedEnvironmentOptions,
{
get: (target, prop: keyof ResolvedConfig) => {
if (prop === 'logger') {
return this.logger
}
if (prop in target) {
return this._options[prop as keyof ResolvedEnvironmentOptions]
}
return this._topLevelConfig[prop]
},
},
)
const environment = colors.dim(`(${this.name})`)
const colorIndex =
[...this.name].reduce((acc, c) => acc + c.charCodeAt(0), 0) %
environmentColors.length
const infoColor = environmentColors[colorIndex || 0]
this.logger = {
get hasWarned() {
return topLevelConfig.logger.hasWarned
},
info(msg, opts) {
return topLevelConfig.logger.info(msg, {
...opts,
environment: infoColor(environment),
})
},
warn(msg, opts) {
return topLevelConfig.logger.warn(msg, {
...opts,
environment: colors.yellow(environment),
})
},
warnOnce(msg, opts) {
return topLevelConfig.logger.warnOnce(msg, {
...opts,
environment: colors.yellow(environment),
})
},
error(msg, opts) {
return topLevelConfig.logger.error(msg, {
...opts,
environment: colors.red(environment),
})
},
clearScreen(type) {
return topLevelConfig.logger.clearScreen(type)
},
hasErrorLogged(error) {
return topLevelConfig.logger.hasErrorLogged(error)
},
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does constructor() do?
constructor() is a function in the vite codebase, defined in packages/vite/src/node/baseEnvironment.ts.
Where is constructor() defined?
constructor() is defined in packages/vite/src/node/baseEnvironment.ts at line 32.
What does constructor() call?
constructor() calls 2 function(s): clearScreen, constructor.
What calls constructor()?
constructor() is called by 1 function(s): constructor.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free