Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-graphviz

Package Overview
Dependencies
Maintainers
1
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-graphviz - npm Package Compare versions

Comparing version 1.5.4 to 1.5.5-dev.02afc3340

4

lib/adapter/deno/mod.js

@@ -1,2 +0,2 @@

import { commandBuilder } from '../utils/index.js';
import { createCommandAndArgs } from '../utils/index.js';
/**

@@ -6,3 +6,3 @@ * Execute the Graphviz dot command and make a Stream of the results.

export async function toStream(dot, options) {
const [command, args] = commandBuilder(options);
const [command, args] = createCommandAndArgs(options);
const cp = new Deno.Command(command, {

@@ -9,0 +9,0 @@ args: args,

import { pipeline as pipeline$1, PassThrough, Readable } from 'node:stream';
import { spawn } from 'node:child_process';
import { commandBuilder } from '../utils/index.js';
import { createCommandAndArgs } from '../utils/index.js';
import { promisify } from 'node:util';

@@ -18,3 +18,3 @@ import { createWriteStream } from 'node:fs';

async function toStream(dot, options) {
const [command, args] = commandBuilder(options ?? {});
const [command, args] = createCommandAndArgs(options ?? {});
return new Promise(async function toStreamInternal(resolve, reject) {

@@ -21,0 +21,0 @@ const p = spawn(command, args, { stdio: 'pipe' });

@@ -10,2 +10,5 @@ import {

type Layout = 'dot' | 'neato' | 'fdp' | 'sfdp' | 'circo' | 'twopi' | 'nop' | 'nop2' | 'osage' | 'patchwork';
/**
* NeatoOptions interface provides options for the neato layout.
*/
interface NeatoOptions {

@@ -22,2 +25,5 @@ layout: 'neato';

}
/**
* FdpOptions interface provides options for the fdp layout.
*/
interface FdpOptions {

@@ -54,2 +60,8 @@ layout: 'fdp';

}
/**
* @description
* This interface describes an optional parameter called "layout" which is used to set a layout engine.
* The default value for this parameter is 'dot', and it must be an option of the Layout type,
* excluding 'neato' and 'fdp'.
*/
interface OtherOptions {

@@ -63,2 +75,5 @@ /**

}
/**
* This interface represents the CommonOptions for setting output format.
*/
interface CommonOptions {

@@ -65,0 +80,0 @@ /**

import { Layout, Options } from '../types/index.js';
declare function commandBuilder<T extends Layout>(options: Options<T>): [command: string, args: string[]];
/**
* createCommandAndArgs creates a command and an array of arguments, based on the given {@link Options}.
*
* @param options Options to create the command and args from.
* @returns A tuple containing the command and an array of arguments.
*/
declare function createCommandAndArgs<T extends Layout>(options: Options<T>): [command: string, args: string[]];
export { commandBuilder };
export { createCommandAndArgs };

@@ -0,1 +1,8 @@

/**
* escapeValue is a function that escapes a given Attribute value of a given AttributeKey.
* It checks the type of the value and adds quotes if the value is of type string and contains whitespace.
*
* @param value The value of an Attribute of type T that extends AttributeKey
* @returns The escaped Attribute value
*/
function escapeValue(value) {

@@ -11,3 +18,10 @@ if (value !== true) {

}
function* args(options) {
/**
* createCommandArgs is a function that creates command arguments from a given Options object.
* It reads the properties of the Options object and creates corresponding command line arguments accordingly.
*
* @param options The Options object used to create command arguments
* @returns A generator that yields strings for command arguments
*/
function* createCommandArgs(options) {
const { suppressWarnings = true, format = 'svg', attributes = {}, library = [], y = false, scale } = options;

@@ -52,6 +66,13 @@ if (suppressWarnings) yield '-q';

}
function commandBuilder(options) {
return [options.dotCommand ?? 'dot', Array.from(args(options))];
/**
* createCommandAndArgs creates a command and an array of arguments, based on the given {@link Options}.
*
* @param options Options to create the command and args from.
* @returns A tuple containing the command and an array of arguments.
*/
function createCommandAndArgs(options) {
return [options.dotCommand ?? 'dot', Array.from(createCommandArgs(options))];
}
export { commandBuilder };
export { createCommandAndArgs };

@@ -14,61 +14,117 @@ import {

/**
* The FilePosition interface represents the position of a file in terms of its offset, line number, and column number.
*
* @group AST
*/
interface FilePosition$1 {
/**
* The offset of the file.
*/
offset: number;
/**
* The line number of the file.
*/
line: number;
/**
* The column number of the file.
*/
column: number;
}
/**
* FileRange interface represents a range of positions within a file.
* @group AST
*/
interface FileRange$1 {
/**
* The start position of the range.
*/
start: FilePosition$1;
/**
* The end position of the range.
*/
end: FilePosition$1;
}
/**
* AST common propaties.
* This interface provides common properties to be used across all abstract syntax tree (AST) objects.
*
* @group AST
*/
interface ASTCommonPropaties {
/**
* The start and end location of the AST object.
*/
location?: FileRange$1;
}
/**
* This interface represents the properties of a dot AST node.
* @group AST
*/
type DotASTPropaties = ASTCommonPropaties;
interface DotASTPropaties extends ASTCommonPropaties {}
/**
* This interface defines the properties of a Graph AST Node.
* @group AST
*/
interface GraphASTPropaties extends ASTCommonPropaties {
/**
* An optional identifier for the Graph AST Node.
*/
id?: LiteralASTNode;
/**
* A boolean indicating whether the graph is directed.
*/
directed: boolean;
/**
* A boolean indicating whether the graph is strict.
*/
strict: boolean;
}
/**
* LiteralASTPropaties defines interface for literal AST nodes.
*
* @group AST
*/
interface LiteralASTPropaties<T extends string = string> extends ASTCommonPropaties {
/**
* The value of the literal.
*/
value: T;
/**
* A flag indicating whether the literal was quoted or not.
* If 'html' then the literal is an html like value.
*/
quoted: boolean | 'html';
}
/**
* SubgraphASTPropaties describes the properties of an AST node representing a subgraph.
* @group AST
*/
interface SubgraphASTPropaties extends ASTCommonPropaties {
/**
* id is an optional {@link LiteralASTNode} that represents the identifier of the subgraph.
*/
id?: LiteralASTNode;
}
/**
* SubgraphASTPropaties describes the properties of an AST node representing a node.
* @group AST
*/
interface NodeASTPropaties extends ASTCommonPropaties {
/**
* The unique identifier of the node.
*/
id: LiteralASTNode;
}
/**
* EdgeASTPropaties is an interface that defines the properties of an {@link EdgeASTNode}.
* @group AST
*/
interface EdgeASTPropaties extends ASTCommonPropaties {
/**
* An array of EdgeTargetASTNodes.
* The {@link EdgeTargetASTNode} represents a node that is the target of an edge.
*/
targets: [from: EdgeTargetASTNode, to: EdgeTargetASTNode, ...rest: EdgeTargetASTNode[]];
}
/**
* NodeRefASTPropaties is an interface that defines the properties of a {@link NodeRefASTNode}.
* @group AST

@@ -82,6 +138,8 @@ */

/**
* NodeRefGroupASTPropaties is an interface that defines the properties of a {@link NodeRefGroupASTNode}.
* @group AST
*/
type NodeRefGroupASTPropaties = ASTCommonPropaties;
interface NodeRefGroupASTPropaties extends ASTCommonPropaties {}
/**
* AttributeASTPropaties interface defines the properties of an {@link AttributeASTNode}.
* @group AST

@@ -94,2 +152,3 @@ */

/**
* AttributeListASTPropaties interface defines the properties of an {@link AttributeListASTNode}.
* @group AST

@@ -101,2 +160,4 @@ */

/**
* CommentKind is an enum type that describes a type of comment.
*
* @group AST

@@ -109,7 +170,16 @@ */

interface CommentASTPropaties extends ASTCommonPropaties {
/**
* A string that specifies the kind of comment.
*/
kind: CommentKind;
/**
* A string that contains the actual content of the comment.
*/
value: string;
}
/**
* AST node.
* ASTBaseNode is an interface that serves as the base for all AST nodes.
* It requires all leaf interfaces to specify a type property,
* which is of type {@link ASTType}.
*
* @group AST

@@ -125,2 +195,5 @@ */

/**
* ASTBaseParentNode represents a parent node that has some child nodes.
*
* @template STMT The type of {@link ASTBaseNode} to be stored in the children array.
* @group AST

@@ -132,2 +205,4 @@ */

/**
* LiteralASTNode is a type of AST node that represents a literal value.
*
* @group AST

@@ -139,2 +214,4 @@ */

/**
* DotASTNode is a type of AST node that represents a dot in a graph.
*
* @group AST

@@ -146,3 +223,4 @@ */

/**
* Graph AST object.
* GraphASTNode is a type of AST node that represents a graph.
*
* @group AST

@@ -154,3 +232,3 @@ */

/**
* Attribute AST object.
* AttributeASTNode is a type of AST node that represents an attribute.
* @group AST

@@ -164,3 +242,3 @@ */

/**
* Comment AST object.
* CommentASTNode is a type of AST node that represents a comment.
* @group AST

@@ -172,3 +250,3 @@ */

/**
* Attributes AST object.
* AttributeListASTNode is a type of AST node that represents a list of attributes.
* @group AST

@@ -180,3 +258,3 @@ */

/**
* NodeRef AST object.
* NodeRefASTNode is a type of AST node that represents a reference to a node.
* @group AST

@@ -188,3 +266,3 @@ */

/**
* NodeRefGroup AST object.
* NodeRefGroupASTNode is a type of AST node that represents a group of nodes referenced together.
* @group AST

@@ -196,2 +274,4 @@ */

/**
* This type is used to represent a target of an edge in an AST (Abstract Syntax Tree).
*
* @group AST

@@ -201,3 +281,3 @@ */

/**
* Edge AST object.
* EdgeASTNode is a type of AST node that represents an edge in a graph.
* @group AST

@@ -209,3 +289,3 @@ */

/**
* Node AST object.
* NodeASTNode is a type of AST node that represents a node in a graph.
* @group AST

@@ -217,3 +297,3 @@ */

/**
* Subgraph AST object.
* SubgraphASTNode is a type of AST node that represents a subgraph.
* @group AST

@@ -229,2 +309,3 @@ */

/**
* ClusterStatementASTNode is a type used to represent a statement in a cluster graph.
* @group AST

@@ -240,2 +321,4 @@ */

/**
* ASTNode is a type used to define a set of different types of AST nodes that can be used in a graph.
*
* @group AST

@@ -256,2 +339,3 @@ */

/**
* ASTChildNode is a type alias used to represent the child nodes of a given {@link ASTBaseParentNode}.
* @group AST

@@ -262,2 +346,4 @@ */

/**
* This interface is used to define the options for the builder.
*
* @group Create AST

@@ -267,5 +353,10 @@ * @alpha

interface BuilderOptions {
/**
* This is a function that returns a {@link FileRange} object.
* It is used to specify the location of the builder.
*/
locationFunction: () => FileRange$1;
}
/**
* This interface provides a method for creating an Abstract Syntax Tree (AST) for a given type.
* @group Create AST

@@ -275,2 +366,10 @@ * @alpha

interface CreateElement {
/**
* Creates a LiteralASTNode with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns A {@link LiteralASTNode} with the given type, properties, and children.
*/
<T extends string>(

@@ -281,7 +380,55 @@ type: 'Literal',

): LiteralASTNode<T>;
/**
* Creates a LiteralASTNode with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns A {@link LiteralASTNode} with the given type, properties, and children.
*/
(type: 'Literal', props: LiteralASTPropaties, children: ASTChildNode<LiteralASTNode>[]): LiteralASTNode;
/**
* Creates a {@link DotASTNode} with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns A {@link DotASTNode} with the given type, properties, and children.
*/
(type: 'Dot', props: DotASTPropaties, children: ASTChildNode<DotASTNode>[]): DotASTNode;
/**
* Creates a {@link GraphASTNode} with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns A {GraphASTNode} with the given type, properties, and children.
*/
(type: 'Graph', props: GraphASTPropaties, children: ASTChildNode<GraphASTNode>[]): GraphASTNode;
/**
* Creates an {@link AttributeASTNode} with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns An {@link AttributeASTNode} with the given type, properties, and children.
*/
(type: 'Attribute', props: AttributeASTPropaties, children: ASTChildNode<AttributeASTNode>[]): AttributeASTNode;
/**
* Creates a {@link CommentASTNode} with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns A {@link CommentASTNode} with the given type, properties, and children.
*/
(type: 'Comment', props: CommentASTPropaties, children: ASTChildNode<CommentASTNode>[]): CommentASTNode;
/**
* Creates an {@link AttributeListASTNode} with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns An {@link AttributeListASTNode} with the given type, properties, and children.
*/
(

@@ -292,3 +439,19 @@ type: 'AttributeList',

): AttributeListASTNode;
/**
* Creates a {@link NodeRefASTNode} with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns A {@link NodeRefASTNode} with the given type, properties, and children.
*/
(type: 'NodeRef', props: NodeRefASTPropaties, children: ASTChildNode<NodeRefASTNode>[]): NodeRefASTNode;
/**
* Creates a {@link NodeRefGroupASTNode} with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns A {@link NodeRefGroupASTNode} with the given type, properties, and children.
*/
(

@@ -299,7 +462,32 @@ type: 'NodeRefGroup',

): NodeRefGroupASTNode;
/**
* Creates an {@link EdgeASTNode} with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns An {@link EdgeASTNode} with the given type, properties, and children.
*/
(type: 'Edge', props: EdgeASTPropaties, children: ASTChildNode<EdgeASTNode>[]): EdgeASTNode;
/**
* Creates a {@link NodeASTNode} with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns A {@link NodeASTNode} with the given type, properties, and children.
*/
(type: 'Node', props: NodeASTPropaties, children: ASTChildNode<NodeASTNode>[]): NodeASTNode;
/**
* Creates a {@link SubgraphASTNode} with the given type, properties, and children.
*
* @param type The type of the AST node.
* @param props The properties of the AST node.
* @param children The children of the AST node.
* @returns A {@link SubgraphASTNode} with the given type, properties, and children.
*/
(type: 'Subgraph', props: SubgraphASTPropaties, children: ASTChildNode<SubgraphASTNode>[]): SubgraphASTNode;
}
/**
* This interface provides an ASTBuilder object with a createElement function.
* @group Create AST

@@ -313,2 +501,4 @@ * @alpha

/**
* Builder is an ASTBuilder that provides a method to create an ASTNode.
*
* @group Create AST

@@ -318,5 +508,20 @@ */

private options?;
/** @internal */
/**
* Get the current file range or null
* @internal
*/
private getLocation;
/**
* Constructor of Builder
* @param options - Options to initialize Builder
*/
constructor(options?: Partial<BuilderOptions> | undefined);
/**
* Create an {@link ASTNode} of the specified type
*
* @param type - Type of the {@link ASTNode}
* @param props - Properties of the {@link ASTNode}
* @param children - Children of the {@link ASTNode}
* @returns An {@link ASTNode}
*/
createElement<T extends ASTNode>(type: T['type'], props: any, children: ASTChildNode<T>[]): T;

@@ -326,3 +531,9 @@ }

/**
* Create an {@link ASTNode} of the specified type
*
* @param type - Type of the {@link ASTNode}
* @param props - Properties of the {@link ASTNode}
* @param children - Children of the {@link ASTNode}
* @group Create AST
* @returns An {@link ASTNode}
*/

@@ -332,2 +543,3 @@ declare const createElement: CreateElement;

/**
* The IndentStyle type represents an indentation style for text. It can either be a `"space"` or a `"tab"`.
* @group Convert AST to DOT

@@ -337,2 +549,3 @@ */

/**
* This type represents the EndOfLine type which is used to determine the type of line ending to be used when writing to a file.
* @group Convert AST to DOT

@@ -342,2 +555,3 @@ */

/**
* This interface provides options for converting an abstract syntax tree (AST) to a DOT representation.
* @group Convert AST to DOT

@@ -347,7 +561,23 @@ * @alpha

interface PrintOptions {
/**
* The style of indentation to use when printing the AST.
*
* @default "space"
*/
indentStyle?: IndentStyle;
/**
* The size of the indentation to use when printing the AST.
*
* @default 2
*/
indentSize?: number;
/**
* The type of line ending to use when printing the AST.
*
* @default lf
*/
endOfLine?: EndOfLine;
}
/**
* PrintContext interface provides an interface for printing an ASTNode with a set of options.
* @group Convert AST to DOT

@@ -357,6 +587,14 @@ * @alpha

interface PrintContext extends Required<PrintOptions> {
/**
* Indicates if the AST should be printed in a directed graph.
*/
directed: boolean;
/**
* A function to print an ASTNode, taking in an ASTNode as an argument. Returns a string.
*/
print(ast: ASTNode): string;
}
/**
* PrintPlugin is an interface for plugins used for printing an {@link ASTNode}.
* @template T T extends {@link ASTNode}
* @group Convert AST to DOT

@@ -366,3 +604,14 @@ * @alpha

interface PrintPlugin<T extends ASTNode = ASTNode> {
/**
* Checks if an ASTNode matches the plugin
* @returns {boolean} true if the ASTNode matches the plugin
*/
match(ast: ASTNode): boolean;
/**
* Prints an ASTNode
* @param context PrintContext object
* @param ast an ASTNode
* @returns printed string
* @memberof PrintPlugin
*/
print(context: PrintContext, ast: T): string;

@@ -372,2 +621,3 @@ }

/**
* Printer is a class responsible for converting an AST into a DOT string.
* @group Convert AST to DOT

@@ -378,3 +628,11 @@ */

private options;
/**
* @param options Options to be used when generating the DOT string.
*/
constructor(options?: PrintOptions);
/**
* Generates a DOT string from an ASTNode.
* @param ast The ASTNode to be converted into a DOT string.
* @returns The DOT string generated from the ASTNode.
*/
print(ast: ASTNode): string;

@@ -384,6 +642,7 @@ }

/**
* Stringify Graphviz AST Node.
* stringify is a function that converts a Graphviz AST Node into a string in DOT language.
*
* @param ast Graphviz AST node.
* @returns DOT language string.
* @param ast Graphviz AST node that is to be converted.
* @param options PrintOptions object containing formatting options.
* @returns A string in DOT language.
* @group Convert AST to DOT

@@ -447,8 +706,14 @@ */

/**
* CommonParseOptions is an interface that defines the properties needed in order to parse a file.
* @group Convert DOT to AST
*/
interface CommonParseOptions {
/**
* filename (optional): A string value that is used to identify the file to be parsed.
*/
filename?: string;
}
/**
* ParseOptions interface is used to provide additional information to the parser while parsing a rule.
* @template T The type of the rule to be parsed.
* @group Convert DOT to AST

@@ -460,2 +725,18 @@ */

/**
* parse is a function that takes a string input and optional parse options and
* returns an ASTNode or an array of ClusterStatementASTNodes.
*
* Depending on the type of parse option specified, the function will return different types of ASTNodes.
*
* The types of ASTNodes that can be returned are:
*
* - {@link DotASTNode}
* - {@link GraphASTNode}
* - {@link NodeASTNode}
* - {@link EdgeASTNode}
* - {@link AttributeListASTNode}
* - {@link AttributeASTNode}
* - {@link SubgraphASTNode}
* - {@link ClusterStatementASTNode}
*
* @throws {@link SyntaxError}

@@ -480,2 +761,14 @@ * @group Convert DOT to AST

/**
* ModelToAST is a type alias used to map a generic type T to a specific AST node type.
*
* If T is a DotObjectModel, the type U is inferred and used to determine which AST node type to map to.
*
* If U is 'Graph', the type is mapped to either a {@link GraphASTNode} or a {@link DotASTNode}.
* If U is 'AttributeList', the type is mapped to an {@link AttributeListASTNode}.
* If U is 'Edge', the type is mapped to an {@link EdgeASTNode}.
* If U is 'Node', the type is mapped to a {@link NodeASTNode}.
* If U is 'Subgraph', the type is mapped to a {@link SubgraphASTNode}.
*
* If T is not a DotObjectModel, the type is mapped to never.
*
* @group AST

@@ -520,2 +813,4 @@ */

/**
* FromModelConverter is a class used to convert a {@link DotObjectModel} into an ASTNode.
*
* @group Convert Model to AST

@@ -527,2 +822,8 @@ */

constructor(options?: ConvertFromModelOptions);
/**
* Converts a DotObjectModel into an AST.
*
* @param model The {@link DotObjectModel} to be converted.
* @returns The AST generated from the model.
*/
convert<T extends DotObjectModel>(model: T): ModelToAST<T>;

@@ -532,2 +833,8 @@ }

/**
* A function used to convert a DotObjectModel into an AST.
*
* @param model - The {@link DotObjectModel} to be converted.
* @param options - An optional {@link ConvertFromModelOptions} object.
* @returns ModelToAST - The AST representation of the {@link DotObjectModel}.
*
* @group Convert Model to AST

@@ -538,2 +845,3 @@ */

/**
* ModelOf is a type that determines the type of model to use depending on the value of T.
* @group AST

@@ -551,2 +859,4 @@ */

/**
* ASTToModel is a type that determines a model type from an AST.
*
* @group AST

@@ -560,2 +870,3 @@ */

/**
* This type is used to define what AST nodes can be converted to a model.
* @group Convert AST to Model

@@ -562,0 +873,0 @@ * @beta

@@ -1437,2 +1437,5 @@ /**

/**
* KeyValueMapping is an interface that defines a set of attributes that can be used to configure a graph.
*/
interface KeyValueMapping {

@@ -1613,2 +1616,5 @@ _background: string;

/**
* This type represents an Attribute, which is a key-value mapping of an {@link AttributeKey} to a value.
*
* @param T The {@link AttributeKey} to be mapped to a value.
* @group Attribute

@@ -1641,2 +1647,3 @@ */

/**
* ASTType is an enumeration of the different types of nodes that can be found in an AST(Abstract Syntax Tree ).
* @group Models

@@ -1731,5 +1738,11 @@ */

/**
* DotObjectModel is an interface that defines a generic type for a {@link DotObjectType}.
*
* @template T The type of the {@link DotObjectType}.
* @group Models
*/
interface DotObjectModel<T extends DotObjectType = DotObjectType> {
/**
* The type of the DotObjectType.
*/
$$type: T;

@@ -1736,0 +1749,0 @@ }

@@ -341,3 +341,10 @@ import {

/** @hidden */
/**
* ModelFactoryBuilder is a function that takes two parameters, directed and strictMode, and returns a ModelFactory.
*
* @param directed A boolean value indicating whether the graph should be directed or not.
* @param strictMode A boolean value indicating whether the graph should be in strict mode or not.
* @returns A ModelFactory that takes an array of unknowns as parameters and returns a RootGraphModel.
* @hidden
*/
function ModelFactoryBuilder(directed, strictMode) {

@@ -357,2 +364,9 @@ return (...args) => {

}
/**
* createModelFactories is a function that takes a boolean value, strict, and an optional ModelsContext parameter, context, and returns an object containing two ModelFactories.
*
* @param strict A boolean value indicating whether the graph should be in strict mode or not.
* @param context An optional ModelsContext parameter.
* @returns An object containing two ModelFactories, one for directed graphs and one for undirected graphs.
*/
function createModelFactories(strict, context = RootModelsContext) {

@@ -367,3 +381,3 @@ return Object.freeze({

/**
* API for creating directional graph objects.
* digraph is a factory for creating Digraph objects.
* @group Model Factory

@@ -373,3 +387,3 @@ */

/**
* API for creating omnidirectional graph objects.
* graph is a factory for creating Graph objects.
* @group Model Factory

@@ -384,3 +398,7 @@ */

/**
* @group Model Factory
* withContext creates a {@link ModelFactoriesWithStrict} object with the given context.
*
* @param models - An object containing the models to be used in the context.
*
* @returns A ModelFactoriesWithStrict object containing the factories. * @group Model Factory
*/

@@ -401,3 +419,3 @@ function withContext(models) {

* @param model Dot Object Model, like {@link Digraph}, {@link Graph}, {@link Subgraph}, {@link Node}, and {@link Edge}
* @param options
* @param options Optional options for the conversion.
* @returns DOT string

@@ -404,0 +422,0 @@ */

{
"name": "ts-graphviz",
"version": "1.5.4",
"author": "kamiazya <yuki@kamiazya.tech>",
"description": "Graphviz library for TypeScript.",
"homepage": "https://ts-graphviz.github.io/ts-graphviz/",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ts-graphviz/ts-graphviz.git"
},
"keywords": [
"graphviz",
"dot"
],
"bugs": {
"url": "https://github.com/ts-graphviz/ts-graphviz/issues"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/kamiazya"
},
"main": "./lib/index.cjs",
"module": "./lib/index.js",
"types": "lib/index.d.ts",
"exports": {
".": {
"require": {
"types": "./lib/index.d.ts",
"default": "./lib/index.cjs"
},
"import": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
}
"name": "ts-graphviz",
"version": "1.5.5-dev.02afc3340",
"author": "kamiazya <yuki@kamiazya.tech>",
"description": "Graphviz library for TypeScript.",
"homepage": "https://ts-graphviz.github.io/ts-graphviz/",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ts-graphviz/ts-graphviz.git"
},
"./ast": {
"require": {
"types": "./lib/ast/index.d.ts",
"default": "./lib/ast/index.cjs"
},
"import": {
"types": "./lib/ast/index.d.ts",
"default": "./lib/ast/index.js"
}
"keywords": [
"graphviz",
"dot"
],
"bugs": {
"url": "https://github.com/ts-graphviz/ts-graphviz/issues"
},
"./adapter": {
"browser": {
"require": "./lib/adapter/browser/index.cjs",
"import": "./lib/adapter/browser/index.js",
"types": "./lib/adapter/browser/index.d.ts"
},
"deno": {
"types": "./lib/adapter/deno/mod.d.ts",
"default": "./lib/adapter/deno/mod.js"
},
"node": {
"require": "./lib/adapter/node/index.cjs",
"import": "./lib/adapter/node/index.js",
"types": "./lib/adapter/node/index.d.ts"
},
"default": {
"types": "./lib/adapter/node/index.d.ts",
"require": "./lib/adapter/node/index.cjs",
"import": "./lib/adapter/node/index.js"
}
"funding": {
"type": "github",
"url": "https://github.com/sponsors/kamiazya"
},
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"ast": [
"lib/ast"
],
"adapter": [
"lib/adapter/node"
]
"main": "./lib/index.cjs",
"module": "./lib/index.js",
"types": "lib/index.d.ts",
"exports": {
".": {
"require": {
"types": "./lib/index.d.ts",
"default": "./lib/index.cjs"
},
"import": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
}
},
"./ast": {
"require": {
"types": "./lib/ast/index.d.ts",
"default": "./lib/ast/index.cjs"
},
"import": {
"types": "./lib/ast/index.d.ts",
"default": "./lib/ast/index.js"
}
},
"./adapter": {
"browser": {
"require": "./lib/adapter/browser/index.cjs",
"import": "./lib/adapter/browser/index.js",
"types": "./lib/adapter/browser/index.d.ts"
},
"deno": {
"types": "./lib/adapter/deno/mod.d.ts",
"default": "./lib/adapter/deno/mod.js"
},
"node": {
"require": "./lib/adapter/node/index.cjs",
"import": "./lib/adapter/node/index.js",
"types": "./lib/adapter/node/index.d.ts"
},
"default": {
"types": "./lib/adapter/node/index.d.ts",
"require": "./lib/adapter/node/index.cjs",
"import": "./lib/adapter/node/index.js"
}
},
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"ast": [
"lib/ast"
],
"adapter": [
"lib/adapter/node"
]
}
},
"license": "MIT",
"engines": {
"node": ">=14.16"
},
"runkitExampleFilename": "example/runkit.cjs",
"scripts": {
"build:peggy": "peggy --plugin ts-pegjs --extra-options-file src/ast/dot-shim/parser/peggy.options.json -o src/ast/dot-shim/parser/_parse.ts src/ast/dot-shim/parser/dot.peggy",
"prebuild": "yarn build:peggy",
"build:deno": "mkdir -p lib/adapter/deno && cp -r src/adapter/deno/* lib/adapter/deno && sed -i \"s/index.ts/index.js/g\" lib/adapter/deno/mod.js && sed -i \"s/index.ts/index.d.ts/g\" lib/adapter/deno/mod.d.ts",
"build:node": "tsc -p tsconfig.build.json && rollup -c",
"build": "yarn build:node && yarn build:deno",
"postbuild": "prettier --write ./lib/**/*.{js,cjs,d.ts}",
"pretest": "yarn build:peggy",
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
"format": "eslint --ext ts src --fix && prettier --write './**/*.{ts,js,json,yaml}' '!lib'",
"lint": "eslint --ext ts src",
"predoc": "yarn build:peggy",
"doc": "typedoc"
},
"devDependencies": {
"@rollup/plugin-replace": "^5.0.2",
"@types/jest": "^29.4.0",
"@types/jest-specific-snapshot": "^0.5.6",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"eslint": "^8.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.4.1",
"jest-snapshot-serializer-raw": "^1.2.0",
"jest-specific-snapshot": "^7.0.0",
"peggy": "^2.0.1",
"prettier": "^2.8.3",
"prettier-plugin-pegjs": "^0.5.0",
"rollup": "^3.11.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-dts": "5.1.1",
"svgo": "^3.0.2",
"ts-jest": "^29.0.5",
"ts-pegjs": "^3.0.0",
"typedoc": "^0.23.15",
"typescript": "^4.7.4"
}
},
"license": "MIT",
"engines": {
"node": ">=14.16"
},
"runkitExampleFilename": "example/runkit.cjs",
"scripts": {
"build:peggy": "peggy --plugin ts-pegjs --extra-options-file src/ast/dot-shim/parser/peggy.options.json -o src/ast/dot-shim/parser/_parse.ts src/ast/dot-shim/parser/dot.peggy",
"prebuild": "yarn build:peggy",
"build:deno": "mkdir -p lib/adapter/deno && cp -r src/adapter/deno/* lib/adapter/deno && sed -i \"s/index.ts/index.js/g\" lib/adapter/deno/mod.js && sed -i \"s/index.ts/index.d.ts/g\" lib/adapter/deno/mod.d.ts",
"build:node": "tsc -p tsconfig.build.json && rollup -c",
"build": "yarn build:node && yarn build:deno",
"postbuild": "prettier --write ./lib/**/*.{js,cjs,d.ts}",
"pretest": "yarn build:peggy",
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
"format": "eslint --ext ts src --fix && prettier --write './**/*.{ts,js,json,yaml}' '!lib'",
"lint": "eslint --ext ts src",
"predoc": "yarn build:peggy",
"doc": "typedoc"
},
"devDependencies": {
"@rollup/plugin-replace": "^5.0.2",
"@types/jest": "^29.4.0",
"@types/jest-specific-snapshot": "^0.5.6",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"eslint": "^8.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.4.1",
"jest-snapshot-serializer-raw": "^1.2.0",
"jest-specific-snapshot": "^7.0.0",
"peggy": "^2.0.1",
"prettier": "^2.8.3",
"prettier-plugin-pegjs": "^0.5.0",
"rollup": "^3.11.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-dts": "5.1.1",
"svgo": "^3.0.2",
"ts-jest": "^29.0.5",
"ts-pegjs": "^3.0.0",
"typedoc": "^0.23.15",
"typescript": "^4.7.4"
}
}
}

@@ -548,2 +548,3 @@ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d6485f9858ed4b3e8ef76611a2896bc4)](https://app.codacy.com/gh/ts-graphviz/ts-graphviz?utm_source=github.com&utm_medium=referral&utm_content=ts-graphviz/ts-graphviz&utm_campaign=Badge_Grade_Settings)

<td align="center" valign="top" width="14.28%"><a href="https://github.com/seethroughdev"><img src="https://avatars.githubusercontent.com/u/203779?v=4?s=100" width="100px;" alt="Adam"/><br /><sub><b>Adam</b></sub></a><br /><a href="#question-seethroughdev" title="Answering Questions">💬</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/trevor-scheer"><img src="https://avatars.githubusercontent.com/u/29644393?v=4?s=100" width="100px;" alt="Trevor Scheer"/><br /><sub><b>Trevor Scheer</b></sub></a><br /><a href="#a11y-trevor-scheer" title="Accessibility">️️️️♿️</a></td>
</tr>

@@ -550,0 +551,0 @@ </tbody>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc