generateCodeFrame() — vue Function Reference
Architecture documentation for the generateCodeFrame() function in codeframe.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD dd20ebf1_1620_a5f1_519f_f296f3f66e87["generateCodeFrame()"] e7aa288a_f5ad_28a9_75b4_4d0ad05fd70c["codeframe.ts"] dd20ebf1_1620_a5f1_519f_f296f3f66e87 -->|defined in| e7aa288a_f5ad_28a9_75b4_4d0ad05fd70c de1bc371_80db_723d_3fc8_276c93f033c1["createCompileToFunctionFn()"] de1bc371_80db_723d_3fc8_276c93f033c1 -->|calls| dd20ebf1_1620_a5f1_519f_f296f3f66e87 f4575886_faab_ab99_46a6_6f2dd36e2121["repeat()"] dd20ebf1_1620_a5f1_519f_f296f3f66e87 -->|calls| f4575886_faab_ab99_46a6_6f2dd36e2121 style dd20ebf1_1620_a5f1_519f_f296f3f66e87 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/compiler/codeframe.ts lines 3–37
export function generateCodeFrame(
source: string,
start: number = 0,
end: number = source.length
): string {
const lines = source.split(/\r?\n/)
let count = 0
const res: string[] = []
for (let i = 0; i < lines.length; i++) {
count += lines[i].length + 1
if (count >= start) {
for (let j = i - range; j <= i + range || end > count; j++) {
if (j < 0 || j >= lines.length) continue
res.push(
`${j + 1}${repeat(` `, 3 - String(j + 1).length)}| ${lines[j]}`
)
const lineLength = lines[j].length
if (j === i) {
// push underline
const pad = start - (count - lineLength) + 1
const length = end > count ? lineLength - pad : end - start
res.push(` | ` + repeat(` `, pad) + repeat(`^`, length))
} else if (j > i) {
if (end > count) {
const length = Math.min(end - count, lineLength)
res.push(` | ` + repeat(`^`, length))
}
count += lineLength + 1
}
}
break
}
}
return res.join('\n')
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does generateCodeFrame() do?
generateCodeFrame() is a function in the vue codebase, defined in src/compiler/codeframe.ts.
Where is generateCodeFrame() defined?
generateCodeFrame() is defined in src/compiler/codeframe.ts at line 3.
What does generateCodeFrame() call?
generateCodeFrame() calls 1 function(s): repeat.
What calls generateCodeFrame()?
generateCodeFrame() is called by 1 function(s): createCompileToFunctionFn.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free