flattenSegments() — vue Function Reference
Architecture documentation for the flattenSegments() function in codegen.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD c1db1452_0e44_878e_bcbc_c3c060920eac["flattenSegments()"] d70222cb_3265_c3fc_c0cf_09247995ea9a["codegen.ts"] c1db1452_0e44_878e_bcbc_c3c060920eac -->|defined in| d70222cb_3265_c3fc_c0cf_09247995ea9a 2fca87b5_3c3d_6d7a_6f06_d5b4a0981171["genChildrenAsStringNode()"] 2fca87b5_3c3d_6d7a_6f06_d5b4a0981171 -->|calls| c1db1452_0e44_878e_bcbc_c3c060920eac 89245b7a_d5b7_6af6_02cc_eff68f4d4b43["genStringElementWithChildren()"] 89245b7a_d5b7_6af6_02cc_eff68f4d4b43 -->|calls| c1db1452_0e44_878e_bcbc_c3c060920eac a5494006_6312_2e19_7b44_a5a5eb7051f5["elementToString()"] a5494006_6312_2e19_7b44_a5a5eb7051f5 -->|calls| c1db1452_0e44_878e_bcbc_c3c060920eac style c1db1452_0e44_878e_bcbc_c3c060920eac 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, defined in packages/server-renderer/src/optimizing-compiler/codegen.ts.
Where is flattenSegments() defined?
flattenSegments() is defined in packages/server-renderer/src/optimizing-compiler/codegen.ts at line 234.
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