@likec4/generators 1.5.0 → 1.29.1
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/LICENSE +21 -0
- package/dist/d2/generate-d2.d.ts +1 -2
- package/dist/d2/generate-d2.js +70 -63
- package/dist/d2/index.d.ts +0 -1
- package/dist/d2/index.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -5
- package/dist/mmd/generate-mmd.d.ts +1 -2
- package/dist/mmd/generate-mmd.js +82 -63
- package/dist/mmd/index.d.ts +0 -1
- package/dist/mmd/index.js +1 -1
- package/dist/model/generate-likec4-model.d.ts +2 -0
- package/dist/model/generate-likec4-model.js +29 -0
- package/dist/model/generate-likec4.d.ts +2 -0
- package/dist/model/generate-likec4.js +2 -0
- package/dist/react/generate-react-types.d.ts +2 -0
- package/dist/react/generate-react-types.js +122 -0
- package/dist/react/index.d.ts +1 -2
- package/dist/react/index.js +1 -1
- package/dist/react-next/generate-react-next.d.ts +9 -7
- package/dist/react-next/generate-react-next.js +26 -26
- package/dist/react-next/index.d.ts +0 -1
- package/dist/react-next/index.js +1 -1
- package/dist/views-data-ts/generate-views-data.d.ts +3 -4
- package/dist/views-data-ts/generate-views-data.js +64 -54
- package/dist/views-data-ts/generateViewId.d.ts +1 -2
- package/dist/views-data-ts/generateViewId.js +5 -4
- package/dist/views-data-ts/index.d.ts +0 -1
- package/dist/views-data-ts/index.js +1 -1
- package/package.json +25 -27
- package/src/__mocks__/data.ts +463 -0
- package/src/d2/__snapshots__/generate-d2.spec.ts.snap +91 -0
- package/src/d2/generate-d2.spec.ts +15 -0
- package/src/d2/generate-d2.ts +106 -0
- package/src/d2/index.ts +1 -0
- package/src/index.ts +6 -0
- package/src/mmd/__snapshots__/generate-mmd.spec.ts.snap +55 -0
- package/src/mmd/generate-mmd.spec.ts +15 -0
- package/src/mmd/generate-mmd.ts +110 -0
- package/src/mmd/index.ts +1 -0
- package/src/model/__snapshots__/likec4-model.snap +990 -0
- package/src/model/generate-likec4-model.spec.ts +158 -0
- package/src/model/generate-likec4-model.ts +33 -0
- package/src/model/generate-likec4.ts +5 -0
- package/src/react/generate-react-types.ts +127 -0
- package/src/react/index.ts +1 -0
- package/src/react-next/generate-react-next.ts +111 -0
- package/src/react-next/index.ts +1 -0
- package/src/views-data-ts/__snapshots__/generate-views-data.spec.ts.snap +83 -0
- package/src/views-data-ts/generate-views-data.spec.ts +15 -0
- package/src/views-data-ts/generate-views-data.ts +147 -0
- package/src/views-data-ts/generateViewId.ts +9 -0
- package/src/views-data-ts/index.ts +1 -0
- package/dist/__mocks__/data.d.ts +0 -5
- package/dist/__mocks__/data.d.ts.map +0 -1
- package/dist/__mocks__/data.js +0 -456
- package/dist/d2/generate-d2.d.ts.map +0 -1
- package/dist/d2/generate-d2.spec.d.ts +0 -2
- package/dist/d2/generate-d2.spec.d.ts.map +0 -1
- package/dist/d2/generate-d2.spec.js +0 -12
- package/dist/d2/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/mmd/generate-mmd.d.ts.map +0 -1
- package/dist/mmd/generate-mmd.spec.d.ts +0 -2
- package/dist/mmd/generate-mmd.spec.d.ts.map +0 -1
- package/dist/mmd/generate-mmd.spec.js +0 -12
- package/dist/mmd/index.d.ts.map +0 -1
- package/dist/react/generate-react.d.ts +0 -3
- package/dist/react/generate-react.d.ts.map +0 -1
- package/dist/react/generate-react.js +0 -97
- package/dist/react/generate-react.spec.d.ts +0 -2
- package/dist/react/generate-react.spec.d.ts.map +0 -1
- package/dist/react/generate-react.spec.js +0 -6
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react-next/generate-react-next.d.ts.map +0 -1
- package/dist/react-next/generate-react-next.spec.d.ts +0 -2
- package/dist/react-next/generate-react-next.spec.d.ts.map +0 -1
- package/dist/react-next/generate-react-next.spec.js +0 -9
- package/dist/react-next/index.d.ts.map +0 -1
- package/dist/views-data-ts/generate-views-data.d.ts.map +0 -1
- package/dist/views-data-ts/generate-views-data.spec.d.ts +0 -2
- package/dist/views-data-ts/generate-views-data.spec.d.ts.map +0 -1
- package/dist/views-data-ts/generate-views-data.spec.js +0 -12
- package/dist/views-data-ts/generateViewId.d.ts.map +0 -1
- package/dist/views-data-ts/index.d.ts.map +0 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { DiagramView } from '@likec4/core'
|
|
2
|
+
import JSON5 from 'json5'
|
|
3
|
+
import { CompositeGeneratorNode, expandToNode, joinToNode, NL, toString } from 'langium/generate'
|
|
4
|
+
import { generateViewId } from './generateViewId'
|
|
5
|
+
|
|
6
|
+
export function generateViewsDataJs(diagrams: Iterable<DiagramView>) {
|
|
7
|
+
const views = Array.from(diagrams)
|
|
8
|
+
const out = new CompositeGeneratorNode()
|
|
9
|
+
out.appendTemplate`
|
|
10
|
+
/******************************************************************************
|
|
11
|
+
* This file was generated
|
|
12
|
+
* DO NOT EDIT MANUALLY!
|
|
13
|
+
******************************************************************************/
|
|
14
|
+
/* prettier-ignore-start */
|
|
15
|
+
/* eslint-disable */
|
|
16
|
+
|
|
17
|
+
`.append(NL, NL)
|
|
18
|
+
|
|
19
|
+
if (views.length == 0) {
|
|
20
|
+
out.append('export const LikeC4Views = {}', NL)
|
|
21
|
+
return toString(out)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
out.appendTemplate`
|
|
25
|
+
export const LikeC4Views = {
|
|
26
|
+
`
|
|
27
|
+
.indent({
|
|
28
|
+
indentation: 2,
|
|
29
|
+
indentedChildren(indented) {
|
|
30
|
+
indented.appendNewLineIf(views.length > 1).append(
|
|
31
|
+
joinToNode(
|
|
32
|
+
views,
|
|
33
|
+
view => expandToNode`${JSON5.stringify(view.id)}: ${JSON5.stringify(view)}`,
|
|
34
|
+
{
|
|
35
|
+
separator: ',',
|
|
36
|
+
appendNewLineIfNotEmpty: true
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
.append('}', NL, NL).appendTemplate`
|
|
43
|
+
|
|
44
|
+
export function isLikeC4ViewId(value) {
|
|
45
|
+
return (
|
|
46
|
+
value != null &&
|
|
47
|
+
typeof value === 'string' &&
|
|
48
|
+
!!LikeC4Views[value]
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* prettier-ignore-end */
|
|
53
|
+
`.append(NL)
|
|
54
|
+
return toString(out)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function generateViewsDataTs(diagrams: Iterable<DiagramView>) {
|
|
58
|
+
const views = Array.from(diagrams)
|
|
59
|
+
const out = new CompositeGeneratorNode()
|
|
60
|
+
out.appendTemplate`
|
|
61
|
+
/******************************************************************************
|
|
62
|
+
* This file was generated
|
|
63
|
+
* DO NOT EDIT MANUALLY!
|
|
64
|
+
******************************************************************************/
|
|
65
|
+
/* prettier-ignore-start */
|
|
66
|
+
/* eslint-disable */
|
|
67
|
+
|
|
68
|
+
// @ts-nocheck
|
|
69
|
+
|
|
70
|
+
import type { DiagramView } from 'likec4'
|
|
71
|
+
`.append(NL, NL)
|
|
72
|
+
|
|
73
|
+
if (views.length === 0) {
|
|
74
|
+
out.append('export {}', NL)
|
|
75
|
+
return toString(out)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
out.appendTemplate`
|
|
79
|
+
export type LikeC4ViewId = ${generateViewId(views)};
|
|
80
|
+
export const LikeC4Views = {
|
|
81
|
+
`
|
|
82
|
+
.indent({
|
|
83
|
+
indentation: 2,
|
|
84
|
+
indentedChildren(indented) {
|
|
85
|
+
indented.appendNewLineIf(views.length > 1).append(
|
|
86
|
+
joinToNode(
|
|
87
|
+
views,
|
|
88
|
+
view =>
|
|
89
|
+
expandToNode`${JSON5.stringify(view.id)}: (${
|
|
90
|
+
JSON5.stringify(
|
|
91
|
+
view
|
|
92
|
+
)
|
|
93
|
+
} as unknown) as DiagramView`,
|
|
94
|
+
{
|
|
95
|
+
separator: ',',
|
|
96
|
+
appendNewLineIfNotEmpty: true
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
.append('} as const satisfies Record<LikeC4ViewId, DiagramView>', NL, NL).appendTemplate`
|
|
103
|
+
export type LikeC4Views = typeof LikeC4Views
|
|
104
|
+
|
|
105
|
+
export function isLikeC4ViewId(value: unknown): value is LikeC4ViewId {
|
|
106
|
+
return (
|
|
107
|
+
value != null &&
|
|
108
|
+
typeof value === 'string' &&
|
|
109
|
+
!!LikeC4Views[value]
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* prettier-ignore-end */
|
|
114
|
+
`.append(NL)
|
|
115
|
+
return toString(out)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function generateViewsDataDTs(diagrams: Iterable<DiagramView>) {
|
|
119
|
+
const views = Array.from(diagrams)
|
|
120
|
+
const out = new CompositeGeneratorNode()
|
|
121
|
+
out.appendTemplate`
|
|
122
|
+
/******************************************************************************
|
|
123
|
+
* This file was generated
|
|
124
|
+
* DO NOT EDIT MANUALLY!
|
|
125
|
+
******************************************************************************/
|
|
126
|
+
/* prettier-ignore-start */
|
|
127
|
+
/* eslint-disable */
|
|
128
|
+
|
|
129
|
+
import type { DiagramView } from 'likec4'
|
|
130
|
+
`.append(NL, NL)
|
|
131
|
+
|
|
132
|
+
if (views.length == 0) {
|
|
133
|
+
out.append('export {}', NL)
|
|
134
|
+
return toString(out)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
out.appendTemplate`
|
|
138
|
+
export type LikeC4ViewId = ${generateViewId(views)};
|
|
139
|
+
export type LikeC4Views = Record<LikeC4ViewId, DiagramView>
|
|
140
|
+
|
|
141
|
+
export declare const LikeC4Views: LikeC4Views
|
|
142
|
+
export declare function isLikeC4ViewId(value: unknown): value is LikeC4ViewId
|
|
143
|
+
|
|
144
|
+
/* prettier-ignore-end */
|
|
145
|
+
`.append(NL)
|
|
146
|
+
return toString(out)
|
|
147
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DiagramView } from '@likec4/core'
|
|
2
|
+
import JSON5 from 'json5'
|
|
3
|
+
import { expandToNode, joinToNode } from 'langium/generate'
|
|
4
|
+
|
|
5
|
+
export function generateViewId(views: Iterable<DiagramView>) {
|
|
6
|
+
return joinToNode(views, view => expandToNode`${JSON5.stringify(view.id)}`, {
|
|
7
|
+
separator: ' | '
|
|
8
|
+
})
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './generate-views-data'
|
package/dist/__mocks__/data.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/__mocks__/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE7D,eAAO,MAAM,WAAW,EAAE,WAiMlB,CAAA;AAER,eAAO,MAAM,YAAY,EAAE,WA8GnB,CAAA;AAER,eAAO,MAAM,uBAAuB,EAAE,YAsJ9B,CAAA"}
|
package/dist/__mocks__/data.js
DELETED
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
export const fakeDiagram = {
|
|
2
|
-
edges: [
|
|
3
|
-
{
|
|
4
|
-
headArrow: [
|
|
5
|
-
[294, 487],
|
|
6
|
-
[291, 496],
|
|
7
|
-
[288, 487]
|
|
8
|
-
],
|
|
9
|
-
id: 'cloud.frontend:cloud.backend',
|
|
10
|
-
label: 'requests',
|
|
11
|
-
labelBox: {
|
|
12
|
-
align: 'left',
|
|
13
|
-
width: 62,
|
|
14
|
-
x: 295,
|
|
15
|
-
y: 459
|
|
16
|
-
},
|
|
17
|
-
points: [
|
|
18
|
-
[291, 406],
|
|
19
|
-
[291, 432],
|
|
20
|
-
[291, 461],
|
|
21
|
-
[291, 487]
|
|
22
|
-
],
|
|
23
|
-
relations: [
|
|
24
|
-
'cloud.frontend.dashboard:cloud.backend.graphql',
|
|
25
|
-
'cloud.frontend.adminPanel:cloud.backend.graphql'
|
|
26
|
-
],
|
|
27
|
-
source: 'cloud.frontend',
|
|
28
|
-
target: 'cloud.backend'
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
headArrow: [
|
|
32
|
-
[294, 701],
|
|
33
|
-
[291, 711],
|
|
34
|
-
[288, 701]
|
|
35
|
-
],
|
|
36
|
-
id: 'cloud.backend:amazon',
|
|
37
|
-
label: null,
|
|
38
|
-
labelBox: null,
|
|
39
|
-
points: [
|
|
40
|
-
[291, 641],
|
|
41
|
-
[291, 660],
|
|
42
|
-
[291, 681],
|
|
43
|
-
[291, 702]
|
|
44
|
-
],
|
|
45
|
-
relations: ['cloud.backend.storage:amazon.s3'],
|
|
46
|
-
source: 'cloud.backend',
|
|
47
|
-
target: 'amazon'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
headArrow: [
|
|
51
|
-
[344, 257],
|
|
52
|
-
[336, 263],
|
|
53
|
-
[338, 253]
|
|
54
|
-
],
|
|
55
|
-
id: 'support:cloud.frontend',
|
|
56
|
-
label: null,
|
|
57
|
-
labelBox: null,
|
|
58
|
-
points: [
|
|
59
|
-
[413, 141],
|
|
60
|
-
[391, 176],
|
|
61
|
-
[364, 218],
|
|
62
|
-
[342, 255]
|
|
63
|
-
],
|
|
64
|
-
relations: ['support:cloud.frontend.adminPanel'],
|
|
65
|
-
source: 'support',
|
|
66
|
-
target: 'cloud.frontend'
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
headArrow: [
|
|
70
|
-
[244, 253],
|
|
71
|
-
[246, 263],
|
|
72
|
-
[239, 257]
|
|
73
|
-
],
|
|
74
|
-
id: 'customer:cloud.frontend',
|
|
75
|
-
label: 'opens',
|
|
76
|
-
labelBox: {
|
|
77
|
-
align: 'left',
|
|
78
|
-
width: 44,
|
|
79
|
-
x: 208,
|
|
80
|
-
y: 193
|
|
81
|
-
},
|
|
82
|
-
points: [
|
|
83
|
-
[169, 141],
|
|
84
|
-
[191, 176],
|
|
85
|
-
[218, 218],
|
|
86
|
-
[241, 255]
|
|
87
|
-
],
|
|
88
|
-
relations: ['customer:cloud.frontend.dashboard'],
|
|
89
|
-
source: 'customer',
|
|
90
|
-
target: 'cloud.frontend'
|
|
91
|
-
}
|
|
92
|
-
],
|
|
93
|
-
height: 855,
|
|
94
|
-
id: 'fakeView',
|
|
95
|
-
nodes: [
|
|
96
|
-
{
|
|
97
|
-
children: [],
|
|
98
|
-
color: 'primary',
|
|
99
|
-
id: 'amazon',
|
|
100
|
-
parent: null,
|
|
101
|
-
position: [165, 715],
|
|
102
|
-
relative: [165, 715],
|
|
103
|
-
shape: 'rectangle',
|
|
104
|
-
size: {
|
|
105
|
-
height: 140,
|
|
106
|
-
width: 251
|
|
107
|
-
},
|
|
108
|
-
title: 'amazon'
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
children: ['cloud.backend', 'cloud.frontend'],
|
|
112
|
-
color: 'primary',
|
|
113
|
-
id: 'cloud',
|
|
114
|
-
parent: null,
|
|
115
|
-
position: [139, 210],
|
|
116
|
-
relative: [139, 210],
|
|
117
|
-
shape: 'rectangle',
|
|
118
|
-
size: {
|
|
119
|
-
height: 457,
|
|
120
|
-
width: 304
|
|
121
|
-
},
|
|
122
|
-
title: 'cloud'
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
children: [],
|
|
126
|
-
color: 'primary',
|
|
127
|
-
id: 'customer',
|
|
128
|
-
parent: null,
|
|
129
|
-
position: [0, 0],
|
|
130
|
-
relative: [0, 0],
|
|
131
|
-
shape: 'rectangle',
|
|
132
|
-
size: {
|
|
133
|
-
height: 140,
|
|
134
|
-
width: 251
|
|
135
|
-
},
|
|
136
|
-
title: 'customer'
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
children: [],
|
|
140
|
-
color: 'primary',
|
|
141
|
-
id: 'support',
|
|
142
|
-
parent: null,
|
|
143
|
-
position: [330, 0],
|
|
144
|
-
relative: [330, 0],
|
|
145
|
-
shape: 'rectangle',
|
|
146
|
-
size: {
|
|
147
|
-
height: 140,
|
|
148
|
-
width: 251
|
|
149
|
-
},
|
|
150
|
-
title: 'support'
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
children: [],
|
|
154
|
-
color: 'primary',
|
|
155
|
-
id: 'cloud.backend',
|
|
156
|
-
parent: 'cloud',
|
|
157
|
-
position: [165, 500],
|
|
158
|
-
relative: [26, 290],
|
|
159
|
-
shape: 'rectangle',
|
|
160
|
-
size: {
|
|
161
|
-
height: 140,
|
|
162
|
-
width: 251
|
|
163
|
-
},
|
|
164
|
-
title: 'backend'
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
children: [],
|
|
168
|
-
color: 'primary',
|
|
169
|
-
id: 'cloud.frontend',
|
|
170
|
-
parent: 'cloud',
|
|
171
|
-
position: [165, 266],
|
|
172
|
-
relative: [26, 56],
|
|
173
|
-
shape: 'rectangle',
|
|
174
|
-
size: {
|
|
175
|
-
height: 140,
|
|
176
|
-
width: 251
|
|
177
|
-
},
|
|
178
|
-
title: 'frontend'
|
|
179
|
-
}
|
|
180
|
-
],
|
|
181
|
-
rules: [
|
|
182
|
-
{
|
|
183
|
-
exprs: [
|
|
184
|
-
{
|
|
185
|
-
wildcard: true
|
|
186
|
-
}
|
|
187
|
-
],
|
|
188
|
-
isInclude: true
|
|
189
|
-
}
|
|
190
|
-
],
|
|
191
|
-
title: '',
|
|
192
|
-
viewOf: 'cloud',
|
|
193
|
-
width: 582
|
|
194
|
-
};
|
|
195
|
-
export const fakeDiagram2 = {
|
|
196
|
-
edges: [
|
|
197
|
-
{
|
|
198
|
-
headArrow: [
|
|
199
|
-
[129, 456],
|
|
200
|
-
[126, 465],
|
|
201
|
-
[123, 456]
|
|
202
|
-
],
|
|
203
|
-
id: 'system.frontend:system.backend',
|
|
204
|
-
label: 'requests',
|
|
205
|
-
labelBox: {
|
|
206
|
-
align: 'left',
|
|
207
|
-
width: 62,
|
|
208
|
-
x: 130,
|
|
209
|
-
y: 428
|
|
210
|
-
},
|
|
211
|
-
points: [
|
|
212
|
-
[126, 375],
|
|
213
|
-
[126, 400],
|
|
214
|
-
[126, 429],
|
|
215
|
-
[126, 456]
|
|
216
|
-
],
|
|
217
|
-
relations: ['671e3db5eb605d5f245f247d95925bd0953e0e4c'],
|
|
218
|
-
source: 'system.frontend',
|
|
219
|
-
target: 'system.backend'
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
headArrow: [
|
|
223
|
-
[129, 221],
|
|
224
|
-
[126, 231],
|
|
225
|
-
[123, 221]
|
|
226
|
-
],
|
|
227
|
-
id: 'client:system.frontend',
|
|
228
|
-
label: 'opens',
|
|
229
|
-
labelBox: {
|
|
230
|
-
align: 'left',
|
|
231
|
-
width: 44,
|
|
232
|
-
x: 130,
|
|
233
|
-
y: 193
|
|
234
|
-
},
|
|
235
|
-
points: [
|
|
236
|
-
[126, 141],
|
|
237
|
-
[126, 166],
|
|
238
|
-
[126, 195],
|
|
239
|
-
[126, 221]
|
|
240
|
-
],
|
|
241
|
-
relations: ['99bffdfd5c78e024393e6223cd9b19225321a5e3'],
|
|
242
|
-
source: 'client',
|
|
243
|
-
target: 'system.frontend'
|
|
244
|
-
}
|
|
245
|
-
],
|
|
246
|
-
height: 609,
|
|
247
|
-
id: '74f5364fa4b',
|
|
248
|
-
nodes: [
|
|
249
|
-
{
|
|
250
|
-
children: [],
|
|
251
|
-
color: 'primary',
|
|
252
|
-
id: 'client',
|
|
253
|
-
parent: null,
|
|
254
|
-
position: [0, 0],
|
|
255
|
-
relative: [0, 0],
|
|
256
|
-
shape: 'rectangle',
|
|
257
|
-
size: {
|
|
258
|
-
height: 140,
|
|
259
|
-
width: 251
|
|
260
|
-
},
|
|
261
|
-
title: 'client'
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
children: [],
|
|
265
|
-
color: 'primary',
|
|
266
|
-
id: 'system.backend',
|
|
267
|
-
parent: null,
|
|
268
|
-
position: [0, 469],
|
|
269
|
-
relative: [0, 469],
|
|
270
|
-
shape: 'rectangle',
|
|
271
|
-
size: {
|
|
272
|
-
height: 140,
|
|
273
|
-
width: 251
|
|
274
|
-
},
|
|
275
|
-
title: 'backend'
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
children: [],
|
|
279
|
-
color: 'primary',
|
|
280
|
-
id: 'system.frontend',
|
|
281
|
-
parent: null,
|
|
282
|
-
position: [0, 235],
|
|
283
|
-
relative: [0, 235],
|
|
284
|
-
shape: 'rectangle',
|
|
285
|
-
size: {
|
|
286
|
-
height: 140,
|
|
287
|
-
width: 251
|
|
288
|
-
},
|
|
289
|
-
title: 'frontend'
|
|
290
|
-
}
|
|
291
|
-
],
|
|
292
|
-
rules: [
|
|
293
|
-
{
|
|
294
|
-
exprs: [
|
|
295
|
-
{
|
|
296
|
-
wildcard: true
|
|
297
|
-
}
|
|
298
|
-
],
|
|
299
|
-
isInclude: true
|
|
300
|
-
}
|
|
301
|
-
],
|
|
302
|
-
title: 'frontend',
|
|
303
|
-
viewOf: 'system.frontend',
|
|
304
|
-
width: 251
|
|
305
|
-
};
|
|
306
|
-
export const fakeComputedView3Levels = {
|
|
307
|
-
edges: [
|
|
308
|
-
{
|
|
309
|
-
id: 'cloud.frontend.dashboard:cloud.backend.graphql',
|
|
310
|
-
label: null,
|
|
311
|
-
relations: ['cloud.frontend.dashboard:cloud.backend.graphql'],
|
|
312
|
-
source: 'cloud.frontend.dashboard',
|
|
313
|
-
target: 'cloud.backend.graphql'
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
id: 'cloud.frontend.adminPanel:cloud.backend.graphql',
|
|
317
|
-
label: null,
|
|
318
|
-
relations: ['cloud.frontend.adminPanel:cloud.backend.graphql'],
|
|
319
|
-
source: 'cloud.frontend.adminPanel',
|
|
320
|
-
target: 'cloud.backend.graphql'
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
id: 'cloud.backend.storage:amazon',
|
|
324
|
-
label: null,
|
|
325
|
-
relations: ['cloud.backend.storage:amazon.s3'],
|
|
326
|
-
source: 'cloud.backend.storage',
|
|
327
|
-
target: 'amazon'
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
id: 'cloud.backend.graphql:cloud.backend.storage',
|
|
331
|
-
label: null,
|
|
332
|
-
relations: ['cloud.backend.graphql:cloud.backend.storage'],
|
|
333
|
-
source: 'cloud.backend.graphql',
|
|
334
|
-
target: 'cloud.backend.storage'
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
id: 'support:cloud.frontend.adminPanel',
|
|
338
|
-
label: null,
|
|
339
|
-
relations: ['support:cloud.frontend.adminPanel'],
|
|
340
|
-
source: 'support',
|
|
341
|
-
target: 'cloud.frontend.adminPanel'
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
id: 'customer:cloud.frontend.dashboard',
|
|
345
|
-
label: null,
|
|
346
|
-
relations: ['customer:cloud.frontend.dashboard'],
|
|
347
|
-
source: 'customer',
|
|
348
|
-
target: 'cloud.frontend.dashboard'
|
|
349
|
-
}
|
|
350
|
-
],
|
|
351
|
-
id: 'cloud3levels',
|
|
352
|
-
nodes: [
|
|
353
|
-
{
|
|
354
|
-
children: [],
|
|
355
|
-
color: 'primary',
|
|
356
|
-
id: 'amazon',
|
|
357
|
-
parent: null,
|
|
358
|
-
shape: 'rectangle',
|
|
359
|
-
title: 'amazon'
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
children: ['cloud.backend', 'cloud.frontend.adminPanel', 'cloud.frontend.dashboard'],
|
|
363
|
-
color: 'primary',
|
|
364
|
-
id: 'cloud',
|
|
365
|
-
navigateTo: 'fakeView',
|
|
366
|
-
parent: null,
|
|
367
|
-
shape: 'rectangle',
|
|
368
|
-
title: 'cloud'
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
children: [],
|
|
372
|
-
color: 'primary',
|
|
373
|
-
id: 'customer',
|
|
374
|
-
parent: null,
|
|
375
|
-
shape: 'rectangle',
|
|
376
|
-
title: 'customer'
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
children: [],
|
|
380
|
-
color: 'primary',
|
|
381
|
-
id: 'support',
|
|
382
|
-
parent: null,
|
|
383
|
-
shape: 'rectangle',
|
|
384
|
-
title: 'support'
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
children: ['cloud.backend.graphql', 'cloud.backend.storage'],
|
|
388
|
-
color: 'primary',
|
|
389
|
-
id: 'cloud.backend',
|
|
390
|
-
parent: 'cloud',
|
|
391
|
-
shape: 'rectangle',
|
|
392
|
-
title: 'backend'
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
children: [],
|
|
396
|
-
color: 'primary',
|
|
397
|
-
id: 'cloud.backend.graphql',
|
|
398
|
-
parent: 'cloud.backend',
|
|
399
|
-
shape: 'rectangle',
|
|
400
|
-
title: 'graphql'
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
children: [],
|
|
404
|
-
color: 'primary',
|
|
405
|
-
id: 'cloud.backend.storage',
|
|
406
|
-
parent: 'cloud.backend',
|
|
407
|
-
shape: 'rectangle',
|
|
408
|
-
title: 'storage'
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
children: [],
|
|
412
|
-
color: 'primary',
|
|
413
|
-
id: 'cloud.frontend.adminPanel',
|
|
414
|
-
parent: 'cloud',
|
|
415
|
-
shape: 'rectangle',
|
|
416
|
-
title: 'adminPanel'
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
children: [],
|
|
420
|
-
color: 'primary',
|
|
421
|
-
id: 'cloud.frontend.dashboard',
|
|
422
|
-
parent: 'cloud',
|
|
423
|
-
shape: 'rectangle',
|
|
424
|
-
title: 'dashboard'
|
|
425
|
-
}
|
|
426
|
-
],
|
|
427
|
-
rules: [
|
|
428
|
-
{
|
|
429
|
-
exprs: [
|
|
430
|
-
{
|
|
431
|
-
wildcard: true
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
element: 'cloud.frontend',
|
|
435
|
-
isDescedants: true
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
element: 'cloud.backend',
|
|
439
|
-
isDescedants: true
|
|
440
|
-
}
|
|
441
|
-
],
|
|
442
|
-
isInclude: true
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
exprs: [
|
|
446
|
-
{
|
|
447
|
-
element: 'cloud.frontend',
|
|
448
|
-
isDescedants: false
|
|
449
|
-
}
|
|
450
|
-
],
|
|
451
|
-
isInclude: false
|
|
452
|
-
}
|
|
453
|
-
],
|
|
454
|
-
title: 'Context: Cloud',
|
|
455
|
-
viewOf: 'cloud'
|
|
456
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-d2.d.ts","sourceRoot":"","sources":["../../src/d2/generate-d2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8B,YAAY,EAAU,MAAM,cAAc,CAAA;AA+CpF,wBAAgB,UAAU,CAAC,CAAC,SAAS,YAAY,EAAE,IAAI,EAAE,CAAC,UA0DzD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-d2.spec.d.ts","sourceRoot":"","sources":["../../src/d2/generate-d2.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { expect, test } from 'vitest';
|
|
2
|
-
import { fakeComputedView3Levels, fakeDiagram, fakeDiagram2 } from '../__mocks__/data';
|
|
3
|
-
import { generateD2 } from './generate-d2';
|
|
4
|
-
test('generate D2 - fakeDiagram', () => {
|
|
5
|
-
expect(generateD2(fakeDiagram)).toMatchSnapshot();
|
|
6
|
-
});
|
|
7
|
-
test('generate D2 - fakeDiagram2', () => {
|
|
8
|
-
expect(generateD2(fakeDiagram2)).toMatchSnapshot();
|
|
9
|
-
});
|
|
10
|
-
test('generate D2 - fakeComputedView 3 Levels', () => {
|
|
11
|
-
expect(generateD2(fakeComputedView3Levels)).toMatchSnapshot();
|
|
12
|
-
});
|
package/dist/d2/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/d2/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-mmd.d.ts","sourceRoot":"","sources":["../../src/mmd/generate-mmd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8B,YAAY,EAAU,MAAM,cAAc,CAAA;AA8BpF,wBAAgB,eAAe,CAAC,CAAC,SAAS,YAAY,EAAE,IAAI,EAAE,CAAC,UA+E9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-mmd.spec.d.ts","sourceRoot":"","sources":["../../src/mmd/generate-mmd.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { expect, test } from 'vitest';
|
|
2
|
-
import { fakeComputedView3Levels, fakeDiagram, fakeDiagram2 } from '../__mocks__/data';
|
|
3
|
-
import { generateMermaid } from './generate-mmd';
|
|
4
|
-
test('generate mermaid - fakeDiagram', () => {
|
|
5
|
-
expect(generateMermaid(fakeDiagram)).toMatchSnapshot();
|
|
6
|
-
});
|
|
7
|
-
test('generate mermaid - fakeDiagram2', () => {
|
|
8
|
-
expect(generateMermaid(fakeDiagram2)).toMatchSnapshot();
|
|
9
|
-
});
|
|
10
|
-
test('generate mermaid - fakeComputedView 3 Levels', () => {
|
|
11
|
-
expect(generateMermaid(fakeComputedView3Levels)).toMatchSnapshot();
|
|
12
|
-
});
|
package/dist/mmd/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mmd/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-react.d.ts","sourceRoot":"","sources":["../../src/react/generate-react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAa/C,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,UAqGjD"}
|