doTransform() — vite Function Reference
Architecture documentation for the doTransform() function in transformRequest.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 9bd7b32c_5b79_ac16_8541_4f64cc8ce19b["doTransform()"] ee4fcff9_3096_e290_234c_be9d1a2c8a4b["transformRequest.ts"] 9bd7b32c_5b79_ac16_8541_4f64cc8ce19b -->|defined in| ee4fcff9_3096_e290_234c_be9d1a2c8a4b 28d78764_00ba_3861_52d6_dc86fcde9e3a["transformRequest()"] 28d78764_00ba_3861_52d6_dc86fcde9e3a -->|calls| 9bd7b32c_5b79_ac16_8541_4f64cc8ce19b 47338255_0359_1ee9_69c4_4c16cb66262e["getModuleByUrl()"] 9bd7b32c_5b79_ac16_8541_4f64cc8ce19b -->|calls| 47338255_0359_1ee9_69c4_4c16cb66262e 9db68c96_e128_6a48_485b_4af92aeb9dce["getCachedTransformResult()"] 9bd7b32c_5b79_ac16_8541_4f64cc8ce19b -->|calls| 9db68c96_e128_6a48_485b_4af92aeb9dce 1c3423db_563a_92c5_87fa_42d035132b6c["getModuleById()"] 9bd7b32c_5b79_ac16_8541_4f64cc8ce19b -->|calls| 1c3423db_563a_92c5_87fa_42d035132b6c 1df76a35_b65f_4f0a_d9fb_00d2905ad5a6["_ensureEntryFromUrl()"] 9bd7b32c_5b79_ac16_8541_4f64cc8ce19b -->|calls| 1df76a35_b65f_4f0a_d9fb_00d2905ad5a6 bdac5327_5085_933f_41df_0fc270134a38["loadAndTransform()"] 9bd7b32c_5b79_ac16_8541_4f64cc8ce19b -->|calls| bdac5327_5085_933f_41df_0fc270134a38 be640272_c343_f5ae_1cf1_91d595faa5f8["_registerRequestProcessing()"] 9bd7b32c_5b79_ac16_8541_4f64cc8ce19b -->|calls| be640272_c343_f5ae_1cf1_91d595faa5f8 acb05845_9984_6792_9aae_b58486b613b5["resolveId()"] 9bd7b32c_5b79_ac16_8541_4f64cc8ce19b -->|calls| acb05845_9984_6792_9aae_b58486b613b5 style 9bd7b32c_5b79_ac16_8541_4f64cc8ce19b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/server/transformRequest.ts lines 149–206
async function doTransform(
environment: DevEnvironment,
url: string,
options: TransformOptionsInternal,
timestamp: number,
) {
const { pluginContainer } = environment
let module = await environment.moduleGraph.getModuleByUrl(url)
if (module) {
// try use cache from url
const cached = await getCachedTransformResult(
environment,
url,
module,
timestamp,
)
if (cached) return cached
}
const resolved = module
? undefined
: ((await pluginContainer.resolveId(url, undefined)) ?? undefined)
// resolve
const id = module?.id ?? resolved?.id ?? url
module ??= environment.moduleGraph.getModuleById(id)
if (module) {
// if a different url maps to an existing loaded id, make sure we relate this url to the id
await environment.moduleGraph._ensureEntryFromUrl(url, undefined, resolved)
// try use cache from id
const cached = await getCachedTransformResult(
environment,
url,
module,
timestamp,
)
if (cached) return cached
}
const result = loadAndTransform(
environment,
id,
url,
options,
timestamp,
module,
resolved,
)
const { depsOptimizer } = environment
if (!depsOptimizer?.isOptimizedDepFile(id)) {
environment._registerRequestProcessing(id, () => result)
}
return result
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does doTransform() do?
doTransform() is a function in the vite codebase, defined in packages/vite/src/node/server/transformRequest.ts.
Where is doTransform() defined?
doTransform() is defined in packages/vite/src/node/server/transformRequest.ts at line 149.
What does doTransform() call?
doTransform() calls 7 function(s): _ensureEntryFromUrl, _registerRequestProcessing, getCachedTransformResult, getModuleById, getModuleByUrl, loadAndTransform, resolveId.
What calls doTransform()?
doTransform() is called by 1 function(s): transformRequest.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free