
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
@ts-graphviz/ast
Advanced tools
This package contains the module for processing the DOT language at the Abstract Syntax Tree (AST) level for the ts-graphviz library.
๐
It is part of the ts-graphviz library, which is split into modular packages to improve maintainability, flexibility, and ease of use.
This package is a foundational component of the ts-graphviz library that enables low-level manipulation of DOT language structures. It provides a parser that converts DOT language strings into AST nodes and a stringifier that converts AST nodes back to DOT language.
The AST package provides several key functions:
parse(input: string, options?): Parses a DOT language string into an AST structurestringify(ast: ASTNode): Converts an AST structure to a DOT language stringfromModel(model): Converts a Graph Model to an AST structuretoModel(ast): Converts an AST structure to a Graph Modelimport { parse } from "@ts-graphviz/ast";
const dotString = "digraph G { A -> B; }";
const ast = parse(dotString);
console.log(ast);
// Output: A DotASTNode representing the DOT structure
The parse function accepts an optional second argument for configuration:
import { parse } from "@ts-graphviz/ast";
// Parse with custom HTML nesting depth limit
const ast = parse(dotString, {
startRule: 'Dot', // Specify the starting rule (default: 'Dot')
maxHtmlNestingDepth: 200 // Set maximum HTML nesting depth (default: 100)
});
Security Note:
maxHtmlNestingDepth option limits the depth of nested HTML-like structures in DOT files to prevent stack overflow attacks@ts-graphviz/adapter documentationimport { parse, stringify } from "@ts-graphviz/ast";
const dotString = "digraph G { A -> B; }";
const ast = parse(dotString);
// Modify the AST if needed
const outputDotString = stringify(ast);
console.log(outputDotString);
// Output: "digraph G { A -> B; }"
The package provides a specialized error class for handling syntax errors during parsing.
When a parsing error occurs, the parser throws a DotSyntaxError with detailed information about the issue, which helps in debugging DOT language syntax problems.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
See CHANGELOG.md for more details.
This software is released under the MIT License, see LICENSE.
Graphlib is a JavaScript library for creating and manipulating directed graphs. It provides a more general-purpose graph manipulation API compared to @ts-graphviz/ast, which is specifically focused on the DOT language.
Viz.js is a library that allows you to render DOT files using Graphviz in the browser. While @ts-graphviz/ast focuses on parsing and generating DOT files, Viz.js is more about rendering them.
d3-graphviz is a library that integrates Graphviz with D3.js for rendering graphs in the browser. It provides higher-level visualization capabilities compared to the AST manipulation provided by @ts-graphviz/ast.
FAQs
Graphviz AST(Abstract Syntax Tree) Utilities
The npm package @ts-graphviz/ast receives a total of 627,934 weekly downloads. As such, @ts-graphviz/ast popularity was classified as popular.
We found that @ts-graphviz/ast demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authoritiesโ publishing activity, highlighting trends and transparency across the CVE ecosystem.