Converting Cloudflare Workflows Code to Visual Diagrams Using AST
- Cloudflare Workflows
- oxc-parser
- JavaScript Oxidation Compiler (OXC)
- Rust
- WebAssembly
AI Summary
Cloudflare explains how they automatically generate visual workflow diagrams from user code using Abstract Syntax Trees (AST). Because workflows are written as dynamic code with promises, loops, and async patterns rather than declarative JSON or YAML, rendering accurate graphs is complex. The engineering team utilizes oxc-parser running via WebAssembly in a Rust-powered Worker to parse minified JavaScript across various bundlers. They track execution order, handle function relationships, and map parallel executions to provide a clear debugging and visualization tool in the dashboard.
Key Takeaways
- Details how AST parsing handles dynamic workflows built with promises, async/await, and loops.
- Explains the use of oxc-parser and Rust running on WebAssembly inside Cloudflare Workers.
- Discusses challenges in dealing with minified code from various bundlers like esbuild, rspack, and vite.
Why it matters
Visualizing code-as-workflows bridges the gap between dynamic programming constructs and intuitive operational diagnostics, helping engineers debug complex asynchronous pipelines without relying on static configuration files.
Conversation0
What would you add from your experience?
Checking your session…
Every good conversation starts with one perspective.