@ts-graphviz/ast 0.0.0-pr956-20240225073457 → 0.0.0-pr956-20240225160253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +291 -3
- package/lib/ast.cjs +25 -60
- package/lib/ast.js +25 -60
- package/package.json +43 -24
- package/src/ast.ts +0 -8
- package/src/builder/__snapshots__/create-element.test.ts.snap +0 -166
- package/src/builder/builder.test.ts +0 -36
- package/src/builder/builder.ts +0 -44
- package/src/builder/create-element.test.ts +0 -110
- package/src/builder/create-element.ts +0 -13
- package/src/builder/index.ts +0 -3
- package/src/builder/types.ts +0 -226
- package/src/dot-shim/index.ts +0 -2
- package/src/dot-shim/parser/__snapshots__/parse.test.ts.snap +0 -2613
- package/src/dot-shim/parser/dot.peggy +0 -396
- package/src/dot-shim/parser/index.ts +0 -1
- package/src/dot-shim/parser/parse.test.ts +0 -263
- package/src/dot-shim/parser/parse.ts +0 -121
- package/src/dot-shim/parser/peggy.options.json +0 -15
- package/src/dot-shim/printer/index.ts +0 -6
- package/src/dot-shim/printer/plugins/AttributeListPrintPlugin.ts +0 -22
- package/src/dot-shim/printer/plugins/AttributePrintPlugin.ts +0 -11
- package/src/dot-shim/printer/plugins/CommentPrintPlugin.ts +0 -40
- package/src/dot-shim/printer/plugins/DotPrintPlugin.ts +0 -12
- package/src/dot-shim/printer/plugins/EdgePrintPlugin.ts +0 -27
- package/src/dot-shim/printer/plugins/GraphPrintPlugin.ts +0 -32
- package/src/dot-shim/printer/plugins/LiteralPrintPlugin.ts +0 -24
- package/src/dot-shim/printer/plugins/NodePrintPlugin.ts +0 -24
- package/src/dot-shim/printer/plugins/NodeRefGroupPrintPlugin.ts +0 -17
- package/src/dot-shim/printer/plugins/NodeRefPrintPlugin.ts +0 -18
- package/src/dot-shim/printer/plugins/SubgraphPrintPlugin.ts +0 -27
- package/src/dot-shim/printer/plugins/index.ts +0 -26
- package/src/dot-shim/printer/plugins/utils/index.ts +0 -1
- package/src/dot-shim/printer/plugins/utils/tokens.ts +0 -51
- package/src/dot-shim/printer/printer.ts +0 -46
- package/src/dot-shim/printer/stringify.test.ts +0 -823
- package/src/dot-shim/printer/stringify.ts +0 -19
- package/src/dot-shim/printer/types.ts +0 -74
- package/src/model-shim/from-model/converter.ts +0 -43
- package/src/model-shim/from-model/from-model.ts +0 -19
- package/src/model-shim/from-model/index.ts +0 -3
- package/src/model-shim/from-model/plugins/AttributeListPlugin.ts +0 -19
- package/src/model-shim/from-model/plugins/EdgePlugin.ts +0 -140
- package/src/model-shim/from-model/plugins/GraphPlugin.ts +0 -36
- package/src/model-shim/from-model/plugins/NodePlugin.ts +0 -33
- package/src/model-shim/from-model/plugins/SubraphPlugin.ts +0 -28
- package/src/model-shim/from-model/plugins/index.ts +0 -13
- package/src/model-shim/from-model/plugins/utils/convert-attribute.ts +0 -47
- package/src/model-shim/from-model/plugins/utils/convert-cluster-children.ts +0 -44
- package/src/model-shim/from-model/plugins/utils/convert-comment.ts +0 -16
- package/src/model-shim/from-model/plugins/utils/index.ts +0 -3
- package/src/model-shim/from-model/types.ts +0 -62
- package/src/model-shim/index.ts +0 -2
- package/src/model-shim/to-model/converter.ts +0 -42
- package/src/model-shim/to-model/index.ts +0 -3
- package/src/model-shim/to-model/plugins/DotPlugin.ts +0 -25
- package/src/model-shim/to-model/plugins/EdgePlugin.ts +0 -26
- package/src/model-shim/to-model/plugins/GraphPlugin.ts +0 -15
- package/src/model-shim/to-model/plugins/NodePlugin.ts +0 -25
- package/src/model-shim/to-model/plugins/SubgraphPlugin.ts +0 -14
- package/src/model-shim/to-model/plugins/index.ts +0 -13
- package/src/model-shim/to-model/plugins/utils/apply-statments.ts +0 -96
- package/src/model-shim/to-model/plugins/utils/comment-holder.ts +0 -31
- package/src/model-shim/to-model/plugins/utils/convert-to-edge-target-tuple.ts +0 -21
- package/src/model-shim/to-model/to-model.test.ts +0 -34
- package/src/model-shim/to-model/to-model.ts +0 -16
- package/src/model-shim/to-model/types.ts +0 -71
- package/src/types.ts +0 -370
- package/tsconfig.json +0 -8
- package/typedoc.json +0 -4
- package/vite.config.ts +0 -22
package/src/builder/types.ts
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { AttributeKey } from '@ts-graphviz/common';
|
|
2
|
-
import type {
|
|
3
|
-
ASTChildNode,
|
|
4
|
-
AttributeASTNode,
|
|
5
|
-
AttributeASTPropaties,
|
|
6
|
-
AttributeListASTNode,
|
|
7
|
-
AttributeListASTPropaties,
|
|
8
|
-
CommentASTNode,
|
|
9
|
-
CommentASTPropaties,
|
|
10
|
-
DotASTNode,
|
|
11
|
-
DotASTPropaties,
|
|
12
|
-
EdgeASTNode,
|
|
13
|
-
EdgeASTPropaties,
|
|
14
|
-
FileRange,
|
|
15
|
-
GraphASTNode,
|
|
16
|
-
GraphASTPropaties,
|
|
17
|
-
LiteralASTNode,
|
|
18
|
-
LiteralASTPropaties,
|
|
19
|
-
NodeASTNode,
|
|
20
|
-
NodeASTPropaties,
|
|
21
|
-
NodeRefASTNode,
|
|
22
|
-
NodeRefASTPropaties,
|
|
23
|
-
NodeRefGroupASTNode,
|
|
24
|
-
NodeRefGroupASTPropaties,
|
|
25
|
-
SubgraphASTNode,
|
|
26
|
-
SubgraphASTPropaties,
|
|
27
|
-
} from '../types.js';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* This interface is used to define the options for the builder.
|
|
31
|
-
*
|
|
32
|
-
* @group Create AST
|
|
33
|
-
*/
|
|
34
|
-
export interface BuilderOptions {
|
|
35
|
-
/**
|
|
36
|
-
* This is a function that returns a {@link FileRange} object.
|
|
37
|
-
* It is used to specify the location of the builder.
|
|
38
|
-
*/
|
|
39
|
-
locationFunction: () => FileRange;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* This interface provides a method for creating an Abstract Syntax Tree (AST) for a given type.
|
|
44
|
-
* @group Create AST
|
|
45
|
-
*/
|
|
46
|
-
export interface CreateElement {
|
|
47
|
-
/**
|
|
48
|
-
* Creates a LiteralASTNode with the given type, properties, and children.
|
|
49
|
-
*
|
|
50
|
-
* @param type The type of the AST node.
|
|
51
|
-
* @param props The properties of the AST node.
|
|
52
|
-
* @param children The children of the AST node.
|
|
53
|
-
* @returns A {@link LiteralASTNode} with the given type, properties, and children.
|
|
54
|
-
*/
|
|
55
|
-
<T extends string>(
|
|
56
|
-
type: 'Literal',
|
|
57
|
-
props: LiteralASTPropaties<T>,
|
|
58
|
-
children?: ASTChildNode<LiteralASTNode>[],
|
|
59
|
-
): LiteralASTNode<T>;
|
|
60
|
-
/**
|
|
61
|
-
* Creates a LiteralASTNode with the given type, properties, and children.
|
|
62
|
-
*
|
|
63
|
-
* @param type The type of the AST node.
|
|
64
|
-
* @param props The properties of the AST node.
|
|
65
|
-
* @param children The children of the AST node.
|
|
66
|
-
* @returns A {@link LiteralASTNode} with the given type, properties, and children.
|
|
67
|
-
*/
|
|
68
|
-
(
|
|
69
|
-
type: 'Literal',
|
|
70
|
-
props: LiteralASTPropaties,
|
|
71
|
-
children?: ASTChildNode<LiteralASTNode>[],
|
|
72
|
-
): LiteralASTNode;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Creates a {@link DotASTNode} with the given type, properties, and children.
|
|
76
|
-
*
|
|
77
|
-
* @param type The type of the AST node.
|
|
78
|
-
* @param props The properties of the AST node.
|
|
79
|
-
* @param children The children of the AST node.
|
|
80
|
-
* @returns A {@link DotASTNode} with the given type, properties, and children.
|
|
81
|
-
*/
|
|
82
|
-
(
|
|
83
|
-
type: 'Dot',
|
|
84
|
-
props: DotASTPropaties,
|
|
85
|
-
children?: ASTChildNode<DotASTNode>[],
|
|
86
|
-
): DotASTNode;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Creates a {@link GraphASTNode} with the given type, properties, and children.
|
|
90
|
-
*
|
|
91
|
-
* @param type The type of the AST node.
|
|
92
|
-
* @param props The properties of the AST node.
|
|
93
|
-
* @param children The children of the AST node.
|
|
94
|
-
* @returns A {GraphASTNode} with the given type, properties, and children.
|
|
95
|
-
*/
|
|
96
|
-
(
|
|
97
|
-
type: 'Graph',
|
|
98
|
-
props: GraphASTPropaties,
|
|
99
|
-
children?: ASTChildNode<GraphASTNode>[],
|
|
100
|
-
): GraphASTNode;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Creates an {@link AttributeASTNode} with the given type, properties, and children.
|
|
104
|
-
*
|
|
105
|
-
* @param type The type of the AST node.
|
|
106
|
-
* @param props The properties of the AST node.
|
|
107
|
-
* @param children The children of the AST node.
|
|
108
|
-
* @returns An {@link AttributeASTNode} with the given type, properties, and children.
|
|
109
|
-
*/
|
|
110
|
-
<K extends AttributeKey>(
|
|
111
|
-
type: 'Attribute',
|
|
112
|
-
props: AttributeASTPropaties<K>,
|
|
113
|
-
children?: ASTChildNode<AttributeASTNode>[],
|
|
114
|
-
): AttributeASTNode<K>;
|
|
115
|
-
(
|
|
116
|
-
type: 'Attribute',
|
|
117
|
-
props: AttributeASTPropaties,
|
|
118
|
-
children?: ASTChildNode<AttributeASTNode>[],
|
|
119
|
-
): AttributeASTNode;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Creates a {@link CommentASTNode} with the given type, properties, and children.
|
|
123
|
-
*
|
|
124
|
-
* @param type The type of the AST node.
|
|
125
|
-
* @param props The properties of the AST node.
|
|
126
|
-
* @param children The children of the AST node.
|
|
127
|
-
* @returns A {@link CommentASTNode} with the given type, properties, and children.
|
|
128
|
-
*/
|
|
129
|
-
(
|
|
130
|
-
type: 'Comment',
|
|
131
|
-
props: CommentASTPropaties,
|
|
132
|
-
children?: ASTChildNode<CommentASTNode>[],
|
|
133
|
-
): CommentASTNode;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Creates an {@link AttributeListASTNode} with the given type, properties, and children.
|
|
137
|
-
*
|
|
138
|
-
* @param type The type of the AST node.
|
|
139
|
-
* @param props The properties of the AST node.
|
|
140
|
-
* @param children The children of the AST node.
|
|
141
|
-
* @returns An {@link AttributeListASTNode} with the given type, properties, and children.
|
|
142
|
-
*/
|
|
143
|
-
(
|
|
144
|
-
type: 'AttributeList',
|
|
145
|
-
props: AttributeListASTPropaties,
|
|
146
|
-
children?: ASTChildNode<AttributeListASTNode>[],
|
|
147
|
-
): AttributeListASTNode;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Creates a {@link NodeRefASTNode} with the given type, properties, and children.
|
|
151
|
-
*
|
|
152
|
-
* @param type The type of the AST node.
|
|
153
|
-
* @param props The properties of the AST node.
|
|
154
|
-
* @param children The children of the AST node.
|
|
155
|
-
* @returns A {@link NodeRefASTNode} with the given type, properties, and children.
|
|
156
|
-
*/
|
|
157
|
-
(
|
|
158
|
-
type: 'NodeRef',
|
|
159
|
-
props: NodeRefASTPropaties,
|
|
160
|
-
children?: ASTChildNode<NodeRefASTNode>[],
|
|
161
|
-
): NodeRefASTNode;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Creates a {@link NodeRefGroupASTNode} with the given type, properties, and children.
|
|
165
|
-
*
|
|
166
|
-
* @param type The type of the AST node.
|
|
167
|
-
* @param props The properties of the AST node.
|
|
168
|
-
* @param children The children of the AST node.
|
|
169
|
-
* @returns A {@link NodeRefGroupASTNode} with the given type, properties, and children.
|
|
170
|
-
*/
|
|
171
|
-
(
|
|
172
|
-
type: 'NodeRefGroup',
|
|
173
|
-
props: NodeRefGroupASTPropaties,
|
|
174
|
-
children?: ASTChildNode<NodeRefGroupASTNode>[],
|
|
175
|
-
): NodeRefGroupASTNode;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Creates an {@link EdgeASTNode} with the given type, properties, and children.
|
|
179
|
-
*
|
|
180
|
-
* @param type The type of the AST node.
|
|
181
|
-
* @param props The properties of the AST node.
|
|
182
|
-
* @param children The children of the AST node.
|
|
183
|
-
* @returns An {@link EdgeASTNode} with the given type, properties, and children.
|
|
184
|
-
*/
|
|
185
|
-
(
|
|
186
|
-
type: 'Edge',
|
|
187
|
-
props: EdgeASTPropaties,
|
|
188
|
-
children?: ASTChildNode<EdgeASTNode>[],
|
|
189
|
-
): EdgeASTNode;
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Creates a {@link NodeASTNode} with the given type, properties, and children.
|
|
193
|
-
*
|
|
194
|
-
* @param type The type of the AST node.
|
|
195
|
-
* @param props The properties of the AST node.
|
|
196
|
-
* @param children The children of the AST node.
|
|
197
|
-
* @returns A {@link NodeASTNode} with the given type, properties, and children.
|
|
198
|
-
*/
|
|
199
|
-
(
|
|
200
|
-
type: 'Node',
|
|
201
|
-
props: NodeASTPropaties,
|
|
202
|
-
children?: ASTChildNode<NodeASTNode>[],
|
|
203
|
-
): NodeASTNode;
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Creates a {@link SubgraphASTNode} with the given type, properties, and children.
|
|
207
|
-
*
|
|
208
|
-
* @param type The type of the AST node.
|
|
209
|
-
* @param props The properties of the AST node.
|
|
210
|
-
* @param children The children of the AST node.
|
|
211
|
-
* @returns A {@link SubgraphASTNode} with the given type, properties, and children.
|
|
212
|
-
*/
|
|
213
|
-
(
|
|
214
|
-
type: 'Subgraph',
|
|
215
|
-
props: SubgraphASTPropaties,
|
|
216
|
-
children?: ASTChildNode<SubgraphASTNode>[],
|
|
217
|
-
): SubgraphASTNode;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* This interface provides an ASTBuilder object with a createElement function.
|
|
222
|
-
* @group Create AST
|
|
223
|
-
*/
|
|
224
|
-
export interface ASTBuilder {
|
|
225
|
-
createElement: CreateElement;
|
|
226
|
-
}
|
package/src/dot-shim/index.ts
DELETED