Home / Function/ optimizeSiblings() — vue Function Reference

optimizeSiblings() — vue Function Reference

Architecture documentation for the optimizeSiblings() function in optimizer.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  859e1bac_0b78_c305_6901_3f1b7541c37d["optimizeSiblings()"]
  b7ef6faa_d112_ca70_98b8_d353bda5bfe0["optimizer.ts"]
  859e1bac_0b78_c305_6901_3f1b7541c37d -->|defined in| b7ef6faa_d112_ca70_98b8_d353bda5bfe0
  e0234097_5b82_4120_05bc_3e7af5090c92["walk()"]
  e0234097_5b82_4120_05bc_3e7af5090c92 -->|calls| 859e1bac_0b78_c305_6901_3f1b7541c37d
  style 859e1bac_0b78_c305_6901_3f1b7541c37d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/server-renderer/src/optimizing-compiler/optimizer.ts lines 74–108

function optimizeSiblings(el) {
  const children = el.children
  const optimizedChildren: any[] = []

  let currentOptimizableGroup: any[] = []
  const pushGroup = () => {
    if (currentOptimizableGroup.length) {
      optimizedChildren.push({
        type: 1,
        parent: el,
        tag: 'template',
        attrsList: [],
        attrsMap: {},
        rawAttrsMap: {},
        children: currentOptimizableGroup,
        ssrOptimizability: optimizability.FULL
      })
    }
    currentOptimizableGroup = []
  }

  for (let i = 0; i < children.length; i++) {
    const c = children[i]
    if (c.ssrOptimizability === optimizability.FULL) {
      currentOptimizableGroup.push(c)
    } else {
      // wrap fully-optimizable adjacent siblings inside a template tag
      // so that they can be optimized into a single ssrNode by codegen
      pushGroup()
      optimizedChildren.push(c)
    }
  }
  pushGroup()
  return optimizedChildren
}

Subdomains

Called By

Frequently Asked Questions

What does optimizeSiblings() do?
optimizeSiblings() is a function in the vue codebase, defined in packages/server-renderer/src/optimizing-compiler/optimizer.ts.
Where is optimizeSiblings() defined?
optimizeSiblings() is defined in packages/server-renderer/src/optimizing-compiler/optimizer.ts at line 74.
What calls optimizeSiblings()?
optimizeSiblings() is called by 1 function(s): walk.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free