@next-core/build-config-factory 2.23.0 → 2.23.2
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 +19 -0
- package/package.json +3 -3
- package/src/generateBrickDocs.js +25 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.23.2](https://github.com/easyops-cn/next-core/compare/@next-core/build-config-factory@2.23.1...@next-core/build-config-factory@2.23.2) (2022-07-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **generateBrickDocs:** support wrapping intersection types ([9dca68d](https://github.com/easyops-cn/next-core/commit/9dca68d14396fec7f250c2ad41ba95464dcc3577))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [2.23.1](https://github.com/easyops-cn/next-core/compare/@next-core/build-config-factory@2.23.0...@next-core/build-config-factory@2.23.1) (2022-07-12)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @next-core/build-config-factory
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [2.23.0](https://github.com/easyops-cn/next-core/compare/@next-core/build-config-factory@2.22.0...@next-core/build-config-factory@2.23.0) (2022-07-12)
|
|
7
26
|
|
|
8
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/build-config-factory",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.2",
|
|
4
4
|
"description": "build config factory",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-core/tree/master/packages/build-config-factory",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@next-core/brick-utils": "^2.37.
|
|
21
|
+
"@next-core/brick-utils": "^2.37.22",
|
|
22
22
|
"@next-core/repo-config": "^0.2.1",
|
|
23
23
|
"@next-core/typedoc-plugin-filter-inherit": "^1.2.2",
|
|
24
24
|
"@next-core/webpack-config-factory": "^2.16.6",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"typedoc": "^0.19.2",
|
|
38
38
|
"typedoc-plugin-no-inherit": "^1.2.2"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "9bbe86c9ce96b4bf283c7ec3cddafaa6617e2601"
|
|
41
41
|
}
|
package/src/generateBrickDocs.js
CHANGED
|
@@ -314,6 +314,14 @@ function existBrickDocId(element) {
|
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
function wrapBracketByParentType(typeStr, parentType) {
|
|
318
|
+
return parentType === "array" ||
|
|
319
|
+
parentType === "union" ||
|
|
320
|
+
parentType === "intersection"
|
|
321
|
+
? `(${typeStr})`
|
|
322
|
+
: typeStr;
|
|
323
|
+
}
|
|
324
|
+
|
|
317
325
|
function extractRealInterfaceType(typeData, parentType) {
|
|
318
326
|
switch (typeData?.type) {
|
|
319
327
|
case "reference":
|
|
@@ -335,15 +343,13 @@ function extractRealInterfaceType(typeData, parentType) {
|
|
|
335
343
|
typeData.elementType,
|
|
336
344
|
typeData.type
|
|
337
345
|
)}[]`;
|
|
338
|
-
case "union":
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
: typeStr;
|
|
346
|
-
}
|
|
346
|
+
case "union":
|
|
347
|
+
return wrapBracketByParentType(
|
|
348
|
+
typeData.types
|
|
349
|
+
.map((type) => extractRealInterfaceType(type, typeData.type))
|
|
350
|
+
.join(" | "),
|
|
351
|
+
parentType
|
|
352
|
+
);
|
|
347
353
|
case "stringLiteral":
|
|
348
354
|
return `"${typeData.value}"`;
|
|
349
355
|
case "intrinsic":
|
|
@@ -351,9 +357,12 @@ function extractRealInterfaceType(typeData, parentType) {
|
|
|
351
357
|
case "unknown": // unknown 暂定是`type`中的数字类型,e.g: type t = 0 | 1 | 'string'
|
|
352
358
|
return typeData.name;
|
|
353
359
|
case "intersection":
|
|
354
|
-
return
|
|
355
|
-
.
|
|
356
|
-
|
|
360
|
+
return wrapBracketByParentType(
|
|
361
|
+
typeData.types
|
|
362
|
+
.map((type) => extractRealInterfaceType(type, typeData.type))
|
|
363
|
+
.join(" & "),
|
|
364
|
+
parentType
|
|
365
|
+
);
|
|
357
366
|
case "reflection": {
|
|
358
367
|
if (typeData.declaration) {
|
|
359
368
|
const {
|
|
@@ -373,25 +382,23 @@ function extractRealInterfaceType(typeData, parentType) {
|
|
|
373
382
|
)
|
|
374
383
|
.join(", ")}) => ${extractRealInterfaceType(type)}`;
|
|
375
384
|
|
|
376
|
-
return
|
|
377
|
-
? `(${typeStr})`
|
|
378
|
-
: typeStr;
|
|
385
|
+
return wrapBracketByParentType(typeStr, parentType);
|
|
379
386
|
} else {
|
|
380
387
|
return `{ ${[
|
|
381
388
|
...children.map(
|
|
382
389
|
(child) =>
|
|
383
390
|
`${child.name}${
|
|
384
391
|
child.flags?.isOptional ? "?" : ""
|
|
385
|
-
}: ${extractRealInterfaceType(child.type)}
|
|
392
|
+
}: ${extractRealInterfaceType(child.type)}`
|
|
386
393
|
),
|
|
387
394
|
...indexSignature.map((item) => {
|
|
388
395
|
const parameter = item.parameters[0];
|
|
389
396
|
return `[${parameter.name}: ${extractRealInterfaceType(
|
|
390
397
|
parameter.type.type,
|
|
391
398
|
parameter.type
|
|
392
|
-
)}]: ${extractRealInterfaceType(item.type)}
|
|
399
|
+
)}]: ${extractRealInterfaceType(item.type)}`;
|
|
393
400
|
}),
|
|
394
|
-
].join(" ")} }`;
|
|
401
|
+
].join("; ")} }`;
|
|
395
402
|
}
|
|
396
403
|
} else {
|
|
397
404
|
return "object";
|