codegraph-typescript
TypeScript/JavaScript parser for CodeGraph - extracts code entities and relationships from TS/JS source files.
Version 0.3.0 - Cyclomatic Complexity Analysis
codegraph-typescript v0.3.0 adds AST-based cyclomatic complexity calculation for all functions using tree-sitter.
Complexity Metrics
use CodeParser;
use TypeScriptParser;
let parser = new;
let ir = parser.parse_source?;
for func in &ir.functions
What's Analyzed
- if/else statements and ternary operators
- switch/case statements
- for, while, do-while loops
- try/catch exception handling
- Logical operators (&&, ||)
- Nesting depth tracking
Features
- ✅ Parse TypeScript and JavaScript files (.ts, .tsx, .js, .jsx)
- ✅ Extract functions (including arrow functions, async functions)
- ✅ Extract classes and interfaces
- ✅ Track imports and exports
- ✅ Cyclomatic complexity analysis (v0.3.0)
- ✅ Full integration with
codegraph-parser-api
Quick Start
use CodeGraph;
use CodeParser;
use TypeScriptParser;
use Path;
Supported Features
- Functions (regular, arrow, async, generator)
- Classes (including methods, properties, constructors)
- Interfaces
- Import/export statements
- TypeScript type annotations
- JSX/TSX syntax
License
Apache-2.0