Home / Function/ cloneAstNodeSpread() — tailwindcss Function Reference

cloneAstNodeSpread() — tailwindcss Function Reference

Architecture documentation for the cloneAstNodeSpread() function in ast.bench.ts from the tailwindcss codebase.

Entity Profile

Relationship Graph

Source Code

packages/tailwindcss/src/ast.bench.ts lines 46–64

function cloneAstNodeSpread<T extends AstNode>(node: T): T {
  switch (node.kind) {
    case 'rule':
    case 'at-rule':
    case 'at-root':
      return { ...node, nodes: node.nodes.map(cloneAstNodeSpread) }

    case 'context':
      return { ...node, context: { ...node.context }, nodes: node.nodes.map(cloneAstNodeSpread) }

    case 'declaration':
    case 'comment':
      return { ...node }

    default:
      node satisfies never
      throw new Error(`Unknown node kind: ${(node as any).kind}`)
  }
}

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free