@xyd-js/sources 0.0.0-build
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/CHANGELOG.md +9 -0
- package/ISSUES.md +10 -0
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/TODO.md +9 -0
- package/__fixtures__/-1.typescript/package.json +5 -0
- package/__fixtures__/-1.typescript/src/index.ts +0 -0
- package/__fixtures__/-1.typescript/src/settings.ts +592 -0
- package/__fixtures__/-1.typescript/tsconfig.json +8 -0
- package/__fixtures__/-2.react.basic/1.flat-interface.output.json +114 -0
- package/__fixtures__/-2.react.basic/2.file-connect-interface.output.json +60 -0
- package/__fixtures__/-2.react.basic/2a.file-connect-interface-advanced.output.json +92 -0
- package/__fixtures__/-2.react.basic/3.props-as-variants.output.json +166 -0
- package/__fixtures__/-2.react.basic/4.outside-interface.output.json +60 -0
- package/__fixtures__/-2.react.basic/5.inline-props.output.json +60 -0
- package/__fixtures__/-2.react.basic/5.outside-inline-props.output.json +60 -0
- package/__fixtures__/-2.react.basic/5a.inline-props+outside.output.json +60 -0
- package/__fixtures__/-2.react.basic/5b.inline-props+interfaces.output.json +92 -0
- package/__fixtures__/-2.react.basic/package.json +4 -0
- package/__fixtures__/-2.react.basic/src/1.flat-interface.tsx +41 -0
- package/__fixtures__/-2.react.basic/src/2.file-connect-interface.tsx +28 -0
- package/__fixtures__/-2.react.basic/src/2a.file-connect-interace+advanced.tsx +54 -0
- package/__fixtures__/-2.react.basic/src/3.props-as-variants.tsx +67 -0
- package/__fixtures__/-2.react.basic/src/4.outside-interface.tsx +13 -0
- package/__fixtures__/-2.react.basic/src/4.outside-interface2.ts +15 -0
- package/__fixtures__/-2.react.basic/src/5.inline-props.tsx +19 -0
- package/__fixtures__/-2.react.basic/src/5a.inline-props+outside.tsx +19 -0
- package/__fixtures__/-2.react.basic/src/5b.inline-props+interfaces.tsx +62 -0
- package/__fixtures__/-2.react.basic/src/index.ts +0 -0
- package/__fixtures__/-2.react.basic/tsconfig.json +8 -0
- package/__tests__/sourcesToUniform.test.ts +167 -0
- package/__tests__/testResolvePropertySymbol.ts +838 -0
- package/__tests__/types.ts +12 -0
- package/__tests__/utils.ts +108 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +237 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +6 -0
- package/dist/react.d.ts +6 -0
- package/dist/react.js +212 -0
- package/dist/react.js.map +1 -0
- package/dist/ts.cjs +1794 -0
- package/dist/ts.cjs.map +1 -0
- package/dist/ts.d.cts +14 -0
- package/dist/ts.d.ts +14 -0
- package/dist/ts.js +1760 -0
- package/dist/ts.js.map +1 -0
- package/package.json +41 -0
- package/packages/react/index.ts +1 -0
- package/packages/react/uniformToReactUniform.ts +275 -0
- package/packages/ts/SignatureText.ts +233 -0
- package/packages/ts/TypeDocTransformer.ts +1519 -0
- package/packages/ts/__fixtures__/packages/package-a/package.json +4 -0
- package/packages/ts/__fixtures__/packages/package-a/src/index.ts +56 -0
- package/packages/ts/__fixtures__/packages/package-a/tsconfig.json +23 -0
- package/packages/ts/__fixtures__/packages/package-b/package.json +7 -0
- package/packages/ts/__fixtures__/packages/package-b/src/billing.ts +193 -0
- package/packages/ts/__fixtures__/packages/package-b/src/index.ts +8 -0
- package/packages/ts/__fixtures__/packages/package-b/tsconfig.json +20 -0
- package/packages/ts/__fixtures__/packages2/package-a/package.json +4 -0
- package/packages/ts/__fixtures__/packages2/package-a/src/index.ts +496 -0
- package/packages/ts/__fixtures__/packages2/package-a/tsconfig.json +6 -0
- package/packages/ts/__fixtures__/packages3/package-a/package.json +4 -0
- package/packages/ts/__fixtures__/packages3/package-a/src/index.ts +488 -0
- package/packages/ts/__fixtures__/packages3/package-a/tsconfig.json +6 -0
- package/packages/ts/__fixtures__/packages3/project.json +171 -0
- package/packages/ts/__fixtures__/react/react-a/package.json +5 -0
- package/packages/ts/__fixtures__/react/react-a/src/TestAbc.tsx +90 -0
- package/packages/ts/__fixtures__/react/react-a/src/TestBasic.tsx +27 -0
- package/packages/ts/__fixtures__/react/react-a/src/TestNamedParameters.tsx +27 -0
- package/packages/ts/__fixtures__/react/react-a/src/TestNamedParameters2.tsx +26 -0
- package/packages/ts/__fixtures__/react/react-a/src/TestUnion.tsx +32 -0
- package/packages/ts/__fixtures__/react/react-a/src/index.ts +1 -0
- package/packages/ts/__fixtures__/react/react-a/tsconfig.json +8 -0
- package/packages/ts/__fixtures__/references-output-project.json +344 -0
- package/packages/ts/__fixtures__/references-output-react.json +68 -0
- package/packages/ts/__fixtures__/references-output.json +129 -0
- package/packages/ts/__tests__/sourcesToUniform.test.ts +106 -0
- package/packages/ts/context.ts +0 -0
- package/packages/ts/converterts/ts-class.ts +0 -0
- package/packages/ts/converterts/ts-enum.ts +0 -0
- package/packages/ts/converterts/ts-function.ts +0 -0
- package/packages/ts/converterts/ts-interface.ts +0 -0
- package/packages/ts/converterts/ts-type.ts +0 -0
- package/packages/ts/index.ts +129 -0
- package/packages/ts/ts-core.ts +0 -0
- package/packages/ts/uniformToMiniUniform.ts +486 -0
- package/src/index.ts +0 -0
- package/test-cmd/index.ts +62 -0
- package/tsconfig.json +38 -0
- package/tsup.config.ts +39 -0
- package/vitest.config.ts +34 -0
|
@@ -0,0 +1,838 @@
|
|
|
1
|
+
import {describe, it} from 'vitest'
|
|
2
|
+
|
|
3
|
+
import {DEFINED_DEFINITION_PROPERTY_TYPE, DefinitionProperty} from "@xyd-js/uniform";
|
|
4
|
+
|
|
5
|
+
const data = {
|
|
6
|
+
"name": "plugins",
|
|
7
|
+
"type": "Plugins",
|
|
8
|
+
"description": "Plugins configuration\n",
|
|
9
|
+
"symbolDef": {
|
|
10
|
+
"id": "116",
|
|
11
|
+
"canonical": ""
|
|
12
|
+
},
|
|
13
|
+
"meta": [],
|
|
14
|
+
"properties": [],
|
|
15
|
+
"ofProperty": {
|
|
16
|
+
"name": "",
|
|
17
|
+
"type": "$$array",
|
|
18
|
+
"description": "Plugin configuration\n",
|
|
19
|
+
"ofProperty": {
|
|
20
|
+
"name": "",
|
|
21
|
+
"description": "",
|
|
22
|
+
"type": "$$union",
|
|
23
|
+
"properties": [
|
|
24
|
+
{
|
|
25
|
+
"name": "PluginConfig",
|
|
26
|
+
"type": "PluginConfig",
|
|
27
|
+
"description": "",
|
|
28
|
+
"properties": [],
|
|
29
|
+
"symbolDef": {
|
|
30
|
+
"id": "117",
|
|
31
|
+
"canonical": ""
|
|
32
|
+
},
|
|
33
|
+
"ofProperty": {
|
|
34
|
+
"name": "[PluginName, PluginArgs[]]",
|
|
35
|
+
"type": "[PluginName, PluginArgs[]]",
|
|
36
|
+
"description": "",
|
|
37
|
+
"properties": []
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "string",
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "",
|
|
44
|
+
"properties": []
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"symbolDef": {
|
|
48
|
+
"id": [
|
|
49
|
+
"117"
|
|
50
|
+
],
|
|
51
|
+
"canonical": ""
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"meta": [],
|
|
55
|
+
"symbolDef": {
|
|
56
|
+
"canonical": ""
|
|
57
|
+
},
|
|
58
|
+
"properties": []
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const data2 = {
|
|
63
|
+
"name": "head",
|
|
64
|
+
"type": "$$array",
|
|
65
|
+
"description": "Head configuration\n",
|
|
66
|
+
"ofProperty": {
|
|
67
|
+
"name": "",
|
|
68
|
+
"description": "",
|
|
69
|
+
"type": "[string, Record<string, string | boolean>]",
|
|
70
|
+
"properties": [],
|
|
71
|
+
"symbolDef": {
|
|
72
|
+
"canonical": ""
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"meta": [],
|
|
76
|
+
"symbolDef": {
|
|
77
|
+
"canonical": ""
|
|
78
|
+
},
|
|
79
|
+
"properties": []
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const data3 = {
|
|
83
|
+
"name": "sidebar",
|
|
84
|
+
"type": "$$array",
|
|
85
|
+
"description": "Definition of sidebar - an array of groups with all the pages within that group\n",
|
|
86
|
+
"ofProperty": {
|
|
87
|
+
"name": "",
|
|
88
|
+
"description": "",
|
|
89
|
+
"type": "$$union",
|
|
90
|
+
"properties": [
|
|
91
|
+
{
|
|
92
|
+
"name": "SidebarRoute",
|
|
93
|
+
"type": "SidebarRoute",
|
|
94
|
+
"description": "Sidebar multi-group configuration\n",
|
|
95
|
+
"properties": [
|
|
96
|
+
{
|
|
97
|
+
"name": "route",
|
|
98
|
+
"type": "string",
|
|
99
|
+
"description": "Route for this sidebar group\n",
|
|
100
|
+
"meta": [
|
|
101
|
+
{
|
|
102
|
+
"name": "required",
|
|
103
|
+
"value": "true"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"symbolDef": {
|
|
107
|
+
"canonical": ""
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "items",
|
|
112
|
+
"type": "$$array",
|
|
113
|
+
"description": "Sidebar items within this group\n",
|
|
114
|
+
"ofProperty": {
|
|
115
|
+
"name": "",
|
|
116
|
+
"description": "",
|
|
117
|
+
"type": "Sidebar",
|
|
118
|
+
"properties": [
|
|
119
|
+
{
|
|
120
|
+
"name": "group",
|
|
121
|
+
"type": "string",
|
|
122
|
+
"description": "The name of the group\n",
|
|
123
|
+
"meta": [],
|
|
124
|
+
"symbolDef": {
|
|
125
|
+
"canonical": ""
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "pages",
|
|
130
|
+
"type": "$$array",
|
|
131
|
+
"description": "The relative paths to the markdown files that will serve as pages.\nNote: groups are recursive, so to add a sub-folder add another group object in the page array.\n",
|
|
132
|
+
"ofProperty": {
|
|
133
|
+
"name": "",
|
|
134
|
+
"description": "",
|
|
135
|
+
"type": "PageURL",
|
|
136
|
+
"properties": [],
|
|
137
|
+
"symbolDef": {
|
|
138
|
+
"id": "50",
|
|
139
|
+
"canonical": ""
|
|
140
|
+
},
|
|
141
|
+
"ofProperty": {
|
|
142
|
+
"name": "",
|
|
143
|
+
"type": "$$union",
|
|
144
|
+
"description": "Page URL type\n",
|
|
145
|
+
"symbolDef": {
|
|
146
|
+
"id": [
|
|
147
|
+
"45"
|
|
148
|
+
],
|
|
149
|
+
"canonical": ""
|
|
150
|
+
},
|
|
151
|
+
"meta": [],
|
|
152
|
+
"properties": [
|
|
153
|
+
{
|
|
154
|
+
"name": "Sidebar",
|
|
155
|
+
"type": "Sidebar",
|
|
156
|
+
"description": "Sidebar configuration\n",
|
|
157
|
+
"properties": [
|
|
158
|
+
{
|
|
159
|
+
"name": "group",
|
|
160
|
+
"type": "string",
|
|
161
|
+
"description": "The name of the group\n",
|
|
162
|
+
"meta": [],
|
|
163
|
+
"symbolDef": {
|
|
164
|
+
"canonical": ""
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "pages",
|
|
169
|
+
"type": "$$array",
|
|
170
|
+
"description": "The relative paths to the markdown files that will serve as pages.\nNote: groups are recursive, so to add a sub-folder add another group object in the page array.\n",
|
|
171
|
+
"ofProperty": {
|
|
172
|
+
"name": "",
|
|
173
|
+
"description": "",
|
|
174
|
+
"type": "PageURL",
|
|
175
|
+
"properties": [],
|
|
176
|
+
"symbolDef": {
|
|
177
|
+
"id": "50",
|
|
178
|
+
"canonical": ""
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
"meta": [],
|
|
182
|
+
"symbolDef": {
|
|
183
|
+
"canonical": ""
|
|
184
|
+
},
|
|
185
|
+
"properties": []
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "icon",
|
|
189
|
+
"type": "string",
|
|
190
|
+
"description": "The icon of the group.\n",
|
|
191
|
+
"meta": [],
|
|
192
|
+
"symbolDef": {
|
|
193
|
+
"canonical": ""
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"name": "sort",
|
|
198
|
+
"type": "number",
|
|
199
|
+
"description": "The sort order of the group.\n",
|
|
200
|
+
"meta": [],
|
|
201
|
+
"symbolDef": {
|
|
202
|
+
"canonical": ""
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"symbolDef": {
|
|
207
|
+
"id": "45",
|
|
208
|
+
"canonical": ""
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "string",
|
|
213
|
+
"type": "string",
|
|
214
|
+
"description": "",
|
|
215
|
+
"properties": []
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
"meta": [],
|
|
221
|
+
"symbolDef": {
|
|
222
|
+
"canonical": ""
|
|
223
|
+
},
|
|
224
|
+
"properties": []
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"name": "icon",
|
|
228
|
+
"type": "string",
|
|
229
|
+
"description": "The icon of the group.\n",
|
|
230
|
+
"meta": [],
|
|
231
|
+
"symbolDef": {
|
|
232
|
+
"canonical": ""
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"name": "sort",
|
|
237
|
+
"type": "number",
|
|
238
|
+
"description": "The sort order of the group.\n",
|
|
239
|
+
"meta": [],
|
|
240
|
+
"symbolDef": {
|
|
241
|
+
"canonical": ""
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
],
|
|
245
|
+
"symbolDef": {
|
|
246
|
+
"id": "45",
|
|
247
|
+
"canonical": ""
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"meta": [
|
|
251
|
+
{
|
|
252
|
+
"name": "required",
|
|
253
|
+
"value": "true"
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
"symbolDef": {
|
|
257
|
+
"canonical": ""
|
|
258
|
+
},
|
|
259
|
+
"properties": []
|
|
260
|
+
}
|
|
261
|
+
],
|
|
262
|
+
"symbolDef": {
|
|
263
|
+
"id": "42",
|
|
264
|
+
"canonical": ""
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"name": "Sidebar",
|
|
269
|
+
"type": "Sidebar",
|
|
270
|
+
"description": "Sidebar configuration\n",
|
|
271
|
+
"properties": [
|
|
272
|
+
{
|
|
273
|
+
"name": "group",
|
|
274
|
+
"type": "string",
|
|
275
|
+
"description": "The name of the group\n",
|
|
276
|
+
"meta": [],
|
|
277
|
+
"symbolDef": {
|
|
278
|
+
"canonical": ""
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"name": "pages",
|
|
283
|
+
"type": "$$array",
|
|
284
|
+
"description": "The relative paths to the markdown files that will serve as pages.\nNote: groups are recursive, so to add a sub-folder add another group object in the page array.\n",
|
|
285
|
+
"ofProperty": {
|
|
286
|
+
"name": "",
|
|
287
|
+
"description": "",
|
|
288
|
+
"type": "PageURL",
|
|
289
|
+
"properties": [],
|
|
290
|
+
"symbolDef": {
|
|
291
|
+
"id": "50",
|
|
292
|
+
"canonical": ""
|
|
293
|
+
},
|
|
294
|
+
"ofProperty": {
|
|
295
|
+
"name": "",
|
|
296
|
+
"type": "$$union",
|
|
297
|
+
"description": "Page URL type\n",
|
|
298
|
+
"symbolDef": {
|
|
299
|
+
"id": [
|
|
300
|
+
"45"
|
|
301
|
+
],
|
|
302
|
+
"canonical": ""
|
|
303
|
+
},
|
|
304
|
+
"meta": [],
|
|
305
|
+
"properties": [
|
|
306
|
+
{
|
|
307
|
+
"name": "Sidebar",
|
|
308
|
+
"type": "Sidebar",
|
|
309
|
+
"description": "Sidebar configuration\n",
|
|
310
|
+
"properties": [
|
|
311
|
+
{
|
|
312
|
+
"name": "group",
|
|
313
|
+
"type": "string",
|
|
314
|
+
"description": "The name of the group\n",
|
|
315
|
+
"meta": [],
|
|
316
|
+
"symbolDef": {
|
|
317
|
+
"canonical": ""
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"name": "pages",
|
|
322
|
+
"type": "$$array",
|
|
323
|
+
"description": "The relative paths to the markdown files that will serve as pages.\nNote: groups are recursive, so to add a sub-folder add another group object in the page array.\n",
|
|
324
|
+
"ofProperty": {
|
|
325
|
+
"name": "",
|
|
326
|
+
"description": "",
|
|
327
|
+
"type": "PageURL",
|
|
328
|
+
"properties": [],
|
|
329
|
+
"symbolDef": {
|
|
330
|
+
"id": "50",
|
|
331
|
+
"canonical": ""
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
"meta": [],
|
|
335
|
+
"symbolDef": {
|
|
336
|
+
"canonical": ""
|
|
337
|
+
},
|
|
338
|
+
"properties": []
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"name": "icon",
|
|
342
|
+
"type": "string",
|
|
343
|
+
"description": "The icon of the group.\n",
|
|
344
|
+
"meta": [],
|
|
345
|
+
"symbolDef": {
|
|
346
|
+
"canonical": ""
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"name": "sort",
|
|
351
|
+
"type": "number",
|
|
352
|
+
"description": "The sort order of the group.\n",
|
|
353
|
+
"meta": [],
|
|
354
|
+
"symbolDef": {
|
|
355
|
+
"canonical": ""
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
"symbolDef": {
|
|
360
|
+
"id": "45",
|
|
361
|
+
"canonical": ""
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"name": "string",
|
|
366
|
+
"type": "string",
|
|
367
|
+
"description": "",
|
|
368
|
+
"properties": []
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
"meta": [],
|
|
374
|
+
"symbolDef": {
|
|
375
|
+
"canonical": ""
|
|
376
|
+
},
|
|
377
|
+
"properties": []
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"name": "icon",
|
|
381
|
+
"type": "string",
|
|
382
|
+
"description": "The icon of the group.\n",
|
|
383
|
+
"meta": [],
|
|
384
|
+
"symbolDef": {
|
|
385
|
+
"canonical": ""
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"name": "sort",
|
|
390
|
+
"type": "number",
|
|
391
|
+
"description": "The sort order of the group.\n",
|
|
392
|
+
"meta": [],
|
|
393
|
+
"symbolDef": {
|
|
394
|
+
"canonical": ""
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
],
|
|
398
|
+
"symbolDef": {
|
|
399
|
+
"id": "45",
|
|
400
|
+
"canonical": ""
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
"symbolDef": {
|
|
405
|
+
"id": [
|
|
406
|
+
"42",
|
|
407
|
+
"45"
|
|
408
|
+
],
|
|
409
|
+
"canonical": ""
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
"meta": [
|
|
413
|
+
{
|
|
414
|
+
"name": "required",
|
|
415
|
+
"value": "true"
|
|
416
|
+
}
|
|
417
|
+
],
|
|
418
|
+
"symbolDef": {
|
|
419
|
+
"canonical": ""
|
|
420
|
+
},
|
|
421
|
+
"properties": []
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const data4 = {
|
|
425
|
+
"name": "paths",
|
|
426
|
+
"type": "EnginePaths",
|
|
427
|
+
"description": "Path aliases for imports. Avoid long relative paths by creating shortcuts.\n",
|
|
428
|
+
"symbolDef": {
|
|
429
|
+
"id": "132",
|
|
430
|
+
"canonical": ""
|
|
431
|
+
},
|
|
432
|
+
"meta": [],
|
|
433
|
+
"examples": [
|
|
434
|
+
"```json\n{\n \"paths\": {\n \"@my-package/*\": [\"../my-package/src/*\"],\n \"@livesession-go/*\": [\"https://github.com/livesession/livesession-go/*\"]\n }\n}",
|
|
435
|
+
"```typescript\n// Instead of\n@importCode(\"../../../my-package/src/components/Badge.tsx\")\n\n// Use\n@importCode(\"@my-package/src/components/Badge.tsx\")"
|
|
436
|
+
],
|
|
437
|
+
"properties": [],
|
|
438
|
+
"ofProperty": {
|
|
439
|
+
"name": "",
|
|
440
|
+
"type": "$$union",
|
|
441
|
+
"description": "",
|
|
442
|
+
"properties": [],
|
|
443
|
+
"meta": [],
|
|
444
|
+
"ofProperty": {
|
|
445
|
+
"name": "",
|
|
446
|
+
"type": "{\n [key: string]: string[];\n}",
|
|
447
|
+
"description": ""
|
|
448
|
+
},
|
|
449
|
+
"symbolDef": {
|
|
450
|
+
"canonical": ""
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
const data5 = {
|
|
456
|
+
"name": "metatags",
|
|
457
|
+
"type": "$$union",
|
|
458
|
+
"description": "Meta tags\n",
|
|
459
|
+
"properties": [],
|
|
460
|
+
"meta": [],
|
|
461
|
+
"ofProperty": {
|
|
462
|
+
"name": "",
|
|
463
|
+
"type": "{\n [tag: string]: string;\n}",
|
|
464
|
+
"description": ""
|
|
465
|
+
},
|
|
466
|
+
"symbolDef": {
|
|
467
|
+
"canonical": ""
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
const data6 = {
|
|
473
|
+
"name": "openapi",
|
|
474
|
+
"type": "APIFile",
|
|
475
|
+
"description": "OpenAPI configuration\n",
|
|
476
|
+
"symbolDef": {
|
|
477
|
+
"id": "75",
|
|
478
|
+
"canonical": ""
|
|
479
|
+
},
|
|
480
|
+
"meta": [],
|
|
481
|
+
"properties": [],
|
|
482
|
+
"ofProperty": {
|
|
483
|
+
"name": "",
|
|
484
|
+
"type": "$$union",
|
|
485
|
+
"description": "API file configuration. Can be a path, an array of paths, a map of paths, or an advanced configuration\n",
|
|
486
|
+
"symbolDef": {
|
|
487
|
+
"id": [
|
|
488
|
+
"76",
|
|
489
|
+
"80"
|
|
490
|
+
],
|
|
491
|
+
"canonical": ""
|
|
492
|
+
},
|
|
493
|
+
"meta": [],
|
|
494
|
+
"properties": [
|
|
495
|
+
{
|
|
496
|
+
"name": "APIFileMap",
|
|
497
|
+
"type": "APIFileMap",
|
|
498
|
+
"description": "API file map type\n",
|
|
499
|
+
"properties": [],
|
|
500
|
+
"symbolDef": {
|
|
501
|
+
"id": "76",
|
|
502
|
+
"canonical": ""
|
|
503
|
+
},
|
|
504
|
+
"ofProperty": {
|
|
505
|
+
"name": "",
|
|
506
|
+
"type": "{\n [name: string]: string | APIFileAdvanced;\n}",
|
|
507
|
+
"description": ""
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"name": "APIFileAdvanced",
|
|
512
|
+
"type": "APIFileAdvanced",
|
|
513
|
+
"description": "API file advanced type\n",
|
|
514
|
+
"properties": [
|
|
515
|
+
{
|
|
516
|
+
"name": "info",
|
|
517
|
+
"type": "APIInfo",
|
|
518
|
+
"description": "API information configuration\n",
|
|
519
|
+
"symbolDef": {
|
|
520
|
+
"id": "84",
|
|
521
|
+
"canonical": ""
|
|
522
|
+
},
|
|
523
|
+
"meta": [],
|
|
524
|
+
"properties": [
|
|
525
|
+
{
|
|
526
|
+
"name": "baseUrl",
|
|
527
|
+
"type": "string",
|
|
528
|
+
"description": "The base url for all API endpoints. If baseUrl is an array, it will enable\nfor multiple base url options that the user can toggle.\n",
|
|
529
|
+
"meta": [],
|
|
530
|
+
"symbolDef": {
|
|
531
|
+
"canonical": ""
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
"name": "auth",
|
|
536
|
+
"type": "APIAuth",
|
|
537
|
+
"description": "Authentication information\n",
|
|
538
|
+
"symbolDef": {
|
|
539
|
+
"id": "91",
|
|
540
|
+
"canonical": ""
|
|
541
|
+
},
|
|
542
|
+
"meta": [],
|
|
543
|
+
"properties": [
|
|
544
|
+
{
|
|
545
|
+
"name": "method",
|
|
546
|
+
"type": "\"bearer\" | \"basic\" | \"key\"",
|
|
547
|
+
"description": "The authentication strategy used for all API endpoints\n",
|
|
548
|
+
"symbolDef": {
|
|
549
|
+
"id": [],
|
|
550
|
+
"canonical": ""
|
|
551
|
+
},
|
|
552
|
+
"meta": [
|
|
553
|
+
{
|
|
554
|
+
"name": "required",
|
|
555
|
+
"value": "true"
|
|
556
|
+
}
|
|
557
|
+
]
|
|
558
|
+
}
|
|
559
|
+
]
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"name": "name",
|
|
563
|
+
"type": "string",
|
|
564
|
+
"description": "The name of the authentication parameter used in the API playground.\nIf method is basic, the format should be [usernameName]:[passwordName]\n",
|
|
565
|
+
"meta": [],
|
|
566
|
+
"symbolDef": {
|
|
567
|
+
"canonical": ""
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
"name": "inputPrefix",
|
|
572
|
+
"type": "string",
|
|
573
|
+
"description": "The default value that's designed to be a prefisx for the authentication input field.\nE.g. If an inputPrefix of AuthKey would inherit the default input result of the authentication field as AuthKey.\n",
|
|
574
|
+
"meta": [],
|
|
575
|
+
"symbolDef": {
|
|
576
|
+
"canonical": ""
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
"name": "playground",
|
|
581
|
+
"type": "APIPlayground",
|
|
582
|
+
"description": "Configurations for the API playground\n",
|
|
583
|
+
"symbolDef": {
|
|
584
|
+
"id": "93",
|
|
585
|
+
"canonical": ""
|
|
586
|
+
},
|
|
587
|
+
"meta": [],
|
|
588
|
+
"properties": [
|
|
589
|
+
{
|
|
590
|
+
"name": "mode",
|
|
591
|
+
"type": "\"show\" | \"simple\" | \"hide\"",
|
|
592
|
+
"description": "Playground display mode\n",
|
|
593
|
+
"symbolDef": {
|
|
594
|
+
"id": [],
|
|
595
|
+
"canonical": ""
|
|
596
|
+
},
|
|
597
|
+
"meta": []
|
|
598
|
+
}
|
|
599
|
+
]
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
"name": "request",
|
|
603
|
+
"type": "APIInfoRequest",
|
|
604
|
+
"description": "Request configuration\n",
|
|
605
|
+
"symbolDef": {
|
|
606
|
+
"id": "95",
|
|
607
|
+
"canonical": ""
|
|
608
|
+
},
|
|
609
|
+
"meta": [],
|
|
610
|
+
"properties": [
|
|
611
|
+
{
|
|
612
|
+
"name": "example",
|
|
613
|
+
"type": "{\n languages?: string[];\n}",
|
|
614
|
+
"description": "Configurations for the auto-generated API request examples\n",
|
|
615
|
+
"properties": [
|
|
616
|
+
{
|
|
617
|
+
"name": "languages",
|
|
618
|
+
"type": "string[]",
|
|
619
|
+
"description": "An array of strings that determine the order of the languages of the auto-generated request examples.\nYou can either define custom languages utilizing x-codeSamples or use our default languages which include\nbash, python, javascript, php, go, java\n",
|
|
620
|
+
"meta": []
|
|
621
|
+
}
|
|
622
|
+
],
|
|
623
|
+
"meta": [],
|
|
624
|
+
"symbolDef": {
|
|
625
|
+
"canonical": ""
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
]
|
|
629
|
+
}
|
|
630
|
+
]
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"name": "route",
|
|
634
|
+
"type": "string",
|
|
635
|
+
"description": "Route configuration\n",
|
|
636
|
+
"meta": [
|
|
637
|
+
{
|
|
638
|
+
"name": "required",
|
|
639
|
+
"value": "true"
|
|
640
|
+
}
|
|
641
|
+
],
|
|
642
|
+
"symbolDef": {
|
|
643
|
+
"canonical": ""
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
],
|
|
647
|
+
"symbolDef": {
|
|
648
|
+
"id": "80",
|
|
649
|
+
"canonical": ""
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
"name": "string",
|
|
654
|
+
"type": "string",
|
|
655
|
+
"description": "",
|
|
656
|
+
"properties": []
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
"name": "string[]",
|
|
660
|
+
"type": "string[]",
|
|
661
|
+
"description": "",
|
|
662
|
+
"properties": []
|
|
663
|
+
}
|
|
664
|
+
]
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
const data7 = {
|
|
669
|
+
"name": "APIFileMap",
|
|
670
|
+
"type": "APIFileMap",
|
|
671
|
+
"description": "API file map type\n",
|
|
672
|
+
"properties": [],
|
|
673
|
+
"symbolDef": {
|
|
674
|
+
"id": "76",
|
|
675
|
+
"canonical": ""
|
|
676
|
+
},
|
|
677
|
+
"ofProperty": {
|
|
678
|
+
"name": "",
|
|
679
|
+
"type": "{\n [name: string]: string | APIFileAdvanced;\n}",
|
|
680
|
+
"description": ""
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
describe("resolvePropertySymbol", () => {
|
|
684
|
+
it("should resolve simple property type", () => {
|
|
685
|
+
const resp = resolvePropertySymbol(data7)
|
|
686
|
+
|
|
687
|
+
console.log(resp.join(" "))
|
|
688
|
+
}
|
|
689
|
+
)
|
|
690
|
+
})
|
|
691
|
+
|
|
692
|
+
function resolvePropertySymbol(property: DefinitionProperty): string[] {
|
|
693
|
+
if (property?.ofProperty) {
|
|
694
|
+
switch (property.ofProperty.type) {
|
|
695
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.ARRAY: {
|
|
696
|
+
let ofOfSymbols: string[] = []
|
|
697
|
+
|
|
698
|
+
if (property.type) {
|
|
699
|
+
ofOfSymbols.push(property.type)
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
if (property.ofProperty.ofProperty) {
|
|
703
|
+
const symbols = groupSymbol(property.ofProperty.ofProperty)
|
|
704
|
+
|
|
705
|
+
ofOfSymbols.push(...symbols)
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
const atomicDefinedSymbol = atomicDefinedPropertySymbol(property.ofProperty)
|
|
709
|
+
const ofPrefix = [
|
|
710
|
+
atomicDefinedSymbol,
|
|
711
|
+
"of"
|
|
712
|
+
]
|
|
713
|
+
|
|
714
|
+
return [
|
|
715
|
+
...ofPrefix,
|
|
716
|
+
...ofOfSymbols
|
|
717
|
+
]
|
|
718
|
+
}
|
|
719
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.UNION:
|
|
720
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.ENUM:
|
|
721
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.XOR: {
|
|
722
|
+
if (property.ofProperty.properties?.length) {
|
|
723
|
+
const atomicDefinedSymbol = atomicDefinedPropertySymbol(property)
|
|
724
|
+
|
|
725
|
+
if (atomicDefinedSymbol) {
|
|
726
|
+
const unionSymbol = groupSymbol({
|
|
727
|
+
name: "",
|
|
728
|
+
description: "",
|
|
729
|
+
type: DEFINED_DEFINITION_PROPERTY_TYPE.UNION,
|
|
730
|
+
properties: property.ofProperty.properties || [],
|
|
731
|
+
})
|
|
732
|
+
|
|
733
|
+
return [
|
|
734
|
+
atomicDefinedSymbol,
|
|
735
|
+
"of",
|
|
736
|
+
...unionSymbol
|
|
737
|
+
]
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
return [
|
|
741
|
+
property.type,
|
|
742
|
+
...groupSymbol(property.ofProperty)
|
|
743
|
+
]
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
if (property.ofProperty?.ofProperty) {
|
|
747
|
+
return [property.ofProperty?.ofProperty?.type]
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
return []
|
|
751
|
+
}
|
|
752
|
+
default: {
|
|
753
|
+
if (!property.ofProperty.name) {
|
|
754
|
+
const defined = atomicDefinedPropertySymbol(property)
|
|
755
|
+
const symbol = atomicPropertySymbol(property)
|
|
756
|
+
|
|
757
|
+
if (symbol.startsWith("$$")) {
|
|
758
|
+
return [property.ofProperty.type]
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
const chains = [
|
|
762
|
+
symbol
|
|
763
|
+
]
|
|
764
|
+
|
|
765
|
+
if (defined) {
|
|
766
|
+
chains.push("of")
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
chains.push(
|
|
770
|
+
...groupSymbol(property.ofProperty)
|
|
771
|
+
)
|
|
772
|
+
|
|
773
|
+
return chains
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
return [
|
|
777
|
+
property.ofProperty.type
|
|
778
|
+
]
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
switch (property.type) {
|
|
784
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.UNION: {
|
|
785
|
+
if (property.properties?.length) {
|
|
786
|
+
const resp: string[] = []
|
|
787
|
+
for (const prop of property.properties) {
|
|
788
|
+
let symbols = resolvePropertySymbol(prop)
|
|
789
|
+
|
|
790
|
+
if (prop.ofProperty && symbols.length > 1) {
|
|
791
|
+
symbols = [[
|
|
792
|
+
symbols[0],
|
|
793
|
+
...symbols.slice(1, symbols.length),
|
|
794
|
+
].join("")]
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
resp.push(...symbols)
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
return [resp.join(" or ")]
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
return [property.type]
|
|
806
|
+
}
|
|
807
|
+
function atomicDefinedPropertySymbol(property: DefinitionProperty): string {
|
|
808
|
+
switch (property.type) {
|
|
809
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.ARRAY: {
|
|
810
|
+
return "array"
|
|
811
|
+
}
|
|
812
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.UNION:
|
|
813
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.ENUM:
|
|
814
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.XOR: {
|
|
815
|
+
return ""
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
default: {
|
|
819
|
+
return ""
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
function groupSymbol(property: DefinitionProperty) {
|
|
824
|
+
const symbols = resolvePropertySymbol(property)
|
|
825
|
+
symbols[0] = "(" + symbols[0]
|
|
826
|
+
symbols[symbols.length - 1] = symbols[symbols.length - 1] + ")"
|
|
827
|
+
|
|
828
|
+
return symbols
|
|
829
|
+
}
|
|
830
|
+
function atomicPropertySymbol(property: DefinitionProperty): string {
|
|
831
|
+
const defined = atomicDefinedPropertySymbol(property)
|
|
832
|
+
|
|
833
|
+
if (!defined) {
|
|
834
|
+
return property.type
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
return defined
|
|
838
|
+
}
|