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

Dependency Diagram

graph TD
  2a8d7896_33a0_8684_44fe_07c76b380f85["cloneAstNodeSpread()"]
  a2ef882b_7487_6c59_65f1_90f22f9499ea["ast.bench.ts"]
  2a8d7896_33a0_8684_44fe_07c76b380f85 -->|defined in| a2ef882b_7487_6c59_65f1_90f22f9499ea
  style 2a8d7896_33a0_8684_44fe_07c76b380f85 fill:#6366f1,stroke:#818cf8,color:#fff

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}`)
  }
}

Domain

Subdomains

Frequently Asked Questions

What does cloneAstNodeSpread() do?
cloneAstNodeSpread() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/ast.bench.ts.
Where is cloneAstNodeSpread() defined?
cloneAstNodeSpread() is defined in packages/tailwindcss/src/ast.bench.ts at line 46.

Analyze Your Own Codebase

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

Try Supermodel Free