CallSiteToString() — vite Function Reference
Architecture documentation for the CallSiteToString() function in interceptor.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD c7a3a2e2_4a8d_2b41_c3c3_b398b25f4e04["CallSiteToString()"] 95cae2f2_ad8c_91c1_5a74_93d939dbc47b["interceptor.ts"] c7a3a2e2_4a8d_2b41_c3c3_b398b25f4e04 -->|defined in| 95cae2f2_ad8c_91c1_5a74_93d939dbc47b style c7a3a2e2_4a8d_2b41_c3c3_b398b25f4e04 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/module-runner/sourcemap/interceptor.ts lines 266–330
function CallSiteToString(this: CallSite) {
let fileName
let fileLocation = ''
if (this.isNative()) {
fileLocation = 'native'
} else {
fileName = this.getScriptNameOrSourceURL()
if (!fileName && this.isEval()) {
fileLocation = this.getEvalOrigin() as string
fileLocation += ', ' // Expecting source position to follow.
}
if (fileName) {
fileLocation += fileName
} else {
// Source code does not originate from a file and is not native, but we
// can still get the source position inside the source string, e.g. in
// an eval string.
fileLocation += '<anonymous>'
}
const lineNumber = this.getLineNumber()
if (lineNumber != null) {
fileLocation += `:${lineNumber}`
const columnNumber = this.getColumnNumber()
if (columnNumber) fileLocation += `:${columnNumber}`
}
}
let line = ''
const functionName = this.getFunctionName()
let addSuffix = true
const isConstructor = this.isConstructor()
const isMethodCall = !(this.isToplevel() || isConstructor)
if (isMethodCall) {
let typeName = this.getTypeName()
// Fixes shim to be backward compatible with Node v0 to v4
if (typeName === '[object Object]') typeName = 'null'
const methodName = this.getMethodName()
if (functionName) {
if (typeName && functionName.indexOf(typeName) !== 0)
line += `${typeName}.`
line += functionName
if (
methodName &&
functionName.indexOf(`.${methodName}`) !==
functionName.length - methodName.length - 1
)
line += ` [as ${methodName}]`
} else {
line += `${typeName}.${methodName || '<anonymous>'}`
}
} else if (isConstructor) {
line += `new ${functionName || '<anonymous>'}`
} else if (functionName) {
line += functionName
} else {
line += fileLocation
addSuffix = false
}
if (addSuffix) line += ` (${fileLocation})`
return line
}
Domain
Subdomains
Source
Frequently Asked Questions
What does CallSiteToString() do?
CallSiteToString() is a function in the vite codebase, defined in packages/vite/src/module-runner/sourcemap/interceptor.ts.
Where is CallSiteToString() defined?
CallSiteToString() is defined in packages/vite/src/module-runner/sourcemap/interceptor.ts at line 266.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free