Home / Function/ nodesToSegments() — vue Function Reference

nodesToSegments() — vue Function Reference

Architecture documentation for the nodesToSegments() function in codegen.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  f563a18b_c92b_0663_f7dc_3d9177b3ecc0["nodesToSegments()"]
  44ae389a_3263_f16b_05af_9e93b3ed0124["childrenToSegments()"]
  44ae389a_3263_f16b_05af_9e93b3ed0124 -->|calls| f563a18b_c92b_0663_f7dc_3d9177b3ecc0
  4d0b6945_0b17_a914_402c_b134ebc6a88e["elementToSegments()"]
  f563a18b_c92b_0663_f7dc_3d9177b3ecc0 -->|calls| 4d0b6945_0b17_a914_402c_b134ebc6a88e
  a5dd94b3_92b9_525e_59d6_4019047b41cf["escape()"]
  f563a18b_c92b_0663_f7dc_3d9177b3ecc0 -->|calls| a5dd94b3_92b9_525e_59d6_4019047b41cf
  style f563a18b_c92b_0663_f7dc_3d9177b3ecc0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/server-renderer/src/optimizing-compiler/codegen.ts lines 212–232

function nodesToSegments(
  children: Array<ASTNode>,
  state: CodegenState
): Array<StringSegment> {
  const segments: StringSegment[] = []
  for (let i = 0; i < children.length; i++) {
    const c = children[i]
    if (c.type === 1) {
      segments.push.apply(segments, elementToSegments(c, state))
    } else if (c.type === 2) {
      segments.push({ type: INTERPOLATION, value: c.expression })
    } else if (c.type === 3) {
      let text = escape(c.text)
      if (c.isComment) {
        text = '<!--' + text + '-->'
      }
      segments.push({ type: RAW, value: text })
    }
  }
  return segments
}

Subdomains

Frequently Asked Questions

What does nodesToSegments() do?
nodesToSegments() is a function in the vue codebase.
What does nodesToSegments() call?
nodesToSegments() calls 2 function(s): elementToSegments, escape.
What calls nodesToSegments()?
nodesToSegments() is called by 1 function(s): childrenToSegments.

Analyze Your Own Codebase

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

Try Supermodel Free