walk() — vue Function Reference
Architecture documentation for the walk() function in optimizer.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD e0234097_5b82_4120_05bc_3e7af5090c92["walk()"] b7ef6faa_d112_ca70_98b8_d353bda5bfe0["optimizer.ts"] e0234097_5b82_4120_05bc_3e7af5090c92 -->|defined in| b7ef6faa_d112_ca70_98b8_d353bda5bfe0 654f763a_4986_ed82_07ef_40f48f95bd20["optimize()"] 654f763a_4986_ed82_07ef_40f48f95bd20 -->|calls| e0234097_5b82_4120_05bc_3e7af5090c92 519e4825_7a68_874e_affd_c57b811eeb71["isUnOptimizableTree()"] e0234097_5b82_4120_05bc_3e7af5090c92 -->|calls| 519e4825_7a68_874e_affd_c57b811eeb71 06d76426_7f3d_6a2a_836d_edc8e5af7f2c["hasCustomDirective()"] e0234097_5b82_4120_05bc_3e7af5090c92 -->|calls| 06d76426_7f3d_6a2a_836d_edc8e5af7f2c 859e1bac_0b78_c305_6901_3f1b7541c37d["optimizeSiblings()"] e0234097_5b82_4120_05bc_3e7af5090c92 -->|calls| 859e1bac_0b78_c305_6901_3f1b7541c37d style e0234097_5b82_4120_05bc_3e7af5090c92 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/server-renderer/src/optimizing-compiler/optimizer.ts lines 31–72
function walk(node: ASTNode, isRoot?: boolean) {
if (isUnOptimizableTree(node)) {
node.ssrOptimizability = optimizability.FALSE
return
}
// root node or nodes with custom directives should always be a VNode
const selfUnoptimizable = isRoot || hasCustomDirective(node)
const check = child => {
if (child.ssrOptimizability !== optimizability.FULL) {
node.ssrOptimizability = selfUnoptimizable
? optimizability.PARTIAL
: optimizability.SELF
}
}
if (selfUnoptimizable) {
node.ssrOptimizability = optimizability.CHILDREN
}
if (node.type === 1) {
for (let i = 0, l = node.children.length; i < l; i++) {
const child = node.children[i]
walk(child)
check(child)
}
if (node.ifConditions) {
for (let i = 1, l = node.ifConditions.length; i < l; i++) {
const block = node.ifConditions[i].block
walk(block, isRoot)
check(block)
}
}
if (
node.ssrOptimizability == null ||
(!isRoot && (node.attrsMap['v-html'] || node.attrsMap['v-text']))
) {
node.ssrOptimizability = optimizability.FULL
} else {
node.children = optimizeSiblings(node)
}
} else {
node.ssrOptimizability = optimizability.FULL
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does walk() do?
walk() is a function in the vue codebase, defined in packages/server-renderer/src/optimizing-compiler/optimizer.ts.
Where is walk() defined?
walk() is defined in packages/server-renderer/src/optimizing-compiler/optimizer.ts at line 31.
What does walk() call?
walk() calls 3 function(s): hasCustomDirective, isUnOptimizableTree, optimizeSiblings.
What calls walk()?
walk() is called by 1 function(s): optimize.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free