dotparser is a JavaScript library designed to parse GraphViz dot file format into an Abstract Syntax Tree (AST). It provides a language-agnostic AST representation, making it suitable for graph library authors who need to transform `.dot` files into their own specific graph data structures without being tied to a particular graph visualization or manipulation library. The current stable version is 1.1.1, last published approximately four years ago as of early 2026. While widely downloaded, its development appears to be in maintenance mode, with a successor project, `@ts-graphviz/parser`, offering more modern features and active development. A key differentiator is its focus purely on AST generation, capable of parsing the standard Graphviz test suite, providing a robust foundation for building custom graph tooling.
npm install dotparserVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing a sample GraphViz DOT string into its Abstract Syntax Tree (AST) representation and logging the result. It also includes basic error handling and shows how to inspect the resulting AST structure.
For new projects or if encountering issues with modern DOT syntax, evaluate `@ts-graphviz/parser` or similar libraries which offer active development and broader feature sets.
In `tsconfig.json`, set `"esModuleInterop": true`. In plain JavaScript ESM, use dynamic import or `import * as Name from 'pkg';` and access the `default` property if needed.
Review the DOT string for syntax errors. GraphViz has a strict grammar. Use online validators or refer to the GraphViz DOT language specification to ensure correctness.
No dependency data recorded yet.