How demike/tsuml2 works
TsUML2 is an offline TypeScript-to-UML diagram generator and library. The principal workflow takes a user’s source-file glob and options, parses TypeScript declarations (optionally deriving member associations), then emits SVG/nomnoml DSL and/or Mermaid DSL to requested files. The graph also shows the shared declaration model, diagnostics, and separate renderer templates. The parser and settings excerpts are incomplete; arrows are limited to calls visible in excerpts, SOURCE INDEX references, or README statements.
Main entry points: diagram-engine.ts Project orchestration · core/index.ts Core API and writes · lib/index.ts Library exports · bin/index.ts CLI entry
Components 19
Entry and settings
- CLI entry
src/bin/index.ts - Settings parsing
src/core/parse-settings.ts - Diagram options
src/core/tsuml2-settings.ts
Type analysis
- Project orchestration
src/core/diagram-engine.ts - TypeScript AST parsing
src/core/parser/parser.ts - Declaration model
src/core/model.ts - Member associations
src/core/parser/associations.ts - Diagnostics
src/core/diagnostics.ts
Diagram rendering
- DSL emitter
src/core/emitter.ts - Renderer template contract
src/core/renderer/template.ts - Nomnoml template
src/core/renderer/nomnoml-template.ts - Mermaid template
src/core/renderer/mermaid-template.ts
Outputs and API
- SVG rendering
src/core/io.ts - SVG type links
src/core/emitter.ts - Core API and writes
src/core/index.ts - Library exports
src/lib/index.ts
Other components
- User
- nomnoml renderer
- Filesystem
Connections 25
- User → CLI entry: runs
README.md - CLI entry → Settings parsing: parses options
src/bin/index.ts - Settings parsing → Diagram options: configures
src/core/parse-settings.ts - CLI entry → Core API and writes: invokes
src/bin/index.ts - Core API and writes → Project orchestration: parses project
src/core/index.ts - Project orchestration → Diagram options: uses settings
src/core/diagram-engine.ts - Project orchestration → TypeScript AST parsing: parses declarations
src/core/diagram-engine.ts - TypeScript AST parsing → Declaration model: creates model
src/core/parser/parser.ts - Project orchestration → Member associations: derives associations
src/core/diagram-engine.ts - TypeScript AST parsing → Diagnostics: reports issues
src/core/parser/parser.ts - Project orchestration → DSL emitter: emits DSL
src/core/diagram-engine.ts - DSL emitter → Declaration model: reads declarations
src/core/emitter.ts - DSL emitter → Renderer template contract: uses contract
src/core/emitter.ts - Project orchestration → Nomnoml template: selects template
src/core/diagram-engine.ts - Project orchestration → Mermaid template: selects template
src/core/diagram-engine.ts - Nomnoml template → Renderer template contract: implements
src/core/renderer/nomnoml-template.ts - Mermaid template → Renderer template contract: implements
src/core/renderer/mermaid-template.ts - Project orchestration → SVG rendering: renders SVG
src/core/diagram-engine.ts - Project orchestration → SVG type links: post-processes SVG
src/core/diagram-engine.ts - Project orchestration → Diagram options: reads options
src/core/diagram-engine.ts - Core API and writes → Filesystem: writes outputs
src/core/index.ts - SVG rendering → nomnoml renderer: renders diagram
README.md - Library exports → Core API and writes: re-exports API
src/lib/index.ts - Library exports → SVG rendering: re-exports renderer
src/lib/index.ts - Library exports → SVG type links: re-exports helper
src/lib/index.ts