ts-graphviz 1.2.3-dev.e6969d40a → 1.2.4-dev.0c498aa20
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/README.md +70 -6
- package/lib/adapter/deno/mod.d.ts +17 -0
- package/lib/adapter/deno/mod.js +33 -0
- package/lib/adapter/index.cjs +47 -0
- package/lib/adapter/index.d.ts +17 -0
- package/lib/adapter/index.js +42 -0
- package/lib/ast/index.cjs +59 -2
- package/lib/ast/index.js +57 -0
- package/lib/common/index.cjs +1 -1
- package/lib/core/index.cjs +2 -2
- package/lib/index.cjs +2 -2
- package/media/adapter-state-machine.svg +1 -0
- package/package.json +42 -14
- package/README.ja.md +0 -498
- package/test/__snapshots__/class-base.test.ts.snap +0 -18
- package/test/__snapshots__/create-root-graph.spec.ts.snap +0 -200
- package/test/__snapshots__/to-dot.test.ts.snap +0 -229
- package/test/class-base.test.ts +0 -131
- package/test/create-root-graph.spec.ts +0 -292
- package/test/from-dot.test.ts +0 -58
- package/test/to-dot.test.ts +0 -112
- package/test/utils/index.ts +0 -1
- package/test/utils/to-dot.ts +0 -5
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
[](https://github.com/facebook/jest)
|
|
7
7
|
[](https://github.com/facebook/jest)
|
|
8
8
|

|
|
9
|
+
[](https://github.com/denoland/deno)
|
|
9
10
|

|
|
10
11
|
[](#contributors)
|
|
11
12
|
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
[](https://ts-graphviz.github.io/ts-graphviz/)
|
|
20
21
|
[](https://github.com/sponsors/kamiazya)
|
|
21
22
|
|
|
22
|
-
> [English](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.md) | [日本語](https://github.com/ts-graphviz/ts-graphviz/blob/main/
|
|
23
|
+
> [English](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.md) | [日本語](https://github.com/ts-graphviz/ts-graphviz/blob/main/README_ja.md)
|
|
23
24
|
|
|
24
25
|
## Key Features ✨
|
|
25
26
|
|
|
@@ -34,6 +35,8 @@
|
|
|
34
35
|
|
|
35
36
|
## Installation 💽
|
|
36
37
|
|
|
38
|
+
### Node.js
|
|
39
|
+
|
|
37
40
|
This package can then be installed using a package manager.
|
|
38
41
|
|
|
39
42
|
```bash
|
|
@@ -45,6 +48,16 @@ $ yarn add ts-graphviz
|
|
|
45
48
|
$ pnpm add ts-graphviz
|
|
46
49
|
```
|
|
47
50
|
|
|
51
|
+
### Deno 🦕
|
|
52
|
+
|
|
53
|
+
[Deno v1.28 and above supports npm](https://deno.land/manual/node/npm_specifiers).
|
|
54
|
+
|
|
55
|
+
You can install and use the package by specifying the following:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { toDot } from 'npm:ts-graphviz';
|
|
59
|
+
```
|
|
60
|
+
|
|
48
61
|
## Usage 📑
|
|
49
62
|
|
|
50
63
|
This section provides an overview of the package.
|
|
@@ -322,6 +335,56 @@ const dot = toDot(g);
|
|
|
322
335
|
|
|
323
336
|
</details>
|
|
324
337
|
|
|
338
|
+
### `ts-graphviz/adapter` Module 🔌
|
|
339
|
+
|
|
340
|
+
> This module status is .
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
Provides an interface to run Graphviz dot commands.
|
|
344
|
+
|
|
345
|
+
[Graphviz](https://graphviz.gitlab.io/) must be installed so that the dot command can be executed.
|
|
346
|
+
|
|
347
|
+
Execute the dot command to output a DOT language string to a stream or file.
|
|
348
|
+
|
|
349
|
+

|
|
350
|
+
|
|
351
|
+
This module provides the following functions.
|
|
352
|
+
|
|
353
|
+
- The `toStream` function converts **DOT** to **Stream**.
|
|
354
|
+
```ts
|
|
355
|
+
import { toStream } from 'ts-graphviz/adapter';
|
|
356
|
+
|
|
357
|
+
const dot = `
|
|
358
|
+
digraph example {
|
|
359
|
+
node1 [
|
|
360
|
+
label = "My Node",
|
|
361
|
+
]
|
|
362
|
+
}
|
|
363
|
+
`;
|
|
364
|
+
|
|
365
|
+
const stream = await toStream(dot, { format: 'svg' });
|
|
366
|
+
// Node.js
|
|
367
|
+
stream.pipe(process.stdout);
|
|
368
|
+
// Deno
|
|
369
|
+
await stream.pipeTo(Deno.stdout.writable);
|
|
370
|
+
```
|
|
371
|
+
- Writes **DOT** to a file at the specified path `toFile` function
|
|
372
|
+
```ts
|
|
373
|
+
import { toFile } from 'ts-graphviz/adapter';
|
|
374
|
+
|
|
375
|
+
const dot = `
|
|
376
|
+
digraph example {
|
|
377
|
+
node1 [
|
|
378
|
+
label = "My Node",
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
`;
|
|
382
|
+
|
|
383
|
+
await toFile(dot, './result.svg', { format: 'svg' });
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
> **Note** Designed to work with Node.js and Deno, Stream is runtime native.
|
|
387
|
+
|
|
325
388
|
### `ts-graphviz/ast` Module 🔢
|
|
326
389
|
|
|
327
390
|
> This module status is .
|
|
@@ -454,12 +517,13 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
454
517
|
<table>
|
|
455
518
|
<tbody>
|
|
456
519
|
<tr>
|
|
457
|
-
<td align="center"><a href="http://blog.kamiazya.tech/"><img src="https://avatars0.githubusercontent.com/u/35218186?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yuki Yamazaki</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Code">💻</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Tests">⚠️</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Documentation">📖</a> <a href="#ideas-kamiazya" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
458
|
-
<td align="center"><a href="https://laysent.com"><img src="https://avatars2.githubusercontent.com/u/1191606?v=4?s=100" width="100px;" alt=""/><br /><sub><b>LaySent</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Alaysent" title="Bug reports">🐛</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=laysent" title="Tests">⚠️</a></td>
|
|
459
|
-
<td align="center"><a href="https://github.com/elasticdotventures"><img src="https://avatars0.githubusercontent.com/u/35611074?v=4?s=100" width="100px;" alt=""/><br /><sub><b>elasticdotventures</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=elasticdotventures" title="Documentation">📖</a></td>
|
|
460
|
-
<td align="center"><a href="https://github.com/ChristianMurphy"><img src="https://avatars.githubusercontent.com/u/3107513?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Christian Murphy</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Code">💻</a> <a href="#ideas-ChristianMurphy" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Documentation">📖</a></td>
|
|
520
|
+
<td align="center" valign="top" width="14.28%"><a href="http://blog.kamiazya.tech/"><img src="https://avatars0.githubusercontent.com/u/35218186?v=4?s=100" width="100px;" alt="Yuki Yamazaki"/><br /><sub><b>Yuki Yamazaki</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Code">💻</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Tests">⚠️</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Documentation">📖</a> <a href="#ideas-kamiazya" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
521
|
+
<td align="center" valign="top" width="14.28%"><a href="https://laysent.com"><img src="https://avatars2.githubusercontent.com/u/1191606?v=4?s=100" width="100px;" alt="LaySent"/><br /><sub><b>LaySent</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Alaysent" title="Bug reports">🐛</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=laysent" title="Tests">⚠️</a></td>
|
|
522
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/elasticdotventures"><img src="https://avatars0.githubusercontent.com/u/35611074?v=4?s=100" width="100px;" alt="elasticdotventures"/><br /><sub><b>elasticdotventures</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=elasticdotventures" title="Documentation">📖</a></td>
|
|
523
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ChristianMurphy"><img src="https://avatars.githubusercontent.com/u/3107513?v=4?s=100" width="100px;" alt="Christian Murphy"/><br /><sub><b>Christian Murphy</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Code">💻</a> <a href="#ideas-ChristianMurphy" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Documentation">📖</a></td>
|
|
524
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ArtemAdamenko"><img src="https://avatars.githubusercontent.com/u/2178516?v=4?s=100" width="100px;" alt="Artem"/><br /><sub><b>Artem</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3AArtemAdamenko" title="Bug reports">🐛</a></td>
|
|
461
525
|
</tr>
|
|
462
|
-
</
|
|
526
|
+
</tbody>
|
|
463
527
|
</table>
|
|
464
528
|
|
|
465
529
|
<!-- markdownlint-restore -->
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type Format = 'png' | 'svg' | 'json' | 'jpg' | 'pdf' | 'xdot' | 'plain' | 'dot_json';
|
|
2
|
+
|
|
3
|
+
export interface Options {
|
|
4
|
+
format?: Format;
|
|
5
|
+
suppressWarnings?: boolean;
|
|
6
|
+
dotCommand?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Execute the Graphviz dot command and make a Stream of the results.
|
|
11
|
+
*/
|
|
12
|
+
export function toStream(dot: string, options?: Options): Promise<ReadableStream>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Execute the Graphviz dot command and output the results to a file.
|
|
16
|
+
*/
|
|
17
|
+
export function toFile(dot: string, path: string, options?: Options): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function commandBuilder({ dotCommand = 'dot', suppressWarnings = true, format = 'svg' } = {}) {
|
|
2
|
+
const args = [
|
|
3
|
+
...(function* () {
|
|
4
|
+
if (suppressWarnings) yield '-q';
|
|
5
|
+
yield `-T${format}`;
|
|
6
|
+
})(),
|
|
7
|
+
];
|
|
8
|
+
return [dotCommand, args];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Execute the Graphviz dot command and make a Stream of the results.
|
|
13
|
+
*/
|
|
14
|
+
export async function toStream(dot, options) {
|
|
15
|
+
const [command, args] = commandBuilder(options);
|
|
16
|
+
const cp = new Deno.Command(command, {
|
|
17
|
+
args: args,
|
|
18
|
+
stdin: 'piped',
|
|
19
|
+
}).spawn();
|
|
20
|
+
const stdin = cp.stdin.getWriter();
|
|
21
|
+
await stdin.write(new TextEncoder().encode(dot));
|
|
22
|
+
await stdin.close();
|
|
23
|
+
return cp.stdout;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Execute the Graphviz dot command and output the results to a file.
|
|
28
|
+
*/
|
|
29
|
+
export async function toFile(dot, path, options) {
|
|
30
|
+
const output = await Deno.open(path, { write: true });
|
|
31
|
+
const stream = await toStream(dot, options);
|
|
32
|
+
await stream.pipeTo(output.writable);
|
|
33
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var node_fs = require('node:fs');
|
|
6
|
+
var node_stream = require('node:stream');
|
|
7
|
+
var node_util = require('node:util');
|
|
8
|
+
var node_child_process = require('node:child_process');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @module ts-graphviz/adapter
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
function commandBuilder({ dotCommand = 'dot', suppressWarnings = true, format = 'svg' } = {}) {
|
|
15
|
+
const args = [
|
|
16
|
+
...(function* () {
|
|
17
|
+
if (suppressWarnings) yield '-q';
|
|
18
|
+
yield `-T${format}`;
|
|
19
|
+
})(),
|
|
20
|
+
];
|
|
21
|
+
return [dotCommand, args];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* NOTE:
|
|
25
|
+
* The node:stream/promises standard module is not provided in Node 14.
|
|
26
|
+
* Fix Node 14 to use node:stream/promises after LTS ends.
|
|
27
|
+
*/
|
|
28
|
+
const pipeline = node_util.promisify(node_stream.pipeline);
|
|
29
|
+
/**
|
|
30
|
+
* Execute the Graphviz dot command and make a Stream of the results.
|
|
31
|
+
*/
|
|
32
|
+
async function toStream(dot, options) {
|
|
33
|
+
const [command, args] = commandBuilder(options);
|
|
34
|
+
const p = node_child_process.spawn(command, args, { stdio: 'pipe' });
|
|
35
|
+
await pipeline(node_stream.Readable.from([dot]), p.stdin);
|
|
36
|
+
return p.stdout;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Execute the Graphviz dot command and output the results to a file.
|
|
40
|
+
*/
|
|
41
|
+
async function toFile(dot, path, options) {
|
|
42
|
+
const stream = await toStream(dot, options);
|
|
43
|
+
await pipeline(stream, node_fs.createWriteStream(path));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exports.toFile = toFile;
|
|
47
|
+
exports.toStream = toStream;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
declare type Format = 'png' | 'svg' | 'json' | 'jpg' | 'pdf' | 'xdot' | 'plain' | 'dot_json';
|
|
3
|
+
interface Options {
|
|
4
|
+
format?: Format;
|
|
5
|
+
suppressWarnings?: boolean;
|
|
6
|
+
dotCommand?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Execute the Graphviz dot command and make a Stream of the results.
|
|
10
|
+
*/
|
|
11
|
+
declare function toStream(dot: string, options?: Options): Promise<NodeJS.ReadableStream>;
|
|
12
|
+
/**
|
|
13
|
+
* Execute the Graphviz dot command and output the results to a file.
|
|
14
|
+
*/
|
|
15
|
+
declare function toFile(dot: string, path: string, options?: Options): Promise<void>;
|
|
16
|
+
|
|
17
|
+
export { Format, Options, toFile, toStream };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createWriteStream } from 'node:fs';
|
|
2
|
+
import { pipeline as pipeline$1, Readable } from 'node:stream';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { spawn } from 'node:child_process';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @module ts-graphviz/adapter
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
function commandBuilder({ dotCommand = 'dot', suppressWarnings = true, format = 'svg' } = {}) {
|
|
11
|
+
const args = [
|
|
12
|
+
...(function* () {
|
|
13
|
+
if (suppressWarnings) yield '-q';
|
|
14
|
+
yield `-T${format}`;
|
|
15
|
+
})(),
|
|
16
|
+
];
|
|
17
|
+
return [dotCommand, args];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* NOTE:
|
|
21
|
+
* The node:stream/promises standard module is not provided in Node 14.
|
|
22
|
+
* Fix Node 14 to use node:stream/promises after LTS ends.
|
|
23
|
+
*/
|
|
24
|
+
const pipeline = promisify(pipeline$1);
|
|
25
|
+
/**
|
|
26
|
+
* Execute the Graphviz dot command and make a Stream of the results.
|
|
27
|
+
*/
|
|
28
|
+
async function toStream(dot, options) {
|
|
29
|
+
const [command, args] = commandBuilder(options);
|
|
30
|
+
const p = spawn(command, args, { stdio: 'pipe' });
|
|
31
|
+
await pipeline(Readable.from([dot]), p.stdin);
|
|
32
|
+
return p.stdout;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Execute the Graphviz dot command and output the results to a file.
|
|
36
|
+
*/
|
|
37
|
+
async function toFile(dot, path, options) {
|
|
38
|
+
const stream = await toStream(dot, options);
|
|
39
|
+
await pipeline(stream, createWriteStream(path));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { toFile, toStream };
|
package/lib/ast/index.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index_js = require('../utils/index.
|
|
6
|
-
var index_js$1 = require('../common/index.
|
|
5
|
+
var index_js = require('../utils/index.cjs');
|
|
6
|
+
var index_js$1 = require('../common/index.cjs');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @group Create AST
|
|
@@ -5416,6 +5416,63 @@ const EdgePlugin$1 = {
|
|
|
5416
5416
|
},
|
|
5417
5417
|
[],
|
|
5418
5418
|
);
|
|
5419
|
+
} else {
|
|
5420
|
+
return createElement(
|
|
5421
|
+
'NodeRefGroup',
|
|
5422
|
+
{},
|
|
5423
|
+
target.map((n) => {
|
|
5424
|
+
if (index_js$1.isNodeModel(n)) {
|
|
5425
|
+
return createElement(
|
|
5426
|
+
'NodeRef',
|
|
5427
|
+
{
|
|
5428
|
+
id: createElement(
|
|
5429
|
+
'Literal',
|
|
5430
|
+
{
|
|
5431
|
+
value: n.id,
|
|
5432
|
+
quoted: true,
|
|
5433
|
+
},
|
|
5434
|
+
[],
|
|
5435
|
+
),
|
|
5436
|
+
},
|
|
5437
|
+
[],
|
|
5438
|
+
);
|
|
5439
|
+
}
|
|
5440
|
+
return createElement(
|
|
5441
|
+
'NodeRef',
|
|
5442
|
+
{
|
|
5443
|
+
id: createElement(
|
|
5444
|
+
'Literal',
|
|
5445
|
+
{
|
|
5446
|
+
value: n.id,
|
|
5447
|
+
quoted: true,
|
|
5448
|
+
},
|
|
5449
|
+
[],
|
|
5450
|
+
),
|
|
5451
|
+
port: n.port
|
|
5452
|
+
? createElement(
|
|
5453
|
+
'Literal',
|
|
5454
|
+
{
|
|
5455
|
+
value: n.port,
|
|
5456
|
+
quoted: true,
|
|
5457
|
+
},
|
|
5458
|
+
[],
|
|
5459
|
+
)
|
|
5460
|
+
: undefined,
|
|
5461
|
+
compass: n.compass
|
|
5462
|
+
? createElement(
|
|
5463
|
+
'Literal',
|
|
5464
|
+
{
|
|
5465
|
+
value: n.compass,
|
|
5466
|
+
quoted: true,
|
|
5467
|
+
},
|
|
5468
|
+
[],
|
|
5469
|
+
)
|
|
5470
|
+
: undefined,
|
|
5471
|
+
},
|
|
5472
|
+
[],
|
|
5473
|
+
);
|
|
5474
|
+
}),
|
|
5475
|
+
);
|
|
5419
5476
|
}
|
|
5420
5477
|
}),
|
|
5421
5478
|
},
|
package/lib/ast/index.js
CHANGED
|
@@ -5407,6 +5407,63 @@ const EdgePlugin$1 = {
|
|
|
5407
5407
|
},
|
|
5408
5408
|
[],
|
|
5409
5409
|
);
|
|
5410
|
+
} else {
|
|
5411
|
+
return createElement(
|
|
5412
|
+
'NodeRefGroup',
|
|
5413
|
+
{},
|
|
5414
|
+
target.map((n) => {
|
|
5415
|
+
if (isNodeModel(n)) {
|
|
5416
|
+
return createElement(
|
|
5417
|
+
'NodeRef',
|
|
5418
|
+
{
|
|
5419
|
+
id: createElement(
|
|
5420
|
+
'Literal',
|
|
5421
|
+
{
|
|
5422
|
+
value: n.id,
|
|
5423
|
+
quoted: true,
|
|
5424
|
+
},
|
|
5425
|
+
[],
|
|
5426
|
+
),
|
|
5427
|
+
},
|
|
5428
|
+
[],
|
|
5429
|
+
);
|
|
5430
|
+
}
|
|
5431
|
+
return createElement(
|
|
5432
|
+
'NodeRef',
|
|
5433
|
+
{
|
|
5434
|
+
id: createElement(
|
|
5435
|
+
'Literal',
|
|
5436
|
+
{
|
|
5437
|
+
value: n.id,
|
|
5438
|
+
quoted: true,
|
|
5439
|
+
},
|
|
5440
|
+
[],
|
|
5441
|
+
),
|
|
5442
|
+
port: n.port
|
|
5443
|
+
? createElement(
|
|
5444
|
+
'Literal',
|
|
5445
|
+
{
|
|
5446
|
+
value: n.port,
|
|
5447
|
+
quoted: true,
|
|
5448
|
+
},
|
|
5449
|
+
[],
|
|
5450
|
+
)
|
|
5451
|
+
: undefined,
|
|
5452
|
+
compass: n.compass
|
|
5453
|
+
? createElement(
|
|
5454
|
+
'Literal',
|
|
5455
|
+
{
|
|
5456
|
+
value: n.compass,
|
|
5457
|
+
quoted: true,
|
|
5458
|
+
},
|
|
5459
|
+
[],
|
|
5460
|
+
)
|
|
5461
|
+
: undefined,
|
|
5462
|
+
},
|
|
5463
|
+
[],
|
|
5464
|
+
);
|
|
5465
|
+
}),
|
|
5466
|
+
);
|
|
5410
5467
|
}
|
|
5411
5468
|
}),
|
|
5412
5469
|
},
|
package/lib/common/index.cjs
CHANGED
|
@@ -50,7 +50,7 @@ function toNodeRefGroup(targets) {
|
|
|
50
50
|
* @alpha
|
|
51
51
|
*/
|
|
52
52
|
const RootModelsContext = Object.seal({
|
|
53
|
-
// NOTE: RootModelsContext is also initialized after the model class is declared in the 'core/index.
|
|
53
|
+
// NOTE: RootModelsContext is also initialized after the model class is declared in the 'core/index.cjs' module.
|
|
54
54
|
Graph: null,
|
|
55
55
|
Digraph: null,
|
|
56
56
|
Subgraph: null,
|
package/lib/core/index.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index_js = require('../common/index.
|
|
6
|
-
var index_js$1 = require('../ast/index.
|
|
5
|
+
var index_js = require('../common/index.cjs');
|
|
6
|
+
var index_js$1 = require('../ast/index.cjs');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @group Attribute
|
package/lib/index.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index_js = require('./common/index.
|
|
6
|
-
var index_js$1 = require('./core/index.
|
|
5
|
+
var index_js = require('./common/index.cjs');
|
|
6
|
+
var index_js$1 = require('./core/index.cjs');
|
|
7
7
|
|
|
8
8
|
Object.keys(index_js).forEach(function (k) {
|
|
9
9
|
if (k !== 'default' && !exports.hasOwnProperty(k))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="172pt" height="211pt" viewBox="0 0 172.44 211.09" xmlns="http://www.w3.org/2000/svg"><g class="graph" transform="translate(4 207.09)"><path fill="#fff" stroke="transparent" d="M-4 4v-211.09h172.44V4H-4z"/><g class="node"><circle fill="none" stroke="#000" cx="89.85" cy="-171.89" r="31.4"/><text text-anchor="middle" x="89.85" y="-168.19" font-family="Times,serif" font-size="14">DOT</text></g><g class="node"><circle fill="none" stroke="#000" cx="44.85" cy="-44.85" r="44.69"/><text text-anchor="middle" x="44.85" y="-41.15" font-family="Times,serif" font-size="14">Stream</text></g><g class="edge"><path fill="none" stroke="#000" d="M66.46-151.09c-7.72 7.95-15.4 17.76-19.61 28.4-2.87 7.24-4.54 15.17-5.4 23.11"/><path stroke="#000" d="m44.94-99.32-4.18 9.73-2.8-10.21 6.98.48z"/><text text-anchor="middle" x="80.35" y="-111.49" font-family="Times,serif" font-size="14">toStream</text></g><g class="node"><circle fill="none" stroke="#000" cx="135.85" cy="-44.85" r="28.7"/><text text-anchor="middle" x="135.85" y="-41.15" font-family="Times,serif" font-size="14">File</text></g><g class="edge"><path fill="none" stroke="#000" d="M104.32-144.01c3.38 6.84 6.79 14.26 9.53 21.32 4.95 12.76 9.35 27.09 12.89 39.89"/><path stroke="#000" d="m130.18-83.48-.79 10.56-5.97-8.75 6.76-1.81z"/><text text-anchor="middle" x="139.85" y="-111.49" font-family="Times,serif" font-size="14">toFile</text></g></g></svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-graphviz",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4-dev.0c498aa20",
|
|
4
4
|
"author": "kamiazya <yuki@kamiazya.tech>",
|
|
5
5
|
"description": "Graphviz library for TypeScript.",
|
|
6
6
|
"homepage": "https://ts-graphviz.github.io/ts-graphviz/",
|
|
@@ -25,21 +25,46 @@
|
|
|
25
25
|
"types": "lib/index.d.ts",
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
"require": {
|
|
29
|
+
"default": "./lib/index.cjs",
|
|
30
|
+
"types": "./lib/index.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"import": {
|
|
33
|
+
"default": "./lib/index.js",
|
|
34
|
+
"types": "./lib/index.d.ts"
|
|
35
|
+
}
|
|
31
36
|
},
|
|
32
37
|
"./ast": {
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
"require": {
|
|
39
|
+
"default": "./lib/ast/index.cjs",
|
|
40
|
+
"types": "./lib/ast/index.d.ts"
|
|
41
|
+
},
|
|
42
|
+
"import": {
|
|
43
|
+
"default": "./lib/ast/index.js",
|
|
44
|
+
"types": "./lib/ast/index.d.ts"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"./adapter": {
|
|
48
|
+
"deno": {
|
|
49
|
+
"default": "./lib/adapter/deno/mod.js",
|
|
50
|
+
"types": "./lib/adapter/deno/mod.d.ts"
|
|
51
|
+
},
|
|
52
|
+
"node": {
|
|
53
|
+
"require": "./lib/adapter/index.cjs",
|
|
54
|
+
"import": "./lib/adapter/index.js",
|
|
55
|
+
"types": "./lib/adapter/index.d.ts"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"./package.json": "./package.json"
|
|
37
59
|
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
60
|
+
"typesVersions": {
|
|
61
|
+
"*": {
|
|
62
|
+
"ast": [
|
|
63
|
+
"lib/ast"
|
|
64
|
+
],
|
|
65
|
+
"adapter": [
|
|
66
|
+
"lib/adapter"
|
|
67
|
+
]
|
|
43
68
|
}
|
|
44
69
|
},
|
|
45
70
|
"license": "MIT",
|
|
@@ -49,7 +74,9 @@
|
|
|
49
74
|
"scripts": {
|
|
50
75
|
"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",
|
|
51
76
|
"prebuild": "yarn build:peggy",
|
|
52
|
-
"build": "
|
|
77
|
+
"build:deno": "cp -r src/adapter/deno lib/adapter/deno",
|
|
78
|
+
"build:node": "tsc -p tsconfig.build.json && rollup -c",
|
|
79
|
+
"build": "yarn build:node && yarn build:deno",
|
|
53
80
|
"postbuild": "prettier --write ./lib/**/index.{js,cjs,d.ts}",
|
|
54
81
|
"pretest": "yarn build:peggy",
|
|
55
82
|
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
|
|
@@ -59,6 +86,7 @@
|
|
|
59
86
|
"doc": "typedoc"
|
|
60
87
|
},
|
|
61
88
|
"devDependencies": {
|
|
89
|
+
"@rollup/plugin-replace": "^4.0.0",
|
|
62
90
|
"@types/jest": "^28.1.6",
|
|
63
91
|
"@types/jest-specific-snapshot": "^0.5.6",
|
|
64
92
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|