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
  798a16d6_69b7_5315_0f50_948e7cbca09d["nodesToSegments()"]
  a6f31758_a9cf_b7dc_09d6_0b57380360f7["childrenToSegments()"]
  a6f31758_a9cf_b7dc_09d6_0b57380360f7 -->|calls| 798a16d6_69b7_5315_0f50_948e7cbca09d
  e2a158d6_845c_6930_8656_68576142a273["elementToSegments()"]
  798a16d6_69b7_5315_0f50_948e7cbca09d -->|calls| e2a158d6_845c_6930_8656_68576142a273
  6121661a_8180_ff5f_be07_bd3a751ed57a["escape()"]
  798a16d6_69b7_5315_0f50_948e7cbca09d -->|calls| 6121661a_8180_ff5f_be07_bd3a751ed57a
  style 798a16d6_69b7_5315_0f50_948e7cbca09d 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