ts-graphviz 1.2.3-dev.4a201b2c8 → 1.2.3-dev.c2580f68b
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.ja.md +1 -1
- package/README.md +1 -1
- 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/package.json +2 -1
- package/test/edge-group.test.ts +96 -0
package/README.ja.md
CHANGED
|
@@ -14,7 +14,7 @@ TypeScriptの ための [Graphviz](https://graphviz.gitlab.io/) ライブラリ
|
|
|
14
14
|
|
|
15
15
|
[](https://github.com/ts-graphviz/ts-graphviz)
|
|
16
16
|
[](https://www.npmjs.com/package/ts-graphviz)
|
|
17
|
-
[](https://
|
|
17
|
+
[](https://yarnpkg.com/package/ts-graphviz)
|
|
18
18
|
[](https://ts-graphviz.github.io/ts-graphviz/)
|
|
19
19
|
[](https://github.com/sponsors/kamiazya)
|
|
20
20
|
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
[](https://github.com/ts-graphviz/ts-graphviz)
|
|
17
17
|
[](https://www.npmjs.com/package/ts-graphviz)
|
|
18
|
-
[](https://
|
|
18
|
+
[](https://yarnpkg.com/package/ts-graphviz)
|
|
19
19
|
[](https://ts-graphviz.github.io/ts-graphviz/)
|
|
20
20
|
[](https://github.com/sponsors/kamiazya)
|
|
21
21
|
|
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))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-graphviz",
|
|
3
|
-
"version": "1.2.3-dev.
|
|
3
|
+
"version": "1.2.3-dev.c2580f68b",
|
|
4
4
|
"author": "kamiazya <yuki@kamiazya.tech>",
|
|
5
5
|
"description": "Graphviz library for TypeScript.",
|
|
6
6
|
"homepage": "https://ts-graphviz.github.io/ts-graphviz/",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"doc": "typedoc"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
+
"@rollup/plugin-replace": "^4.0.0",
|
|
62
63
|
"@types/jest": "^28.1.6",
|
|
63
64
|
"@types/jest-specific-snapshot": "^0.5.6",
|
|
64
65
|
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { digraph } from 'ts-graphviz';
|
|
2
|
+
import { fromModel } from 'ts-graphviz/ast';
|
|
3
|
+
|
|
4
|
+
import { toDot } from '#test/utils';
|
|
5
|
+
|
|
6
|
+
test('edge group', () => {
|
|
7
|
+
expect(
|
|
8
|
+
fromModel(
|
|
9
|
+
digraph((g) => {
|
|
10
|
+
g.edge(['a', ['b', 'c']]);
|
|
11
|
+
}),
|
|
12
|
+
),
|
|
13
|
+
).toMatchInlineSnapshot(`
|
|
14
|
+
Object {
|
|
15
|
+
"children": Array [
|
|
16
|
+
Object {
|
|
17
|
+
"children": Array [
|
|
18
|
+
Object {
|
|
19
|
+
"children": Array [],
|
|
20
|
+
"location": null,
|
|
21
|
+
"targets": Array [
|
|
22
|
+
Object {
|
|
23
|
+
"children": Array [],
|
|
24
|
+
"compass": undefined,
|
|
25
|
+
"id": Object {
|
|
26
|
+
"children": Array [],
|
|
27
|
+
"location": null,
|
|
28
|
+
"quoted": true,
|
|
29
|
+
"type": "Literal",
|
|
30
|
+
"value": "a",
|
|
31
|
+
},
|
|
32
|
+
"location": null,
|
|
33
|
+
"port": undefined,
|
|
34
|
+
"type": "NodeRef",
|
|
35
|
+
},
|
|
36
|
+
Object {
|
|
37
|
+
"children": Array [
|
|
38
|
+
Object {
|
|
39
|
+
"children": Array [],
|
|
40
|
+
"compass": undefined,
|
|
41
|
+
"id": Object {
|
|
42
|
+
"children": Array [],
|
|
43
|
+
"location": null,
|
|
44
|
+
"quoted": true,
|
|
45
|
+
"type": "Literal",
|
|
46
|
+
"value": "b",
|
|
47
|
+
},
|
|
48
|
+
"location": null,
|
|
49
|
+
"port": undefined,
|
|
50
|
+
"type": "NodeRef",
|
|
51
|
+
},
|
|
52
|
+
Object {
|
|
53
|
+
"children": Array [],
|
|
54
|
+
"compass": undefined,
|
|
55
|
+
"id": Object {
|
|
56
|
+
"children": Array [],
|
|
57
|
+
"location": null,
|
|
58
|
+
"quoted": true,
|
|
59
|
+
"type": "Literal",
|
|
60
|
+
"value": "c",
|
|
61
|
+
},
|
|
62
|
+
"location": null,
|
|
63
|
+
"port": undefined,
|
|
64
|
+
"type": "NodeRef",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
"location": null,
|
|
68
|
+
"type": "NodeRefGroup",
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
"type": "Edge",
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
"directed": true,
|
|
75
|
+
"id": undefined,
|
|
76
|
+
"location": null,
|
|
77
|
+
"strict": false,
|
|
78
|
+
"type": "Graph",
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
"location": null,
|
|
82
|
+
"type": "Dot",
|
|
83
|
+
}
|
|
84
|
+
`);
|
|
85
|
+
expect(
|
|
86
|
+
toDot(
|
|
87
|
+
digraph((g) => {
|
|
88
|
+
g.edge(['a', ['b', 'c']]);
|
|
89
|
+
}),
|
|
90
|
+
),
|
|
91
|
+
).toMatchInlineSnapshot(`
|
|
92
|
+
digraph {
|
|
93
|
+
"a" -> {"b" "c"};
|
|
94
|
+
}
|
|
95
|
+
`);
|
|
96
|
+
});
|