flattenSegments() — vue Function Reference
Architecture documentation for the flattenSegments() function in codegen.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD d48879f6_7abd_8ec3_2045_6f616d63d913["flattenSegments()"] 3cd1373c_a2c0_adeb_be13_1bf1ff92c1e2["genChildrenAsStringNode()"] 3cd1373c_a2c0_adeb_be13_1bf1ff92c1e2 -->|calls| d48879f6_7abd_8ec3_2045_6f616d63d913 31022e41_9356_bc1a_19ac_a481181c0824["genStringElementWithChildren()"] 31022e41_9356_bc1a_19ac_a481181c0824 -->|calls| d48879f6_7abd_8ec3_2045_6f616d63d913 05c5f3f8_ede4_70c3_1d8d_993fc45a2bad["elementToString()"] 05c5f3f8_ede4_70c3_1d8d_993fc45a2bad -->|calls| d48879f6_7abd_8ec3_2045_6f616d63d913 style d48879f6_7abd_8ec3_2045_6f616d63d913 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/server-renderer/src/optimizing-compiler/codegen.ts lines 234–260
function flattenSegments(segments: Array<StringSegment>): string {
const mergedSegments: string[] = []
let textBuffer = ''
const pushBuffer = () => {
if (textBuffer) {
mergedSegments.push(JSON.stringify(textBuffer))
textBuffer = ''
}
}
for (let i = 0; i < segments.length; i++) {
const s = segments[i]
if (s.type === RAW) {
textBuffer += s.value
} else if (s.type === INTERPOLATION) {
pushBuffer()
mergedSegments.push(`_ssrEscape(${s.value})`)
} else if (s.type === EXPRESSION) {
pushBuffer()
mergedSegments.push(`(${s.value})`)
}
}
pushBuffer()
return mergedSegments.join('+')
}
Domain
Subdomains
Source
Frequently Asked Questions
What does flattenSegments() do?
flattenSegments() is a function in the vue codebase.
What calls flattenSegments()?
flattenSegments() is called by 3 function(s): elementToString, genChildrenAsStringNode, genStringElementWithChildren.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free