@coral-viz/language 0.2.3

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.
Files changed (47) hide show
  1. package/LICENSE +4 -0
  2. package/README.md +5 -0
  3. package/dist/diagnostics.d.ts +81 -0
  4. package/dist/diagnostics.d.ts.map +1 -0
  5. package/dist/diagnostics.js +59 -0
  6. package/dist/diagnostics.js.map +1 -0
  7. package/dist/formats/dot.d.ts +23 -0
  8. package/dist/formats/dot.d.ts.map +1 -0
  9. package/dist/formats/dot.js +541 -0
  10. package/dist/formats/dot.js.map +1 -0
  11. package/dist/formats/index.d.ts +6 -0
  12. package/dist/formats/index.d.ts.map +1 -0
  13. package/dist/formats/index.js +6 -0
  14. package/dist/formats/index.js.map +1 -0
  15. package/dist/formats/mermaid.d.ts +29 -0
  16. package/dist/formats/mermaid.d.ts.map +1 -0
  17. package/dist/formats/mermaid.js +1051 -0
  18. package/dist/formats/mermaid.js.map +1 -0
  19. package/dist/formats/plantuml.d.ts +20 -0
  20. package/dist/formats/plantuml.d.ts.map +1 -0
  21. package/dist/formats/plantuml.js +271 -0
  22. package/dist/formats/plantuml.js.map +1 -0
  23. package/dist/ids.d.ts +36 -0
  24. package/dist/ids.d.ts.map +1 -0
  25. package/dist/ids.js +69 -0
  26. package/dist/ids.js.map +1 -0
  27. package/dist/index.d.ts +11 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +14 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/parser/index.d.ts +13 -0
  32. package/dist/parser/index.d.ts.map +1 -0
  33. package/dist/parser/index.js +415 -0
  34. package/dist/parser/index.js.map +1 -0
  35. package/dist/printer/index.d.ts +47 -0
  36. package/dist/printer/index.d.ts.map +1 -0
  37. package/dist/printer/index.js +392 -0
  38. package/dist/printer/index.js.map +1 -0
  39. package/dist/strings.d.ts +17 -0
  40. package/dist/strings.d.ts.map +1 -0
  41. package/dist/strings.js +48 -0
  42. package/dist/strings.js.map +1 -0
  43. package/dist/types.d.ts +40 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/dist/types.js +2 -0
  46. package/dist/types.js.map +1 -0
  47. package/package.json +64 -0
@@ -0,0 +1,415 @@
1
+ /**
2
+ * Coral DSL Parser
3
+ *
4
+ * Parses Coral DSL text into Graph-IR format.
5
+ */
6
+ import { IdAllocator, allocateEdgeId, labelToId } from '../ids.js';
7
+ import { unescapeString } from '../strings.js';
8
+ import { finishParse, parseDiagnostic, } from '../diagnostics.js';
9
+ /**
10
+ * Parse Coral DSL text into Graph-IR
11
+ */
12
+ export function parse(source, options = {}) {
13
+ const { includeSourceInfo = false, graphId = 'coral-graph', graphName, } = options;
14
+ // Create context for parsing
15
+ const ctx = {
16
+ source,
17
+ includeSourceInfo,
18
+ nodeIds: new IdAllocator(),
19
+ edgeIds: new IdAllocator(),
20
+ diagnostics: [],
21
+ };
22
+ // The portable TypeScript parser is the supported 0.2 runtime. The
23
+ // Tree-sitter grammar is shipped and tested separately for editor tooling.
24
+ const parseResult = parseSource(ctx);
25
+ // The graph is returned even on failure: one bad line must not discard
26
+ // everything that parsed (R-009 AC-8).
27
+ const graph = {
28
+ version: '1.0.0',
29
+ id: graphId,
30
+ nodes: parseResult.nodes,
31
+ edges: parseResult.edges,
32
+ };
33
+ if (graphName) {
34
+ graph.name = graphName;
35
+ }
36
+ return finishParse(ctx.diagnostics, graph);
37
+ }
38
+ /** Record a diagnostic on the context. */
39
+ function report(ctx, severity, code, message, position, source) {
40
+ ctx.diagnostics.push(parseDiagnostic({ severity, code, message, position, source }));
41
+ }
42
+ /**
43
+ * Pure JS parser implementation
44
+ * This is a simplified parser that handles the core Coral DSL syntax
45
+ */
46
+ function parseSource(ctx) {
47
+ const nodes = [];
48
+ const edges = [];
49
+ const lines = ctx.source.split('\n');
50
+ let currentOffset = 0;
51
+ let lineNumber = 0;
52
+ // Track brace depth for parsing bodies
53
+ const braceStack = [];
54
+ for (const line of lines) {
55
+ lineNumber++;
56
+ const trimmed = line.trim();
57
+ // Skip empty lines and comments
58
+ if (!trimmed || trimmed.startsWith('//')) {
59
+ currentOffset += line.length + 1;
60
+ continue;
61
+ }
62
+ // Handle closing braces
63
+ if (trimmed === '}') {
64
+ if (braceStack.length === 0) {
65
+ report(ctx, 'error', 'coral.brace.unparsed', 'Unmatched closing brace', { line: lineNumber, column: line.indexOf('}'), offset: currentOffset }, trimmed);
66
+ }
67
+ braceStack.pop();
68
+ currentOffset += line.length + 1;
69
+ continue;
70
+ }
71
+ // Try to parse node declaration
72
+ const nodeMatch = parseNodeDeclaration(trimmed, ctx, currentOffset, lineNumber);
73
+ if (nodeMatch) {
74
+ if (braceStack.length > 0) {
75
+ // This is a child node
76
+ const parent = braceStack[braceStack.length - 1].node;
77
+ nodeMatch.parent = parent.id;
78
+ if (!parent.children) {
79
+ parent.children = [];
80
+ }
81
+ parent.children.push(nodeMatch);
82
+ }
83
+ else {
84
+ nodes.push(nodeMatch);
85
+ }
86
+ // Check if this node has a body (but not empty body like { })
87
+ if (trimmed.endsWith('{') && !trimmed.endsWith('{ }') && !trimmed.endsWith('{}')) {
88
+ braceStack.push({
89
+ node: nodeMatch,
90
+ indent: line.search(/\S/),
91
+ opened: { line: lineNumber, column: Math.max(line.indexOf('{'), 0), offset: currentOffset },
92
+ });
93
+ }
94
+ currentOffset += line.length + 1;
95
+ continue;
96
+ }
97
+ // Try to parse property (inside node body)
98
+ const propertyMatch = parseProperty(trimmed);
99
+ if (propertyMatch && braceStack.length > 0) {
100
+ const parent = braceStack[braceStack.length - 1].node;
101
+ if (!parent.properties) {
102
+ parent.properties = {};
103
+ }
104
+ if (propertyMatch.key.startsWith('_')) {
105
+ report(ctx, 'info', 'coral.property.reserved-key.dropped', `Property key "${propertyMatch.key}" is reserved for internal use and is not stored`, { line: lineNumber, column: 0, offset: currentOffset }, trimmed);
106
+ }
107
+ else {
108
+ parent.properties[propertyMatch.key] = propertyMatch.value;
109
+ }
110
+ currentOffset += line.length + 1;
111
+ continue;
112
+ }
113
+ // Try to parse edge declaration
114
+ const edgeMatch = parseEdgeDeclaration(trimmed, ctx, currentOffset, lineNumber);
115
+ if (edgeMatch) {
116
+ edges.push(edgeMatch);
117
+ currentOffset += line.length + 1;
118
+ continue;
119
+ }
120
+ // Unknown syntax - report error
121
+ report(ctx, 'error', 'coral.line.unparsed', `Unexpected syntax: ${trimmed}`, { line: lineNumber, column: 0, offset: currentOffset }, trimmed);
122
+ currentOffset += line.length + 1;
123
+ }
124
+ // Check for unclosed braces
125
+ for (const unclosed of braceStack) {
126
+ report(ctx, 'error', 'coral.brace.unparsed', 'Unclosed brace', unclosed.opened);
127
+ }
128
+ return {
129
+ success: !ctx.diagnostics.some((d) => d.severity === 'error'),
130
+ nodes,
131
+ edges,
132
+ };
133
+ }
134
+ function parseNodeDeclaration(line, ctx, offset, lineNumber) {
135
+ // Match: node_type "label" [as id] [{ ...]
136
+ const NUM = '-?\\d+(?:\\.\\d+)?';
137
+ const nodeRegex = new RegExp('^([A-Za-z_][\\w-]*)\\s+"((?:[^"\\\\]|\\\\.)*)"' +
138
+ '(?:\\s+as\\s+(?:"((?:[^"\\\\]|\\\\.)*)"|([A-Za-z_][A-Za-z0-9_]*)))?' +
139
+ `(?:\\s*@\\s*\\(\\s*(${NUM})\\s*,\\s*(${NUM})\\s*\\))?` +
140
+ '(\\s+pinned)?' +
141
+ '(\\s*\\{\\s*\\}|\\s*\\{)?$');
142
+ const match = line.match(nodeRegex);
143
+ if (!match) {
144
+ return null;
145
+ }
146
+ const nodeType = match[1];
147
+ const label = unescapeString(match[2]);
148
+ const explicitId = match[3] !== undefined ? unescapeString(match[3]) : match[4];
149
+ const posX = match[5];
150
+ const posY = match[6];
151
+ const isPinned = match[7] !== undefined;
152
+ let id;
153
+ if (explicitId === '') {
154
+ report(ctx, 'warning', 'coral.node.id.degraded', 'An empty id clause cannot be honoured; the id was derived from the label instead', { line: lineNumber, column: 0, offset }, line);
155
+ id = ctx.nodeIds.allocateFromLabel(label);
156
+ }
157
+ else if (explicitId !== undefined) {
158
+ if (ctx.nodeIds.reserve(explicitId)) {
159
+ id = explicitId;
160
+ }
161
+ else {
162
+ // The id is already spoken for, so the reservation cannot be honoured.
163
+ id = ctx.nodeIds.allocateFromLabel(label);
164
+ report(ctx, 'warning', 'coral.node.id.degraded', `Node id "${explicitId}" is already in use; this declaration was given "${id}"`, { line: lineNumber, column: 0, offset }, line);
165
+ }
166
+ }
167
+ else {
168
+ id = ctx.nodeIds.allocateFromLabel(label);
169
+ }
170
+ const node = {
171
+ id,
172
+ type: nodeType,
173
+ label,
174
+ };
175
+ // Geometry is a first-class clause, not a property (R-017).
176
+ if (posX !== undefined && posY !== undefined) {
177
+ node.position = { x: Number(posX), y: Number(posY) };
178
+ }
179
+ if (isPinned) {
180
+ node.pinned = true;
181
+ }
182
+ if (ctx.includeSourceInfo) {
183
+ node.sourceInfo = {
184
+ range: {
185
+ start: offset,
186
+ end: offset + line.length,
187
+ startPosition: { line: lineNumber, column: 0 },
188
+ endPosition: { line: lineNumber, column: line.length },
189
+ },
190
+ };
191
+ }
192
+ return node;
193
+ }
194
+ function parseProperty(line) {
195
+ // Match: key: "value" (string), key: 123 (number), key: true/false (boolean)
196
+ const keyMatch = line.match(/^(?:"((?:[^"\\]|\\.)*)"|([a-zA-Z_][a-zA-Z0-9_]*))\s*:\s*/);
197
+ if (!keyMatch)
198
+ return null;
199
+ const key = keyMatch[1] !== undefined ? unescapeString(keyMatch[1]) : keyMatch[2];
200
+ const rest = line.slice(keyMatch[0].length);
201
+ // Try string value: "..."
202
+ if (rest.startsWith('"')) {
203
+ // Find closing quote, handling escape sequences
204
+ let i = 1;
205
+ let value = '';
206
+ while (i < rest.length) {
207
+ if (rest[i] === '\\' && i + 1 < rest.length) {
208
+ const next = rest[i + 1];
209
+ if (next === 'n') {
210
+ value += '\n';
211
+ i += 2;
212
+ }
213
+ else if (next === 't') {
214
+ value += '\t';
215
+ i += 2;
216
+ }
217
+ else if (next === 'r') {
218
+ value += '\r';
219
+ i += 2;
220
+ }
221
+ else if (next === '"') {
222
+ value += '"';
223
+ i += 2;
224
+ }
225
+ else if (next === '\\') {
226
+ value += '\\';
227
+ i += 2;
228
+ }
229
+ else {
230
+ value += rest[i];
231
+ i++;
232
+ }
233
+ }
234
+ else if (rest[i] === '"') {
235
+ // Check nothing after closing quote
236
+ if (i + 1 === rest.length) {
237
+ return { key, value };
238
+ }
239
+ return null; // Trailing content after closing quote
240
+ }
241
+ else {
242
+ value += rest[i];
243
+ i++;
244
+ }
245
+ }
246
+ return null; // Unterminated string
247
+ }
248
+ // Try boolean
249
+ if (rest === 'true')
250
+ return { key, value: true };
251
+ if (rest === 'false')
252
+ return { key, value: false };
253
+ // Try number. The pattern must accept everything String(n) can emit for a
254
+ // finite number, including exponent form such as 1e-7 and 1e+21.
255
+ if (/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(rest)) {
256
+ const value = Number(rest);
257
+ if (Number.isFinite(value))
258
+ return { key, value };
259
+ }
260
+ return null;
261
+ }
262
+ function parseEdgeDeclaration(line, ctx, offset, lineNumber) {
263
+ // Match: source -> target [type, attr = "value"]
264
+ const ENDPOINT = '(?:"((?:[^"\\\\]|\\\\.)*)"|([A-Za-z_][A-Za-z0-9_]*))';
265
+ const edgeRegex = new RegExp(`^${ENDPOINT}\\s*->\\s*${ENDPOINT}(?:\\s*\\[(.+?)\\])?((?:\\s+via(?:\\s*\\(\\s*-?\\d+(?:\\.\\d+)?\\s*,\\s*-?\\d+(?:\\.\\d+)?\\s*\\))+)?)$`);
266
+ const match = line.match(edgeRegex);
267
+ if (!match) {
268
+ return null;
269
+ }
270
+ const source = match[1] !== undefined ? unescapeString(match[1]) : match[2];
271
+ const target = match[3] !== undefined ? unescapeString(match[3]) : match[4];
272
+ const attributes = match[5];
273
+ const waypointClause = match[6];
274
+ const edgeId = allocateEdgeId(source, target, ctx.edgeIds);
275
+ const edge = {
276
+ id: edgeId,
277
+ source,
278
+ target,
279
+ };
280
+ // Parse attributes if present
281
+ if (attributes) {
282
+ for (const attr of scanAttributes(attributes)) {
283
+ if (attr.kind === 'bare') {
284
+ // A bare token spelling a line style is one; anything else, and any
285
+ // quoted leading token, is the relation type.
286
+ if (attr.value === 'solid' || attr.value === 'dashed' || attr.value === 'dotted') {
287
+ edge.style = { lineStyle: attr.value };
288
+ }
289
+ else if (edge.type === undefined) {
290
+ edge.type = attr.value;
291
+ }
292
+ continue;
293
+ }
294
+ if (attr.kind === 'quotedBare') {
295
+ if (edge.type === undefined)
296
+ edge.type = attr.value;
297
+ continue;
298
+ }
299
+ if (attr.key === 'label') {
300
+ edge.label = attr.value;
301
+ continue;
302
+ }
303
+ // Reserved for internal use; dropped on both sides (R-009 AC-7).
304
+ if (attr.key.startsWith('_')) {
305
+ report(ctx, 'info', 'coral.edge.reserved-key.dropped', `Attribute key "${attr.key}" is reserved for internal use and is not stored`, { line: lineNumber, column: 0, offset }, line);
306
+ continue;
307
+ }
308
+ if (!edge.properties)
309
+ edge.properties = {};
310
+ edge.properties[attr.key] = attr.value;
311
+ }
312
+ }
313
+ // Waypoints follow the attributes (R-018).
314
+ if (waypointClause) {
315
+ const points = [];
316
+ const pointRe = /\(\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*\)/g;
317
+ let m;
318
+ while ((m = pointRe.exec(waypointClause)) !== null) {
319
+ points.push({ x: Number(m[1]), y: Number(m[2]) });
320
+ }
321
+ if (points.length > 0) {
322
+ edge.routingPoints = points;
323
+ }
324
+ }
325
+ if (ctx.includeSourceInfo) {
326
+ edge.sourceInfo = {
327
+ range: {
328
+ start: offset,
329
+ end: offset + line.length,
330
+ startPosition: { line: lineNumber, column: 0 },
331
+ endPosition: { line: lineNumber, column: line.length },
332
+ },
333
+ };
334
+ }
335
+ return edge;
336
+ }
337
+ /**
338
+ * Scan an edge attribute list.
339
+ *
340
+ * Splitting on `,` breaks any quoted value containing one, so the list is
341
+ * scanned instead: quotes are tracked, escapes are honoured, and a `,` or `]`
342
+ * inside a quoted run is not a delimiter (R-009 AC-4, AC-5).
343
+ */
344
+ function scanAttributes(input) {
345
+ const out = [];
346
+ for (const part of splitTopLevel(input)) {
347
+ const trimmed = part.trim();
348
+ if (!trimmed)
349
+ continue;
350
+ const pair = trimmed.match(/^(?:"((?:[^"\\]|\\.)*)"|([A-Za-z_][A-Za-z0-9_]*))\s*(?:=|:)\s*([\s\S]+)$/);
351
+ if (pair) {
352
+ const key = pair[1] !== undefined ? unescapeString(pair[1]) : pair[2];
353
+ const raw = pair[3].trim();
354
+ out.push({ kind: 'pair', key, value: parseAttributeValue(raw) });
355
+ continue;
356
+ }
357
+ const quoted = trimmed.match(/^"((?:[^"\\]|\\.)*)"$/);
358
+ if (quoted) {
359
+ out.push({ kind: 'quotedBare', value: unescapeString(quoted[1]) });
360
+ continue;
361
+ }
362
+ out.push({ kind: 'bare', value: trimmed });
363
+ }
364
+ return out;
365
+ }
366
+ /** Split on commas that are not inside a quoted run. */
367
+ function splitTopLevel(input) {
368
+ const parts = [];
369
+ let current = '';
370
+ let inString = false;
371
+ for (let i = 0; i < input.length; i++) {
372
+ const ch = input[i];
373
+ if (inString) {
374
+ current += ch;
375
+ if (ch === '\\' && i + 1 < input.length) {
376
+ current += input[++i];
377
+ }
378
+ else if (ch === '"') {
379
+ inString = false;
380
+ }
381
+ continue;
382
+ }
383
+ if (ch === '"') {
384
+ inString = true;
385
+ current += ch;
386
+ continue;
387
+ }
388
+ if (ch === ',') {
389
+ parts.push(current);
390
+ current = '';
391
+ continue;
392
+ }
393
+ current += ch;
394
+ }
395
+ parts.push(current);
396
+ return parts;
397
+ }
398
+ /** An attribute value keeps its JavaScript type through the round-trip. */
399
+ function parseAttributeValue(raw) {
400
+ const quoted = raw.match(/^"((?:[^"\\]|\\.)*)"$/);
401
+ if (quoted)
402
+ return unescapeString(quoted[1]);
403
+ if (raw === 'true')
404
+ return true;
405
+ if (raw === 'false')
406
+ return false;
407
+ if (/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(raw)) {
408
+ const value = Number(raw);
409
+ if (Number.isFinite(value))
410
+ return value;
411
+ }
412
+ return raw;
413
+ }
414
+ export { labelToId };
415
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,WAAW,EACX,eAAe,GAGhB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,MAAc,EAAE,UAAwB,EAAE;IAC9D,MAAM,EACJ,iBAAiB,GAAG,KAAK,EACzB,OAAO,GAAG,aAAa,EACvB,SAAS,GACV,GAAG,OAAO,CAAC;IAEZ,6BAA6B;IAC7B,MAAM,GAAG,GAAiB;QACxB,MAAM;QACN,iBAAiB;QACjB,OAAO,EAAE,IAAI,WAAW,EAAE;QAC1B,OAAO,EAAE,IAAI,WAAW,EAAE;QAC1B,WAAW,EAAE,EAAE;KAChB,CAAC;IAEF,mEAAmE;IACnE,2EAA2E;IAC3E,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAErC,uEAAuE;IACvE,uCAAuC;IACvC,MAAM,KAAK,GAAY;QACrB,OAAO,EAAE,OAAO;QAChB,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,WAAW,CAAC,KAAK;QACxB,KAAK,EAAE,WAAW,CAAC,KAAK;KACzB,CAAC;IAEF,IAAI,SAAS,EAAE,CAAC;QACd,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,OAAO,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC;A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AAC;IAChC,IAAI,GAAG,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IAClC,IAAI,+CAA+C,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9D,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IAC3C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Coral DSL Printer
3
+ *
4
+ * Converts Graph-IR back to Coral DSL text.
5
+ * Enables roundtrip: DSL → IR → DSL
6
+ */
7
+ import type { GraphIR } from '../types.js';
8
+ import { type Diagnostic } from '../diagnostics.js';
9
+ /** Text plus everything the Coral surface could not carry (R-011 AC-6). */
10
+ export interface PrintResult {
11
+ text: string;
12
+ diagnostics: Diagnostic[];
13
+ }
14
+ /** True when a property value has a Coral spelling. */
15
+ export declare function isPrintableScalar(value: unknown): boolean;
16
+ /**
17
+ * Print Graph-IR to Coral DSL text, reporting everything the surface cannot
18
+ * carry.
19
+ *
20
+ * `print` keeps its bare-string signature for existing consumers; this is the
21
+ * variant the editor uses.
22
+ */
23
+ export declare function printWithDiagnostics(graph: GraphIR, options?: PrintOptions): PrintResult;
24
+ export interface PrintOptions {
25
+ /** Indentation string (default: 2 spaces) */
26
+ indent?: string;
27
+ /** Include comments with metadata */
28
+ includeComments?: boolean;
29
+ }
30
+ /**
31
+ * Print Graph-IR to Coral DSL text
32
+ */
33
+ export declare function print(graph: GraphIR, options?: PrintOptions): string;
34
+ /**
35
+ * Format options for pretty printing
36
+ */
37
+ export interface FormatOptions extends PrintOptions {
38
+ /** Sort nodes by type */
39
+ sortByType?: boolean;
40
+ /** Group nodes by parent */
41
+ groupByParent?: boolean;
42
+ }
43
+ /**
44
+ * Pretty print with additional formatting options
45
+ */
46
+ export declare function prettyPrint(graph: GraphIR, options?: FormatOptions): string;
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/printer/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAwB,MAAM,aAAa,CAAC;AACjE,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAYrE,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAQD,uDAAuD;AACvD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIzD;AA2HD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,YAAiB,GAAG,WAAW,CAI5F;AAiCD,MAAM,WAAW,YAAY;IAC3B,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,YAAiB,GAAG,MAAM,CAExE;AA0OD;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,yBAAyB;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4BAA4B;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CAe/E"}