ts-graphviz 1.2.2 → 1.2.3-dev.20989b4ce

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 CHANGED
@@ -14,7 +14,7 @@ TypeScriptの ための [Graphviz](https://graphviz.gitlab.io/) ライブラリ
14
14
 
15
15
  [![GitHub](https://img.shields.io/badge/-GitHub-181717?logo=GitHub&style=flat)](https://github.com/ts-graphviz/ts-graphviz)
16
16
  [![npm](https://img.shields.io/badge/-npm-CB3837?logo=npm&style=flat)](https://www.npmjs.com/package/ts-graphviz)
17
- [![yarn](https://img.shields.io/badge/-yarn-ffffff?logo=Yarn&style=flat)](https://github.com/ts-graphviz/ts-graphviz)
17
+ [![yarn](https://img.shields.io/badge/-yarn-ffffff?logo=Yarn&style=flat)](https://yarnpkg.com/package/ts-graphviz)
18
18
  [![Refarence](https://img.shields.io/badge/-Refarence-3178C6?logo=TypeScript&style=flat&logoColor=fff)](https://ts-graphviz.github.io/ts-graphviz/)
19
19
  [![Suponser](https://img.shields.io/badge/-Suponser-fff?logo=GitHub%20Sponsors&style=flat)](https://github.com/sponsors/kamiazya)
20
20
 
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
  [![GitHub](https://img.shields.io/badge/-GitHub-181717?logo=GitHub&style=flat)](https://github.com/ts-graphviz/ts-graphviz)
17
17
  [![npm](https://img.shields.io/badge/-npm-CB3837?logo=npm&style=flat)](https://www.npmjs.com/package/ts-graphviz)
18
- [![yarn](https://img.shields.io/badge/-yarn-ffffff?logo=Yarn&style=flat)](https://github.com/ts-graphviz/ts-graphviz)
18
+ [![yarn](https://img.shields.io/badge/-yarn-ffffff?logo=Yarn&style=flat)](https://yarnpkg.com/package/ts-graphviz)
19
19
  [![Refarence](https://img.shields.io/badge/-Refarence-3178C6?logo=TypeScript&style=flat&logoColor=fff)](https://ts-graphviz.github.io/ts-graphviz/)
20
20
  [![Suponser](https://img.shields.io/badge/-Suponser-fff?logo=GitHub%20Sponsors&style=flat)](https://github.com/sponsors/kamiazya)
21
21
 
package/lib/ast/index.cjs CHANGED
@@ -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/package.json CHANGED
@@ -1,86 +1,86 @@
1
1
  {
2
- "name": "ts-graphviz",
3
- "version": "1.2.2",
4
- "author": "kamiazya <yuki@kamiazya.tech>",
5
- "description": "Graphviz library for TypeScript.",
6
- "homepage": "https://ts-graphviz.github.io/ts-graphviz/",
7
- "type": "module",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/ts-graphviz/ts-graphviz.git"
11
- },
12
- "keywords": [
13
- "graphviz",
14
- "dot"
15
- ],
16
- "bugs": {
17
- "url": "https://github.com/ts-graphviz/ts-graphviz/issues"
18
- },
19
- "funding": {
20
- "type": "github",
21
- "url": "https://github.com/sponsors/kamiazya"
22
- },
23
- "main": "./lib/index.cjs",
24
- "module": "./lib/index.js",
25
- "types": "lib/index.d.ts",
26
- "exports": {
27
- ".": {
28
- "import": "./lib/index.js",
29
- "require": "./lib/index.cjs",
30
- "types": "./lib/index.d.ts"
2
+ "name": "ts-graphviz",
3
+ "version": "1.2.3-dev.20989b4ce",
4
+ "author": "kamiazya <yuki@kamiazya.tech>",
5
+ "description": "Graphviz library for TypeScript.",
6
+ "homepage": "https://ts-graphviz.github.io/ts-graphviz/",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/ts-graphviz/ts-graphviz.git"
31
11
  },
32
- "./ast": {
33
- "import": "./lib/ast/index.js",
34
- "require": "./lib/ast/index.cjs",
35
- "types": "./lib/ast/index.d.ts"
36
- }
37
- },
38
- "imports": {
39
- "#lib/*": {
40
- "import": "./lib/*/index.js",
41
- "require": "./lib/*/index.cjs",
42
- "types": "./lib/*/index.d.ts"
12
+ "keywords": [
13
+ "graphviz",
14
+ "dot"
15
+ ],
16
+ "bugs": {
17
+ "url": "https://github.com/ts-graphviz/ts-graphviz/issues"
18
+ },
19
+ "funding": {
20
+ "type": "github",
21
+ "url": "https://github.com/sponsors/kamiazya"
22
+ },
23
+ "main": "./lib/index.cjs",
24
+ "module": "./lib/index.js",
25
+ "types": "lib/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "import": "./lib/index.js",
29
+ "require": "./lib/index.cjs",
30
+ "types": "./lib/index.d.ts"
31
+ },
32
+ "./ast": {
33
+ "import": "./lib/ast/index.js",
34
+ "require": "./lib/ast/index.cjs",
35
+ "types": "./lib/ast/index.d.ts"
36
+ }
37
+ },
38
+ "imports": {
39
+ "#lib/*": {
40
+ "import": "./lib/*/index.js",
41
+ "require": "./lib/*/index.cjs",
42
+ "types": "./lib/*/index.d.ts"
43
+ }
44
+ },
45
+ "license": "MIT",
46
+ "engines": {
47
+ "node": ">=14.16"
48
+ },
49
+ "scripts": {
50
+ "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
+ "prebuild": "yarn build:peggy",
52
+ "build": "tsc -p tsconfig.build.json && rollup -c",
53
+ "postbuild": "prettier --write ./lib/**/index.{js,cjs,d.ts}",
54
+ "pretest": "yarn build:peggy",
55
+ "test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
56
+ "format": "eslint --ext ts src --fix && prettier --write './**/*.{ts,js,json,yaml}' '!lib'",
57
+ "lint": "eslint --ext ts src",
58
+ "predoc": "yarn build:peggy",
59
+ "doc": "typedoc"
60
+ },
61
+ "devDependencies": {
62
+ "@types/jest": "^28.1.6",
63
+ "@types/jest-specific-snapshot": "^0.5.6",
64
+ "@typescript-eslint/eslint-plugin": "^5.33.0",
65
+ "@typescript-eslint/parser": "^5.33.0",
66
+ "eslint": "^8.22.0",
67
+ "eslint-config-prettier": "^8.5.0",
68
+ "eslint-plugin-import": "^2.26.0",
69
+ "eslint-plugin-jest": "^26.8.2",
70
+ "eslint-plugin-prettier": "^4.2.1",
71
+ "jest": "^28.1.3",
72
+ "jest-snapshot-serializer-raw": "^1.2.0",
73
+ "jest-specific-snapshot": "^5.0.0",
74
+ "peggy": "^2.0.1",
75
+ "prettier": "^2.7.1",
76
+ "prettier-plugin-pegjs": "^0.5.0",
77
+ "rollup": "^2.77.3",
78
+ "rollup-plugin-delete": "^2.0.0",
79
+ "rollup-plugin-dts": "^4.2.2",
80
+ "svgo": "^2.8.0",
81
+ "ts-jest": "^28.0.7",
82
+ "ts-pegjs": "^2.1.0",
83
+ "typedoc": "^0.23.15",
84
+ "typescript": "^4.7.4"
43
85
  }
44
- },
45
- "license": "MIT",
46
- "engines": {
47
- "node": ">=14.16"
48
- },
49
- "scripts": {
50
- "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
- "prebuild": "yarn build:peggy",
52
- "build": "tsc -p tsconfig.build.json && rollup -c",
53
- "postbuild": "prettier --write ./lib/**/index.{js,cjs,d.ts}",
54
- "pretest": "yarn build:peggy",
55
- "test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
56
- "format": "eslint --ext ts src --fix && prettier --write './**/*.{ts,js,json,yaml}' '!lib'",
57
- "lint": "eslint --ext ts src",
58
- "predoc": "yarn build:peggy",
59
- "doc": "typedoc"
60
- },
61
- "devDependencies": {
62
- "@types/jest": "^28.1.6",
63
- "@types/jest-specific-snapshot": "^0.5.6",
64
- "@typescript-eslint/eslint-plugin": "^5.33.0",
65
- "@typescript-eslint/parser": "^5.33.0",
66
- "eslint": "^8.22.0",
67
- "eslint-config-prettier": "^8.5.0",
68
- "eslint-plugin-import": "^2.26.0",
69
- "eslint-plugin-jest": "^26.8.2",
70
- "eslint-plugin-prettier": "^4.2.1",
71
- "jest": "^28.1.3",
72
- "jest-snapshot-serializer-raw": "^1.2.0",
73
- "jest-specific-snapshot": "^5.0.0",
74
- "peggy": "^2.0.1",
75
- "prettier": "^2.7.1",
76
- "prettier-plugin-pegjs": "^0.5.0",
77
- "rollup": "^2.77.3",
78
- "rollup-plugin-delete": "^2.0.0",
79
- "rollup-plugin-dts": "^4.2.2",
80
- "svgo": "^2.8.0",
81
- "ts-jest": "^28.0.7",
82
- "ts-pegjs": "^2.1.0",
83
- "typedoc": "^0.23.15",
84
- "typescript": "^4.7.4"
85
- }
86
- }
86
+ }
@@ -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
+ });