@ng-doc/builder 19.1.0 → 19.2.0
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/engine/nunjucks/filters.d.ts +1 -1
- package/engine/nunjucks/filters.js +5 -1
- package/engine/nunjucks/filters.js.map +1 -1
- package/helpers/get-js-doc.d.ts +7 -6
- package/helpers/get-js-doc.js +34 -4
- package/helpers/get-js-doc.js.map +1 -1
- package/helpers/typescript/first-node-with-comment.d.ts +2 -2
- package/helpers/typescript/first-node-with-comment.js +2 -1
- package/helpers/typescript/first-node-with-comment.js.map +1 -1
- package/helpers/typescript/index.d.ts +1 -0
- package/helpers/typescript/index.js +1 -0
- package/helpers/typescript/index.js.map +1 -1
- package/helpers/typescript/is-named.d.ts +7 -0
- package/helpers/typescript/is-named.js +13 -0
- package/helpers/typescript/is-named.js.map +1 -0
- package/helpers/typescript/property/get-defined-in-parent.d.ts +24 -0
- package/helpers/typescript/property/get-defined-in-parent.js +38 -0
- package/helpers/typescript/property/get-defined-in-parent.js.map +1 -0
- package/helpers/typescript/property/get-property-chain.js +5 -1
- package/helpers/typescript/property/get-property-chain.js.map +1 -1
- package/helpers/typescript/property/get-type-alias-properties.d.ts +12 -0
- package/helpers/typescript/property/get-type-alias-properties.js +63 -0
- package/helpers/typescript/property/get-type-alias-properties.js.map +1 -0
- package/helpers/typescript/property/index.d.ts +2 -0
- package/helpers/typescript/property/index.js +2 -0
- package/helpers/typescript/property/index.js.map +1 -1
- package/package.json +3 -3
- package/templates/api/type-alias-declaration.html.nunj +8 -0
- package/templates/helpers/properties.html.nunj +8 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { accessorPresentation, callSignaturePresentation, constructorPresentation, declarationImport, displayReturnType, displayType, excludeByJsDocTags, extractSelectors, filterByScope, filterByStatic, filterUselessMembers, firstNodeWithComment, functionPresentation, getAccessorChain, getCallSignatureChain, getClassAccessors, getClassMethods, getClassProperties, getDeclarationType, getImplementedMember, getInheritedParent, getInterfaceAccessors, getInterfaceCallSignatures, getInterfaceMethods, getInterfaceProperties, getJsDocDescription, getJsDocParam, getJsDocTag, getJsDocTags, getMemberParent, getMethodChain, getOverriddenMember, getPropertyChain, groupAccessors, hasJsDocTag, markdownToHtml, methodPresentation, noEmpty, noLineBreaks, notEmptyAssets, sortByNodesName, sortNavigationEntries, toTemplateString, typeAliasPresentation, variablePresentation, } from '../../helpers';
|
|
1
|
+
export { accessorPresentation, callSignaturePresentation, constructorPresentation, declarationImport, displayReturnType, displayType, excludeByJsDocTags, extractSelectors, filterByScope, filterByStatic, filterUselessMembers, firstNodeWithComment, functionPresentation, getAccessorChain, getCallSignatureChain, getClassAccessors, getClassMethods, getClassProperties, getDeclarationType, getDefinedInParent, getImplementedMember, getInheritedParent, getInterfaceAccessors, getInterfaceCallSignatures, getInterfaceMethods, getInterfaceProperties, getJsDocDescription, getJsDocParam, getJsDocTag, getJsDocTags, getMemberParent, getMethodChain, getOverriddenMember, getPropertyChain, getTypeAliasProperties, groupAccessors, hasJsDocTag, isNamed, markdownToHtml, methodPresentation, noEmpty, noLineBreaks, notEmptyAssets, sortByNodesName, sortNavigationEntries, toTemplateString, typeAliasPresentation, variablePresentation, } from '../../helpers';
|
|
2
2
|
export { createImportPath } from '../builders/helpers';
|
|
3
3
|
export { isRoute, kebabCase, objectKeys, unique } from '@ng-doc/core';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Just re-export filters from this file, they will be included to the template renderer automatically */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.isRoute = exports.createImportPath = exports.variablePresentation = exports.typeAliasPresentation = exports.toTemplateString = exports.sortNavigationEntries = exports.sortByNodesName = exports.notEmptyAssets = exports.noLineBreaks = exports.noEmpty = exports.methodPresentation = exports.markdownToHtml = exports.isNamed = exports.hasJsDocTag = exports.groupAccessors = exports.getTypeAliasProperties = exports.getPropertyChain = exports.getOverriddenMember = exports.getMethodChain = exports.getMemberParent = exports.getJsDocTags = exports.getJsDocTag = exports.getJsDocParam = exports.getJsDocDescription = exports.getInterfaceProperties = exports.getInterfaceMethods = exports.getInterfaceCallSignatures = exports.getInterfaceAccessors = exports.getInheritedParent = exports.getImplementedMember = exports.getDefinedInParent = exports.getDeclarationType = exports.getClassProperties = exports.getClassMethods = exports.getClassAccessors = exports.getCallSignatureChain = exports.getAccessorChain = exports.functionPresentation = exports.firstNodeWithComment = exports.filterUselessMembers = exports.filterByStatic = exports.filterByScope = exports.extractSelectors = exports.excludeByJsDocTags = exports.displayType = exports.displayReturnType = exports.declarationImport = exports.constructorPresentation = exports.callSignaturePresentation = exports.accessorPresentation = void 0;
|
|
5
|
+
exports.unique = exports.objectKeys = exports.kebabCase = void 0;
|
|
5
6
|
var helpers_1 = require("../../helpers");
|
|
6
7
|
Object.defineProperty(exports, "accessorPresentation", { enumerable: true, get: function () { return helpers_1.accessorPresentation; } });
|
|
7
8
|
Object.defineProperty(exports, "callSignaturePresentation", { enumerable: true, get: function () { return helpers_1.callSignaturePresentation; } });
|
|
@@ -22,6 +23,7 @@ Object.defineProperty(exports, "getClassAccessors", { enumerable: true, get: fun
|
|
|
22
23
|
Object.defineProperty(exports, "getClassMethods", { enumerable: true, get: function () { return helpers_1.getClassMethods; } });
|
|
23
24
|
Object.defineProperty(exports, "getClassProperties", { enumerable: true, get: function () { return helpers_1.getClassProperties; } });
|
|
24
25
|
Object.defineProperty(exports, "getDeclarationType", { enumerable: true, get: function () { return helpers_1.getDeclarationType; } });
|
|
26
|
+
Object.defineProperty(exports, "getDefinedInParent", { enumerable: true, get: function () { return helpers_1.getDefinedInParent; } });
|
|
25
27
|
Object.defineProperty(exports, "getImplementedMember", { enumerable: true, get: function () { return helpers_1.getImplementedMember; } });
|
|
26
28
|
Object.defineProperty(exports, "getInheritedParent", { enumerable: true, get: function () { return helpers_1.getInheritedParent; } });
|
|
27
29
|
Object.defineProperty(exports, "getInterfaceAccessors", { enumerable: true, get: function () { return helpers_1.getInterfaceAccessors; } });
|
|
@@ -36,8 +38,10 @@ Object.defineProperty(exports, "getMemberParent", { enumerable: true, get: funct
|
|
|
36
38
|
Object.defineProperty(exports, "getMethodChain", { enumerable: true, get: function () { return helpers_1.getMethodChain; } });
|
|
37
39
|
Object.defineProperty(exports, "getOverriddenMember", { enumerable: true, get: function () { return helpers_1.getOverriddenMember; } });
|
|
38
40
|
Object.defineProperty(exports, "getPropertyChain", { enumerable: true, get: function () { return helpers_1.getPropertyChain; } });
|
|
41
|
+
Object.defineProperty(exports, "getTypeAliasProperties", { enumerable: true, get: function () { return helpers_1.getTypeAliasProperties; } });
|
|
39
42
|
Object.defineProperty(exports, "groupAccessors", { enumerable: true, get: function () { return helpers_1.groupAccessors; } });
|
|
40
43
|
Object.defineProperty(exports, "hasJsDocTag", { enumerable: true, get: function () { return helpers_1.hasJsDocTag; } });
|
|
44
|
+
Object.defineProperty(exports, "isNamed", { enumerable: true, get: function () { return helpers_1.isNamed; } });
|
|
41
45
|
Object.defineProperty(exports, "markdownToHtml", { enumerable: true, get: function () { return helpers_1.markdownToHtml; } });
|
|
42
46
|
Object.defineProperty(exports, "methodPresentation", { enumerable: true, get: function () { return helpers_1.methodPresentation; } });
|
|
43
47
|
Object.defineProperty(exports, "noEmpty", { enumerable: true, get: function () { return helpers_1.noEmpty; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../libs/builder/engine/nunjucks/filters.ts"],"names":[],"mappings":";AAAA,yGAAyG
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../libs/builder/engine/nunjucks/filters.ts"],"names":[],"mappings":";AAAA,yGAAyG;;;;AAEzG,yCAiDuB;AAhDrB,+GAAA,oBAAoB,OAAA;AACpB,oHAAA,yBAAyB,OAAA;AACzB,kHAAA,uBAAuB,OAAA;AACvB,4GAAA,iBAAiB,OAAA;AACjB,4GA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AA;AAAE,iGAAA,SAAS,OAAA;AAAE,kGAAA,UAAU,OAAA;AAAE,8FAAA,MAAM,OAAA"}
|
package/helpers/get-js-doc.d.ts
CHANGED
|
@@ -3,38 +3,39 @@ import { JSDocableNode } from 'ts-morph';
|
|
|
3
3
|
export declare class Formatter {
|
|
4
4
|
static renderDocNode(docNode: DocNode): string;
|
|
5
5
|
static renderDocNodes(docNodes: readonly DocNode[]): string;
|
|
6
|
+
private static filterOutStatusTag;
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
9
10
|
* @param node
|
|
10
11
|
*/
|
|
11
|
-
export declare function getJsDocDescription(node: JSDocableNode): string;
|
|
12
|
+
export declare function getJsDocDescription(node: JSDocableNode | undefined): string;
|
|
12
13
|
/**
|
|
13
14
|
*
|
|
14
15
|
* @param node
|
|
15
16
|
* @param tagName
|
|
16
17
|
*/
|
|
17
|
-
export declare function getJsDocTag(node: JSDocableNode, tagName: string): string;
|
|
18
|
+
export declare function getJsDocTag(node: JSDocableNode | undefined, tagName: string): string;
|
|
18
19
|
/**
|
|
19
20
|
*
|
|
20
21
|
* @param node
|
|
21
22
|
* @param tagName
|
|
22
23
|
*/
|
|
23
|
-
export declare function getJsDocTags(node: JSDocableNode, tagName: string): string[];
|
|
24
|
+
export declare function getJsDocTags(node: JSDocableNode | undefined, tagName: string): string[];
|
|
24
25
|
/**
|
|
25
26
|
*
|
|
26
27
|
* @param node
|
|
27
28
|
*/
|
|
28
|
-
export declare function getAllJsDocTags(node: JSDocableNode): Record<string, string[]>;
|
|
29
|
+
export declare function getAllJsDocTags(node: JSDocableNode | undefined): Record<string, string[]>;
|
|
29
30
|
/**
|
|
30
31
|
*
|
|
31
32
|
* @param node
|
|
32
33
|
* @param tagName
|
|
33
34
|
*/
|
|
34
|
-
export declare function hasJsDocTag(node: JSDocableNode, tagName: string): boolean;
|
|
35
|
+
export declare function hasJsDocTag(node: JSDocableNode | undefined, tagName: string): boolean;
|
|
35
36
|
/**
|
|
36
37
|
*
|
|
37
38
|
* @param node
|
|
38
39
|
* @param paramName
|
|
39
40
|
*/
|
|
40
|
-
export declare function getJsDocParam(node: JSDocableNode, paramName: string): string;
|
|
41
|
+
export declare function getJsDocParam(node: JSDocableNode | undefined, paramName: string): string;
|
package/helpers/get-js-doc.js
CHANGED
|
@@ -8,17 +8,16 @@ exports.getAllJsDocTags = getAllJsDocTags;
|
|
|
8
8
|
exports.hasJsDocTag = hasJsDocTag;
|
|
9
9
|
exports.getJsDocParam = getJsDocParam;
|
|
10
10
|
const tsdoc_1 = require("@microsoft/tsdoc");
|
|
11
|
-
const tsdoc_2 = require("@microsoft/tsdoc");
|
|
12
11
|
const core_1 = require("@ng-doc/core");
|
|
13
12
|
const markdown_to_html_1 = require("./markdown-to-html");
|
|
14
13
|
class Formatter {
|
|
15
14
|
static renderDocNode(docNode) {
|
|
16
15
|
let result = '';
|
|
17
16
|
if (docNode) {
|
|
18
|
-
if (docNode instanceof
|
|
17
|
+
if (docNode instanceof tsdoc_1.DocExcerpt) {
|
|
19
18
|
result += docNode.content.toString();
|
|
20
19
|
}
|
|
21
|
-
for (const childNode of docNode.getChildNodes()) {
|
|
20
|
+
for (const childNode of Formatter.filterOutStatusTag(docNode.getChildNodes())) {
|
|
22
21
|
result += Formatter.renderDocNode(childNode);
|
|
23
22
|
}
|
|
24
23
|
}
|
|
@@ -31,6 +30,25 @@ class Formatter {
|
|
|
31
30
|
}
|
|
32
31
|
return result;
|
|
33
32
|
}
|
|
33
|
+
static filterOutStatusTag(docNodes) {
|
|
34
|
+
if (docNodes.length < 2)
|
|
35
|
+
return docNodes;
|
|
36
|
+
const result = [];
|
|
37
|
+
for (let i = 0; i < docNodes.length; i += 2) {
|
|
38
|
+
const node1 = docNodes.at(i), node2 = docNodes.at(i + 1);
|
|
39
|
+
if (node1 instanceof tsdoc_1.DocErrorText &&
|
|
40
|
+
node1.text === '@' &&
|
|
41
|
+
node2 instanceof tsdoc_1.DocPlainText &&
|
|
42
|
+
node2.text.startsWith('status:')) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (node1)
|
|
46
|
+
result.push(node1);
|
|
47
|
+
if (node2)
|
|
48
|
+
result.push(node2);
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
34
52
|
}
|
|
35
53
|
exports.Formatter = Formatter;
|
|
36
54
|
/**
|
|
@@ -38,6 +56,8 @@ exports.Formatter = Formatter;
|
|
|
38
56
|
* @param node
|
|
39
57
|
*/
|
|
40
58
|
function getJsDocDescription(node) {
|
|
59
|
+
if (!node)
|
|
60
|
+
return '';
|
|
41
61
|
const jsDocs = (0, core_1.asArray)(node.getJsDocs()[0]);
|
|
42
62
|
const tsdocParser = new tsdoc_1.TSDocParser();
|
|
43
63
|
const parserContext = tsdocParser.parseString(jsDocs[0]?.getText() ?? '');
|
|
@@ -49,6 +69,8 @@ function getJsDocDescription(node) {
|
|
|
49
69
|
* @param tagName
|
|
50
70
|
*/
|
|
51
71
|
function getJsDocTag(node, tagName) {
|
|
72
|
+
if (!node)
|
|
73
|
+
return '';
|
|
52
74
|
const jsDocs = (0, core_1.asArray)(node.getJsDocs()[0]);
|
|
53
75
|
const tag = jsDocs
|
|
54
76
|
.map((doc) => doc.getStructure())
|
|
@@ -64,6 +86,8 @@ function getJsDocTag(node, tagName) {
|
|
|
64
86
|
* @param tagName
|
|
65
87
|
*/
|
|
66
88
|
function getJsDocTags(node, tagName) {
|
|
89
|
+
if (!node)
|
|
90
|
+
return [];
|
|
67
91
|
const jsDocs = (0, core_1.asArray)(node.getJsDocs()[0]);
|
|
68
92
|
const tags = jsDocs
|
|
69
93
|
.map((doc) => doc.getStructure())
|
|
@@ -78,6 +102,8 @@ function getJsDocTags(node, tagName) {
|
|
|
78
102
|
* @param node
|
|
79
103
|
*/
|
|
80
104
|
function getAllJsDocTags(node) {
|
|
105
|
+
if (!node)
|
|
106
|
+
return {};
|
|
81
107
|
const jsDocs = (0, core_1.asArray)(node.getJsDocs()[0]);
|
|
82
108
|
const tags = jsDocs
|
|
83
109
|
.map((doc) => doc.getStructure())
|
|
@@ -99,6 +125,8 @@ function getAllJsDocTags(node) {
|
|
|
99
125
|
* @param tagName
|
|
100
126
|
*/
|
|
101
127
|
function hasJsDocTag(node, tagName) {
|
|
128
|
+
if (!node)
|
|
129
|
+
return false;
|
|
102
130
|
const jsDocs = (0, core_1.asArray)(node.getJsDocs()[0]);
|
|
103
131
|
return jsDocs
|
|
104
132
|
.map((doc) => doc.getStructure())
|
|
@@ -112,10 +140,12 @@ function hasJsDocTag(node, tagName) {
|
|
|
112
140
|
* @param paramName
|
|
113
141
|
*/
|
|
114
142
|
function getJsDocParam(node, paramName) {
|
|
143
|
+
if (!node)
|
|
144
|
+
return '';
|
|
115
145
|
const jsDocs = (0, core_1.asArray)(node.getJsDocs()[0]);
|
|
116
146
|
const tsdocParser = new tsdoc_1.TSDocParser();
|
|
117
147
|
const parserContext = tsdocParser.parseString(jsDocs[0]?.getText() ?? '');
|
|
118
|
-
const param = Formatter.renderDocNodes(parserContext.docComment.params.tryGetBlockByName(paramName)?.getChildNodes() ?? []);
|
|
148
|
+
const param = Formatter.renderDocNodes(parserContext.docComment.params.tryGetBlockByName(paramName)?.content?.getChildNodes() ?? []);
|
|
119
149
|
return (0, markdown_to_html_1.markdownToHtml)(param).trim();
|
|
120
150
|
}
|
|
121
151
|
//# sourceMappingURL=get-js-doc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-js-doc.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-js-doc.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"get-js-doc.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-js-doc.ts"],"names":[],"mappings":";;;AAgEA,kDASC;AAOD,kCAWC;AAOD,oCAWC;AAMD,0CAsBC;AAOD,kCASC;AAOD,sCAWC;AA3KD,4CAM0B;AAC1B,uCAAkD;AAGlD,yDAAoD;AAEpD,M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,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,IAAI,mBAAW,EAAE,CAAC;IACtC,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAE1E,MAAM,KAAK,GAAG,SAAS,CAAC,cAAc,CACpC,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAC7F,CAAC;IAEF,OAAO,IAAA,iCAAc,EAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node } from 'ts-morph';
|
|
2
2
|
/**
|
|
3
3
|
* Returns first node that has JSDoc comment, will return first node, if there are no comment nodes
|
|
4
4
|
* @param nodes
|
|
5
5
|
*/
|
|
6
|
-
export declare function firstNodeWithComment<T extends
|
|
6
|
+
export declare function firstNodeWithComment<T extends Node>(nodes: T[]): T | undefined;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.firstNodeWithComment = firstNodeWithComment;
|
|
4
|
+
const ts_morph_1 = require("ts-morph");
|
|
4
5
|
/**
|
|
5
6
|
* Returns first node that has JSDoc comment, will return first node, if there are no comment nodes
|
|
6
7
|
* @param nodes
|
|
7
8
|
*/
|
|
8
9
|
function firstNodeWithComment(nodes) {
|
|
9
|
-
return nodes.find((n) => n.getJsDocs().length) ?? nodes[0];
|
|
10
|
+
return nodes.find((n) => ts_morph_1.Node.isJSDocable(n) && n.getJsDocs().length) ?? nodes[0];
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=first-node-with-comment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-node-with-comment.js","sourceRoot":"","sources":["../../../../../libs/builder/helpers/typescript/first-node-with-comment.ts"],"names":[],"mappings":";;AAMA,oDAEC;
|
|
1
|
+
{"version":3,"file":"first-node-with-comment.js","sourceRoot":"","sources":["../../../../../libs/builder/helpers/typescript/first-node-with-comment.ts"],"names":[],"mappings":";;AAMA,oDAEC;AARD,uCAAgC;AAEhC;;;GAGG;AACH,SAAgB,oBAAoB,CAAiB,KAAU;IAC7D,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAO,EAAE,EAAE,CAAC,eAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -11,6 +11,7 @@ export * from './find-declarations';
|
|
|
11
11
|
export * from './first-node-with-comment';
|
|
12
12
|
export * from './get-object-expression-from-default';
|
|
13
13
|
export * from './interface';
|
|
14
|
+
export * from './is-named';
|
|
14
15
|
export * from './member';
|
|
15
16
|
export * from './method';
|
|
16
17
|
export * from './node';
|
|
@@ -14,6 +14,7 @@ tslib_1.__exportStar(require("./find-declarations"), exports);
|
|
|
14
14
|
tslib_1.__exportStar(require("./first-node-with-comment"), exports);
|
|
15
15
|
tslib_1.__exportStar(require("./get-object-expression-from-default"), exports);
|
|
16
16
|
tslib_1.__exportStar(require("./interface"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./is-named"), exports);
|
|
17
18
|
tslib_1.__exportStar(require("./member"), exports);
|
|
18
19
|
tslib_1.__exportStar(require("./method"), exports);
|
|
19
20
|
tslib_1.__exportStar(require("./node"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/builder/helpers/typescript/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,2DAAiC;AACjC,kDAAwB;AACxB,2DAAiC;AACjC,+DAAqC;AACrC,yDAA+B;AAC/B,mEAAyC;AACzC,4DAAkC;AAClC,6DAAmC;AACnC,8DAAoC;AACpC,oEAA0C;AAC1C,+EAAqD;AACrD,sDAA4B;AAC5B,mDAAyB;AACzB,mDAAyB;AACzB,iDAAuB;AACvB,qDAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/builder/helpers/typescript/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,2DAAiC;AACjC,kDAAwB;AACxB,2DAAiC;AACjC,+DAAqC;AACrC,yDAA+B;AAC/B,mEAAyC;AACzC,4DAAkC;AAClC,6DAAmC;AACnC,8DAAoC;AACpC,oEAA0C;AAC1C,+EAAqD;AACrD,sDAA4B;AAC5B,qDAA2B;AAC3B,mDAAyB;AACzB,mDAAyB;AACzB,iDAAuB;AACvB,qDAA2B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNamed = isNamed;
|
|
4
|
+
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
/**
|
|
6
|
+
* Helper for use in templates to check if a node has a name.
|
|
7
|
+
* @param node
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
function isNamed(node) {
|
|
11
|
+
return ts_morph_1.Node.isNamed(node);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=is-named.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-named.js","sourceRoot":"","sources":["../../../../../libs/builder/helpers/typescript/is-named.ts"],"names":[],"mappings":";;AAOA,0BAEC;AATD,uCAAgC;AAEhC;;;;GAIG;AACH,SAAgB,OAAO,CAAC,IAAsB;IAC5C,OAAO,eAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Node } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the parent node (TypeReference or TypeAliasDeclaration name)
|
|
4
|
+
* of a property that is defined in a type alias declaration.
|
|
5
|
+
*
|
|
6
|
+
* Specifically, this resolves type alias declarations that resolve to types
|
|
7
|
+
* that are "object-like", including:
|
|
8
|
+
* - IntersectionTypes,
|
|
9
|
+
* - TypeLiterals, and
|
|
10
|
+
* - TypeReferences (which resolve to IntersectionTypes or TypeLiterals)
|
|
11
|
+
*
|
|
12
|
+
* For other types (e.g. UnionType) it just defaults back to the existing
|
|
13
|
+
* rendering.
|
|
14
|
+
*
|
|
15
|
+
* @param property
|
|
16
|
+
* @param currentNode
|
|
17
|
+
|
|
18
|
+
* @note
|
|
19
|
+
* Similar to `getMemberParent` but handling type aliases declarations
|
|
20
|
+
* rather than member inheritance.
|
|
21
|
+
*
|
|
22
|
+
* @see libs/builder/helpers/typescript/member/get-member-parent.ts
|
|
23
|
+
*/
|
|
24
|
+
export declare function getDefinedInParent(property: Node, currentNode: Node): Node | undefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefinedInParent = getDefinedInParent;
|
|
4
|
+
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
/**
|
|
6
|
+
* Resolves the parent node (TypeReference or TypeAliasDeclaration name)
|
|
7
|
+
* of a property that is defined in a type alias declaration.
|
|
8
|
+
*
|
|
9
|
+
* Specifically, this resolves type alias declarations that resolve to types
|
|
10
|
+
* that are "object-like", including:
|
|
11
|
+
* - IntersectionTypes,
|
|
12
|
+
* - TypeLiterals, and
|
|
13
|
+
* - TypeReferences (which resolve to IntersectionTypes or TypeLiterals)
|
|
14
|
+
*
|
|
15
|
+
* For other types (e.g. UnionType) it just defaults back to the existing
|
|
16
|
+
* rendering.
|
|
17
|
+
*
|
|
18
|
+
* @param property
|
|
19
|
+
* @param currentNode
|
|
20
|
+
|
|
21
|
+
* @note
|
|
22
|
+
* Similar to `getMemberParent` but handling type aliases declarations
|
|
23
|
+
* rather than member inheritance.
|
|
24
|
+
*
|
|
25
|
+
* @see libs/builder/helpers/typescript/member/get-member-parent.ts
|
|
26
|
+
*/
|
|
27
|
+
function getDefinedInParent(property, currentNode) {
|
|
28
|
+
let propertyParent = property.getParent();
|
|
29
|
+
const excludeCurrentNode = (node) => node === currentNode ? undefined : node;
|
|
30
|
+
if (propertyParent?.isKind(ts_morph_1.SyntaxKind.TypeLiteral)) {
|
|
31
|
+
return excludeCurrentNode(getDefinedInParent(propertyParent, currentNode) ?? propertyParent);
|
|
32
|
+
}
|
|
33
|
+
if (propertyParent?.isKind(ts_morph_1.SyntaxKind.IntersectionType)) {
|
|
34
|
+
return excludeCurrentNode(getDefinedInParent(propertyParent, currentNode) ?? propertyParent);
|
|
35
|
+
}
|
|
36
|
+
return excludeCurrentNode(propertyParent);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=get-defined-in-parent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-defined-in-parent.js","sourceRoot":"","sources":["../../../../../../libs/builder/helpers/typescript/property/get-defined-in-parent.ts"],"names":[],"mappings":";;AAwBA,gDAcC;AAtCD,uCAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,kBAAkB,CAAC,QAAc,EAAE,WAAiB;IAClE,IAAI,cAAc,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;IAE1C,MAAM,kBAAkB,GAAG,CAAC,IAAsB,EAAE,EAAE,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IAE/F,IAAG,cAAc,EAAE,MAAM,CAAC,qBAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAClD,OAAO,kBAAkB,CAAC,kBAAkB,CAAC,cAAc,EAAE,WAAW,CAAC,IAAI,cAAc,CAAC,CAAC;IAC/F,CAAC;IAED,IAAG,cAAc,EAAE,MAAM,CAAC,qBAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACvD,OAAO,kBAAkB,CAAC,kBAAkB,CAAC,cAAc,EAAE,WAAW,CAAC,IAAI,cAAc,CAAC,CAAC;IAC/F,CAAC;IAED,OAAO,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -21,7 +21,7 @@ function getPropertyChain(property) {
|
|
|
21
21
|
});
|
|
22
22
|
// TODO: Add interfaces
|
|
23
23
|
}
|
|
24
|
-
if (ts_morph_1.Node.isInterfaceDeclaration(parent)) {
|
|
24
|
+
else if (ts_morph_1.Node.isInterfaceDeclaration(parent)) {
|
|
25
25
|
(0, interface_1.forAllInterfaces)(parent, (int) => {
|
|
26
26
|
const prop = int.getProperty(name);
|
|
27
27
|
if (prop) {
|
|
@@ -29,6 +29,10 @@ function getPropertyChain(property) {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
else {
|
|
33
|
+
// type aliases etc don't have inheritance, so we just add the property itself
|
|
34
|
+
properties.push(property);
|
|
35
|
+
}
|
|
32
36
|
return properties;
|
|
33
37
|
}
|
|
34
38
|
//# sourceMappingURL=get-property-chain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-property-chain.js","sourceRoot":"","sources":["../../../../../../libs/builder/helpers/typescript/property/get-property-chain.ts"],"names":[],"mappings":";;AAeA,
|
|
1
|
+
{"version":3,"file":"get-property-chain.js","sourceRoot":"","sources":["../../../../../../libs/builder/helpers/typescript/property/get-property-chain.ts"],"names":[],"mappings":";;AAeA,4CAoCC;AAnDD,uCAMkB;AAElB,oCAAyC;AACzC,4CAAgD;AAEhD;;;GAGG;AACH,SAAgB,gBAAgB,CAC/B,QAAiD;IAEjD,MAAM,MAAM,GAAqB,QAAQ,CAAC,SAAS,EAAE,CAAC;IACtD,MAAM,IAAI,GAAW,QAAQ,CAAC,OAAO,EAAE,CAAC;IACxC,MAAM,UAAU,GAAmD,EAAE,CAAC;IAEtE,IAAI,eAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;QACrC,IAAA,qBAAa,EAAC,MAAM,EAAE,CAAC,GAAqB,EAAE,EAAE;YAC/C,MAAM,IAAI,GAAoC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAEpE,IAAI,IAAI,EAAE,CAAC;gBACV,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;QACF,CAAC,CAAC,CAAC;QAEH,uBAAuB;IAExB,CAAC;SAAM,IAAI,eAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;QAEhD,IAAA,4BAAgB,EAAC,MAAM,EAAE,CAAC,GAAyB,EAAE,EAAE;YACtD,MAAM,IAAI,GAAkC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAElE,IAAI,IAAI,EAAE,CAAC;gBACV,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;QACF,CAAC,CAAC,CAAC;IAEJ,CAAC;SAAM,CAAC;QAEP,8EAA8E;QAC9E,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAE3B,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TypeAliasDeclaration, PropertySignature } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Traverse all of the properties of a type alias declaration,
|
|
4
|
+
* returning an array of all of the properties.
|
|
5
|
+
*
|
|
6
|
+
* Specifically, this resolves type alias declarations that resolve to types
|
|
7
|
+
* that are "object-like", including:
|
|
8
|
+
* - IntersectionTypes,
|
|
9
|
+
* - TypeLiterals, and
|
|
10
|
+
* - TypeReferences (which resolve to IntersectionTypes or TypeLiterals)
|
|
11
|
+
*/
|
|
12
|
+
export declare function getTypeAliasProperties(ta: TypeAliasDeclaration): PropertySignature[];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTypeAliasProperties = getTypeAliasProperties;
|
|
4
|
+
const core_1 = require("@ng-doc/core");
|
|
5
|
+
const ts_morph_1 = require("ts-morph");
|
|
6
|
+
/**
|
|
7
|
+
* Traverse all of the properties of a type alias declaration,
|
|
8
|
+
* returning an array of all of the properties.
|
|
9
|
+
*
|
|
10
|
+
* Specifically, this resolves type alias declarations that resolve to types
|
|
11
|
+
* that are "object-like", including:
|
|
12
|
+
* - IntersectionTypes,
|
|
13
|
+
* - TypeLiterals, and
|
|
14
|
+
* - TypeReferences (which resolve to IntersectionTypes or TypeLiterals)
|
|
15
|
+
*/
|
|
16
|
+
function getTypeAliasProperties(ta) {
|
|
17
|
+
const properties = new Map();
|
|
18
|
+
const signatures = [];
|
|
19
|
+
const getProperties = (typeNode) => {
|
|
20
|
+
if (typeNode.isKind(ts_morph_1.SyntaxKind.TypeLiteral)) {
|
|
21
|
+
const members = typeNode.getMembers();
|
|
22
|
+
members.forEach((member) => {
|
|
23
|
+
if (member.isKind(ts_morph_1.SyntaxKind.PropertySignature)) {
|
|
24
|
+
signatures.push(member);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
else if (typeNode?.isKind(ts_morph_1.SyntaxKind.IntersectionType)) {
|
|
29
|
+
const types = typeNode.getTypeNodes();
|
|
30
|
+
types.forEach((typ) => {
|
|
31
|
+
getProperties(typ);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
else if (typeNode.isKind(ts_morph_1.SyntaxKind.TypeReference)) {
|
|
35
|
+
const symbol = typeNode.getTypeName().getSymbol();
|
|
36
|
+
if (symbol) {
|
|
37
|
+
const declarations = symbol.getDeclarations();
|
|
38
|
+
declarations.forEach((decl) => {
|
|
39
|
+
if (decl.isKind(ts_morph_1.SyntaxKind.TypeLiteral)) {
|
|
40
|
+
getProperties(decl);
|
|
41
|
+
}
|
|
42
|
+
else if (decl.isKind(ts_morph_1.SyntaxKind.TypeAliasDeclaration)) {
|
|
43
|
+
const typeNode = decl.getTypeNode();
|
|
44
|
+
if (typeNode) {
|
|
45
|
+
getProperties(typeNode);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const typeNode = ta.getTypeNode();
|
|
53
|
+
if (typeNode) {
|
|
54
|
+
getProperties(typeNode);
|
|
55
|
+
}
|
|
56
|
+
signatures.forEach((property) => {
|
|
57
|
+
const name = property.getName();
|
|
58
|
+
// this may override the previous value (and we want the last one)
|
|
59
|
+
properties.set(name, property);
|
|
60
|
+
});
|
|
61
|
+
return (0, core_1.asArray)(properties.values());
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=get-type-alias-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-type-alias-properties.js","sourceRoot":"","sources":["../../../../../../libs/builder/helpers/typescript/property/get-type-alias-properties.ts"],"names":[],"mappings":";;AAaA,wDAkDC;AA/DD,uCAAuC;AACvC,uCAAyF;AAEzF;;;;;;;;;GASG;AACH,SAAgB,sBAAsB,CAAC,EAAwB;IAE7D,MAAM,UAAU,GAAmC,IAAI,GAAG,EAA6B,CAAC;IAExF,MAAM,UAAU,GAAwB,EAAE,CAAC;IAE3C,MAAM,aAAa,GAAG,CAAC,QAAkB,EAAE,EAAE;QAC3C,IAAI,QAAQ,CAAC,MAAM,CAAC,qBAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;YACtC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACzB,IAAI,MAAM,CAAC,MAAM,CAAC,qBAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;oBAChD,UAAU,CAAC,IAAI,CAAC,MAAM,C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,GAAW,QAAQ,CAAC,OAAO,EAAE,CAAC;QAExC,kEAAkE;QAClE,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,OAAO,IAAA,cAAO,EAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./get-class-properties"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./get-defined-in-parent"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./get-interface-properties"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./get-type-alias-properties"), exports);
|
|
6
8
|
tslib_1.__exportStar(require("./get-property-assignment"), exports);
|
|
7
9
|
tslib_1.__exportStar(require("./get-property-chain"), exports);
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/builder/helpers/typescript/property/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,qEAA2C;AAC3C,oEAA0C;AAC1C,+DAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/builder/helpers/typescript/property/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,kEAAwC;AACxC,qEAA2C;AAC3C,sEAA4C;AAC5C,oEAA0C;AAC1C,+DAAqC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-doc/builder",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.2.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"builders": "./builders.json",
|
|
6
6
|
"schematics": "./schematics/collection.json",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
]
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@ng-doc/core": "19.
|
|
15
|
-
"@ng-doc/utils": "19.
|
|
14
|
+
"@ng-doc/core": "19.2.0",
|
|
15
|
+
"@ng-doc/utils": "19.2.0",
|
|
16
16
|
"@angular-devkit/architect": ">=0.1900.0 < 0.2000.0",
|
|
17
17
|
"@angular-devkit/build-angular": ">=19.0.0 < 20.0.0",
|
|
18
18
|
"minimatch": "9.0.1",
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{% extends "api/base.html.nunj" %}
|
|
2
2
|
|
|
3
|
+
{% import "helpers/properties.html.nunj" as propertiesMacro %}
|
|
3
4
|
{% import "helpers/code.html.nunj" as codeMacro %}
|
|
4
5
|
|
|
5
6
|
{% block overview %}
|
|
7
|
+
{%- set properties = declaration | getTypeAliasProperties | excludeByJsDocTags('internal') | filterUselessMembers | sortByNodesName -%}
|
|
8
|
+
|
|
9
|
+
{% if properties.length -%}
|
|
10
|
+
<h2>Properties</h2>
|
|
11
|
+
{{ propertiesMacro.render(properties, declaration, 'definedIn') }}
|
|
12
|
+
{%- endif %}
|
|
13
|
+
|
|
6
14
|
<h2>Presentation</h2>
|
|
7
15
|
{{ codeMacro.render(declaration | typeAliasPresentation, "typescript", false) }}
|
|
8
16
|
{% endblock %}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
{% import "helpers/status.html.nunj" as statusMacro %}
|
|
5
5
|
{% set examplesColSpan = 3 %}
|
|
6
6
|
|
|
7
|
-
{
|
|
7
|
+
{# mode='inheritedFrom' (classes/interfaces) or mode='definedIn' (type aliases) #}
|
|
8
|
+
{% macro render(properties, origin, mode='inheritedFrom') %}
|
|
8
9
|
<table class="ng-doc-api-table sticky first-colum-highlighted">
|
|
9
10
|
<thead>
|
|
10
11
|
<tr indexable="false">
|
|
@@ -16,6 +17,8 @@
|
|
|
16
17
|
<tbody>
|
|
17
18
|
{%- for property in properties %}
|
|
18
19
|
{% set propertyChain = property | getPropertyChain %}
|
|
20
|
+
{% set definedIn = property | getDefinedInParent(origin) %}
|
|
21
|
+
{% set definedInHasName = definedIn | isNamed %}
|
|
19
22
|
{% set inheritedFrom = property | getInheritedParent(origin) %}
|
|
20
23
|
{% set overriddenMember = property | getOverriddenMember %}
|
|
21
24
|
{% set implementedMember = property | getImplementedMember %}
|
|
@@ -26,7 +29,9 @@
|
|
|
26
29
|
{{ decoratorsMacro.render(property.getDecorators(), true) if property.getDecorators }}
|
|
27
30
|
<span>{{ property.getName() }}{{ tagsMacro.render(property, "badge") }}</span>
|
|
28
31
|
<div class="ng-doc-node-details">
|
|
29
|
-
{%- if
|
|
32
|
+
{%- if mode == 'definedIn' and definedIn and definedInHasName %}
|
|
33
|
+
defined in <code>{{ definedIn.getName() }}</code>
|
|
34
|
+
{%- elseif mode == 'inheritedFrom' and inheritedFrom %}
|
|
30
35
|
inherited from <code>{{ inheritedFrom.getName() }}</code>
|
|
31
36
|
{%- elseif overriddenMember %}
|
|
32
37
|
overrides
|
|
@@ -37,7 +42,7 @@
|
|
|
37
42
|
{%- endif %}
|
|
38
43
|
</div>
|
|
39
44
|
</td>
|
|
40
|
-
<td>{{ typeMacro.type(property) }}</td>
|
|
45
|
+
<td class="ng-doc-api-table-type">{{ typeMacro.type(property) }}</td>
|
|
41
46
|
<td>
|
|
42
47
|
<div class="ng-doc-api-status">
|
|
43
48
|
{{ statusMacro.render(property) }}
|