@progress/kendo-typescript-api-tasks 1.1.2-dev.22 → 1.1.2-dev.27
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/index.js +14 -5
- package/lib/comment.js +14 -9
- package/lib/component-page.js +1 -1
- package/lib/generator.js +13 -10
- package/lib/is-constructor.js +2 -1
- package/lib/is-method.js +2 -1
- package/lib/map-constructors.js +3 -2
- package/lib/map-props.js +8 -7
- package/lib/plugins/decorators.js +43 -0
- package/lib/return-type.js +8 -5
- package/lib/type-utils.js +5 -4
- package/package.json +6 -5
- package/test/api.js +22 -15
- package/test/class.json +29 -9
- package/test/components-def.json +56 -16
- package/test/events-def.json +39 -8
- package/test/fields-def.json +62 -12
- package/test/fn-def.json +41 -10
- package/test/fn.json +62 -13
- package/test/inputs-def.json +27 -3
- package/test/interface-comments.json +84 -23
- package/test/intersection.json +1 -1
- package/test/package.json +7 -6
package/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
const execSync = require('child_process').execSync;
|
|
2
4
|
const fs = require('fs');
|
|
3
5
|
const path = require('path');
|
|
@@ -18,7 +20,8 @@ const defaultConfig = {
|
|
|
18
20
|
}
|
|
19
21
|
};
|
|
20
22
|
|
|
21
|
-
module.exports =
|
|
23
|
+
module.exports.ReflectionKind = typedoc.ReflectionKind;
|
|
24
|
+
module.exports.addAPITasks = (gulp, userConfig) => {
|
|
22
25
|
const series = gulp.series;
|
|
23
26
|
|
|
24
27
|
const config = merge({}, defaultConfig, userConfig);
|
|
@@ -33,11 +36,17 @@ module.exports = (gulp, userConfig) => {
|
|
|
33
36
|
...(config.externalApi || [])
|
|
34
37
|
];
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
let app = await typedoc.Application.bootstrapWithPlugins(
|
|
40
|
+
{
|
|
41
|
+
...config.typedoc,
|
|
42
|
+
entryPoints,
|
|
43
|
+
plugin: [ path.join(__dirname, './lib/plugins/decorators.js') ]
|
|
44
|
+
}, [
|
|
45
|
+
new typedoc.TSConfigReader()
|
|
46
|
+
]
|
|
47
|
+
);
|
|
39
48
|
|
|
40
|
-
const project = app.convert();
|
|
49
|
+
const project = await app.convert();
|
|
41
50
|
if (!project) {
|
|
42
51
|
done(new Error('Unable to initialize TypeDoc.'));
|
|
43
52
|
return;
|
package/lib/comment.js
CHANGED
|
@@ -8,12 +8,12 @@ const commentTemplate = template.compileFrom('comment-tags.hbs');
|
|
|
8
8
|
|
|
9
9
|
const commentTags = (comment, member) =>
|
|
10
10
|
commentTemplate({
|
|
11
|
-
tags: comment.
|
|
12
|
-
let text = tag.text.trim();
|
|
11
|
+
tags: comment.blockTags.map(tag => {
|
|
12
|
+
let text = tag.content.map(c => c.text).join('').trim();
|
|
13
13
|
|
|
14
|
-
if (tag.tag === 'example') {
|
|
14
|
+
if (tag.tag === '@example') {
|
|
15
15
|
text = text.replace(/_@/g, '@');
|
|
16
|
-
} else if (tag.tag === 'see') {
|
|
16
|
+
} else if (tag.tag === '@see') {
|
|
17
17
|
const linkSlug = slug(member.packageName, text);
|
|
18
18
|
text = `\n\nSee [${text}]({% slug ${linkSlug} %})`;
|
|
19
19
|
} else {
|
|
@@ -26,6 +26,14 @@ const commentTags = (comment, member) =>
|
|
|
26
26
|
})
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
+
const commentSummary = (comment) => {
|
|
30
|
+
if (!comment.summary) {
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return comment.summary.map(c => c.text).join('').trim();
|
|
35
|
+
};
|
|
36
|
+
|
|
29
37
|
const formatComment = (member, parentName, memberKind) => {
|
|
30
38
|
let signatures;
|
|
31
39
|
if (member.type && member.type.declaration) {
|
|
@@ -40,12 +48,9 @@ const formatComment = (member, parentName, memberKind) => {
|
|
|
40
48
|
return '';
|
|
41
49
|
}
|
|
42
50
|
|
|
43
|
-
let output = comment
|
|
44
|
-
if (comment.text) {
|
|
45
|
-
output += '\n\n' + comment.text;
|
|
46
|
-
}
|
|
51
|
+
let output = commentSummary(comment);
|
|
47
52
|
|
|
48
|
-
if (comment.
|
|
53
|
+
if (comment.blockTags) {
|
|
49
54
|
output += commentTags(comment, member);
|
|
50
55
|
}
|
|
51
56
|
|
package/lib/component-page.js
CHANGED
|
@@ -45,7 +45,7 @@ const componentPage = (component, meta) => {
|
|
|
45
45
|
let methods;
|
|
46
46
|
if (component.children) {
|
|
47
47
|
fields = ignoreWithoutComment(mapProps(component.children.filter(isField), component.name));
|
|
48
|
-
inputs = mapProps(component.children.filter(isInput), component.name);
|
|
48
|
+
inputs = ignoreWithoutComment(mapProps(component.children.filter(isInput), component.name));
|
|
49
49
|
events = mapProps(component.children.filter(isEvent), component.name);
|
|
50
50
|
methods = mapMethods(component.children, component.name);
|
|
51
51
|
}
|
package/lib/generator.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
const fs = require('fs');
|
|
2
4
|
const mkdirp = require('mkdirp');
|
|
3
5
|
const path = require('path');
|
|
@@ -5,11 +7,12 @@ const indexPage = require('./index-page.js');
|
|
|
5
7
|
const memberPage = require('./member-page.js');
|
|
6
8
|
const slug = require('./slug.js');
|
|
7
9
|
const utils = require('./utils.js');
|
|
10
|
+
const { ReflectionKind } = require('typedoc');
|
|
8
11
|
|
|
9
|
-
const moduleFilter = (module) => module.children;
|
|
12
|
+
const moduleFilter = (module) => module.kind === ReflectionKind.Module && module.children;
|
|
10
13
|
|
|
11
14
|
const kind = (member, module) => {
|
|
12
|
-
let kind = member.
|
|
15
|
+
let kind = ReflectionKind.singularString(member.kind).toLowerCase();
|
|
13
16
|
const notBaseType = kind !== 'function' && kind !== 'enumeration' && kind !== 'interface' &&
|
|
14
17
|
kind !== 'object literal' && kind !== 'module';
|
|
15
18
|
|
|
@@ -30,10 +33,10 @@ const kind = (member, module) => {
|
|
|
30
33
|
|
|
31
34
|
const addTypeSlug = (element, knownTypes, typeLinks) => {
|
|
32
35
|
if (element.type === 'reference' ||
|
|
33
|
-
(typeof element.type !== 'string' && knownTypes[element.
|
|
34
|
-
const type = knownTypes[element.
|
|
36
|
+
(typeof element.type !== 'string' && knownTypes[element.target])) {
|
|
37
|
+
const type = knownTypes[element.target];
|
|
35
38
|
if (type) {
|
|
36
|
-
element.
|
|
39
|
+
element.slug = type.slug;
|
|
37
40
|
} else if (typeLinks[element.name]) {
|
|
38
41
|
element.typeLink = typeLinks[element.name];
|
|
39
42
|
}
|
|
@@ -101,9 +104,8 @@ const normalizeMembers = (members) => {
|
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
|
|
104
|
-
if (!element.comment && element.
|
|
105
|
-
|
|
106
|
-
element.comment = accessor[0].comment;
|
|
107
|
+
if (!element.comment && element.kind === ReflectionKind.Accessor) {
|
|
108
|
+
element.comment = (element.setSignature || {}).comment || (element.getSignature || {}).comment || [];
|
|
107
109
|
}
|
|
108
110
|
});
|
|
109
111
|
};
|
|
@@ -140,9 +142,10 @@ const extractMembers = (packageName, modules, config) => {
|
|
|
140
142
|
|
|
141
143
|
const models = nonEmptyModules.map(module => module
|
|
142
144
|
.children
|
|
143
|
-
.filter(child => child.
|
|
145
|
+
.filter(child => child.kind !== ReflectionKind.Reference)
|
|
144
146
|
.filter(child => child.name !== 'core')
|
|
145
147
|
.filter(child => child.sources && !child.sources[0].fileName.includes('prosemirror'))
|
|
148
|
+
.filter(child => child.sources && !child.sources[0].fileName.includes('@types'))
|
|
146
149
|
.map(child => {
|
|
147
150
|
const fullName = moduleFullName(module.name, packageName, rootModules);
|
|
148
151
|
|
|
@@ -190,7 +193,7 @@ const namespacesAsModules = data => {
|
|
|
190
193
|
.children
|
|
191
194
|
.filter(child => child.name !== 'core')
|
|
192
195
|
.forEach(child => {
|
|
193
|
-
if (child.
|
|
196
|
+
if (child.kind === ReflectionKind.Module && child.children) {
|
|
194
197
|
modules.push(child);
|
|
195
198
|
}
|
|
196
199
|
})
|
package/lib/is-constructor.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
const { ReflectionKind } = require('typedoc');
|
|
3
4
|
const isPublic = require('./is-public');
|
|
4
5
|
|
|
5
6
|
const isConstructor = (prop) =>
|
|
6
|
-
prop.
|
|
7
|
+
prop.kind && prop.kind === ReflectionKind.Constructor && isPublic(prop);
|
|
7
8
|
|
|
8
9
|
module.exports = isConstructor;
|
|
9
10
|
|
package/lib/is-method.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
const { ReflectionKind } = require('typedoc');
|
|
3
4
|
const isPublic = require('./is-public');
|
|
4
5
|
const isInput = require('./is-input');
|
|
5
6
|
|
|
6
7
|
const isMethod = (prop) =>
|
|
7
|
-
prop.
|
|
8
|
+
prop.kind && prop.kind === ReflectionKind.Method && isPublic(prop) && !isInput(prop);
|
|
8
9
|
|
|
9
10
|
module.exports = isMethod;
|
|
10
11
|
|
package/lib/map-constructors.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
const { ReflectionKind } = require('typedoc');
|
|
3
4
|
const comment = require('./comment');
|
|
4
5
|
const isPublic = require('./is-public');
|
|
5
6
|
const types = require('./type-utils');
|
|
6
7
|
const utils = require('./utils');
|
|
7
8
|
|
|
8
9
|
const isConstructor = (prop) =>
|
|
9
|
-
prop.
|
|
10
|
+
prop.kind && prop.kind === ReflectionKind.Constructor && isPublic(prop);
|
|
10
11
|
|
|
11
12
|
const mapConstructors = (member) => {
|
|
12
13
|
if (member.decorators && member.decorators.find(d => d.name === 'NgModule')) {
|
package/lib/map-props.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
const { ReflectionKind } = require('typedoc');
|
|
3
4
|
const comment = require('./comment');
|
|
4
5
|
const types = require('./type-utils');
|
|
5
6
|
const isConstructor = require('./is-constructor');
|
|
@@ -9,10 +10,10 @@ const isMethod = require('./is-method');
|
|
|
9
10
|
const isPublic = require('./is-public');
|
|
10
11
|
|
|
11
12
|
const defaultValue = prop => {
|
|
12
|
-
const { comment: {
|
|
13
|
-
const {
|
|
13
|
+
const { comment: { blockTags = [] } = {} } = prop;
|
|
14
|
+
const { content = [ { text: '' } ] } = blockTags.find(t => t.tag === '@default') || {};
|
|
14
15
|
|
|
15
|
-
return
|
|
16
|
+
return content && content.map(c => c.text).join(' ').replace(/```ts\n/g, '').replace(/\n```/g, '').trim();
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
const accessor = signature => (Array.isArray(signature) ? signature[0] : signature);
|
|
@@ -24,7 +25,7 @@ const mapProps = (children, parentName) =>
|
|
|
24
25
|
let commentProp = prop;
|
|
25
26
|
if (prop.type) {
|
|
26
27
|
type = types.typeString(prop);
|
|
27
|
-
} else if (prop.
|
|
28
|
+
} else if (prop.kind === ReflectionKind.Accessor) {
|
|
28
29
|
const getter = prop.getSignature;
|
|
29
30
|
const setter = prop.setSignature;
|
|
30
31
|
|
|
@@ -33,7 +34,7 @@ const mapProps = (children, parentName) =>
|
|
|
33
34
|
accessor(setter).parameters[0] :
|
|
34
35
|
accessor(getter)
|
|
35
36
|
);
|
|
36
|
-
} else if (prop.
|
|
37
|
+
} else if (prop.kind === ReflectionKind.Method) {
|
|
37
38
|
type = types.callType(prop.signatures[0]);
|
|
38
39
|
commentProp = prop.signatures[0];
|
|
39
40
|
}
|
|
@@ -41,9 +42,9 @@ const mapProps = (children, parentName) =>
|
|
|
41
42
|
let name = prop.name;
|
|
42
43
|
if (isInput(prop) || isEvent(prop)) {
|
|
43
44
|
const inputArgs = prop.decorators ? prop.decorators[0].arguments : {};
|
|
44
|
-
if (inputArgs.
|
|
45
|
+
if (inputArgs.obj) {
|
|
45
46
|
/* eslint-disable no-eval */
|
|
46
|
-
name = eval(inputArgs.
|
|
47
|
+
name = eval(inputArgs.obj);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const td = require('typedoc');
|
|
2
|
+
const ts = td.TypeScript;
|
|
3
|
+
|
|
4
|
+
/** @param {td.Application} app */
|
|
5
|
+
exports.load = function(app) {
|
|
6
|
+
// Add decorator info to reflections
|
|
7
|
+
app.converter.on(td.Converter.EVENT_CREATE_DECLARATION, addDecoratorInfo);
|
|
8
|
+
|
|
9
|
+
// Add decorator info to serialized json
|
|
10
|
+
app.serializer.addSerializer({
|
|
11
|
+
priority: 0,
|
|
12
|
+
supports(item) {
|
|
13
|
+
return item instanceof td.DeclarationReflection;
|
|
14
|
+
},
|
|
15
|
+
toObject(item, obj) {
|
|
16
|
+
if (item.decorators) {
|
|
17
|
+
obj.decorators = item.decorators;
|
|
18
|
+
}
|
|
19
|
+
return obj;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function addDecoratorInfo(context, decl) {
|
|
25
|
+
const symbol = context.project.getSymbolFromReflection(decl);
|
|
26
|
+
if (!symbol) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const declaration = symbol.valueDeclaration;
|
|
31
|
+
if (!declaration) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const decorators = declaration.modifiers?.filter(ts.isDecorator).map((d) => ({
|
|
36
|
+
name: d.expression.expression.getText(),
|
|
37
|
+
arguments: { obj: d.expression.arguments[0]?.getText() }
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
if (decorators && decorators.length > 0) {
|
|
41
|
+
decl.decorators = decorators;
|
|
42
|
+
}
|
|
43
|
+
}
|
package/lib/return-type.js
CHANGED
|
@@ -8,22 +8,25 @@ const returnType = (definition, parentName) => {
|
|
|
8
8
|
return undefined;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
let
|
|
12
|
-
if (definition.comment) {
|
|
13
|
-
|
|
11
|
+
let tag;
|
|
12
|
+
if (definition.comment && definition.comment.blockTags) {
|
|
13
|
+
tag = definition.comment.blockTags.find(t => t.tag === '@returns');
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
let comment = '';
|
|
17
|
+
if ((!tag && definition.type.name !== 'void') || (tag && tag.content.length === 0)) {
|
|
17
18
|
let source = `${definition.name}`;
|
|
18
19
|
if (parentName) {
|
|
19
20
|
source = `${parentName } - ${source}`;
|
|
20
21
|
}
|
|
21
22
|
utils.warn('Undocumented return type', source);
|
|
23
|
+
} else {
|
|
24
|
+
comment = tag.content.map(c => c.text).join('').trim();
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
return {
|
|
25
28
|
type: types.typeString(definition),
|
|
26
|
-
comment
|
|
29
|
+
comment
|
|
27
30
|
};
|
|
28
31
|
};
|
|
29
32
|
|
package/lib/type-utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
const { ReflectionKind } = require('typedoc');
|
|
3
4
|
const comment = require('./comment');
|
|
4
5
|
|
|
5
6
|
const unionTypes = (member) =>
|
|
@@ -78,8 +79,8 @@ const callType = (definition) => {
|
|
|
78
79
|
|
|
79
80
|
const typeName = (type) => {
|
|
80
81
|
const name = type.name;
|
|
81
|
-
if (type.
|
|
82
|
-
return `[${ name }]({% slug ${ type.
|
|
82
|
+
if (type.slug) {
|
|
83
|
+
return `[${ name }]({% slug ${ type.slug } %})`;
|
|
83
84
|
} else if (type.typeLink) {
|
|
84
85
|
return `[${ name }](${ type.typeLink })`;
|
|
85
86
|
} else if (type.type === 'array') {
|
|
@@ -104,7 +105,7 @@ const singleTypeString = (type) => {
|
|
|
104
105
|
const decl = type.declaration;
|
|
105
106
|
if (decl.signatures) {
|
|
106
107
|
const sig = decl.signatures[0];
|
|
107
|
-
if (decl.name === '__type' && sig.
|
|
108
|
+
if (decl.name === '__type' && sig.kind === ReflectionKind.CallSignature) {
|
|
108
109
|
return callType(sig);
|
|
109
110
|
}
|
|
110
111
|
} else if (decl.indexSignature) {
|
|
@@ -139,7 +140,7 @@ const singleTypeString = (type) => {
|
|
|
139
140
|
const typeString = (prop) => {
|
|
140
141
|
const type = prop.type;
|
|
141
142
|
|
|
142
|
-
if (!type && prop.
|
|
143
|
+
if (!type && prop.kind === ReflectionKind.Method) {
|
|
143
144
|
return singleTypeString(prop.signatures[0]);
|
|
144
145
|
}
|
|
145
146
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-typescript-api-tasks",
|
|
3
3
|
"description": "Kendo UI API docs package gulp tasks",
|
|
4
|
-
"version": "1.1.2-dev.
|
|
4
|
+
"version": "1.1.2-dev.27+1996482",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"API Generation"
|
|
15
15
|
],
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"typescript": "4.
|
|
17
|
+
"typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"glob": "^8.0.3",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"handlebars": "^4.7.7",
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
24
|
"mkdirp": "^1.0.4",
|
|
25
|
-
"typedoc": "0.
|
|
25
|
+
"typedoc": "0.25.2"
|
|
26
26
|
},
|
|
27
27
|
"overrides": {
|
|
28
28
|
"chokidar": "^3.0.0",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"jest-cli": "^29.2.2"
|
|
40
|
+
"jest-cli": "^29.2.2",
|
|
41
|
+
"typescript": "5.2.2"
|
|
41
42
|
},
|
|
42
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "1996482d0a54f58b78d9755e4750afce5a61d821"
|
|
43
44
|
}
|
package/test/api.js
CHANGED
|
@@ -64,7 +64,7 @@ describe('API generation', () => {
|
|
|
64
64
|
it('sets slugs for linking parameter types', () => {
|
|
65
65
|
const ctr = members[1].children[0];
|
|
66
66
|
const param = ctr.signatures[0].parameters[0];
|
|
67
|
-
expect(param.type.
|
|
67
|
+
expect(param.type.slug).toEqual('api_package-name_module1_foo');
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
|
|
@@ -107,7 +107,7 @@ describe('API generation', () => {
|
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
it('adds methods', () => {
|
|
110
|
-
const pageContent = `## Methods\n\n<table class="api-table api-table-methods">\n<thead class="api-table-methods-head">\n<tr>\n<th>\n\n\n#### get\n\n\n</th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td>\n\n\nGets the value of the specified option.\n\n\n</td>\n</tr>\n\n<tr class="nested-table">\n<td>\n<table class="api-table api-table-returns">\n<thead class="api-table-returns-head">\n<tr>\n<th class="th-type">Returns</th>\n<th class="th-desc"></th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td type>\n\n\n<code>\n\n\nany\n\n\n</code>\n\n\n</td>\n<td>\n\n\nThe current option value.\n\n\n</td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>`;
|
|
110
|
+
const pageContent = `## Methods\n\n<table class="api-table api-table-methods">\n<thead class="api-table-methods-head">\n<tr>\n<th>\n\n\n#### get\n\n\n</th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td>\n\n\nGets the value of the specified option.\n\n\n\n\n\n</td>\n</tr>\n\n<tr class="nested-table">\n<td>\n<table class="api-table api-table-returns">\n<thead class="api-table-returns-head">\n<tr>\n<th class="th-type">Returns</th>\n<th class="th-desc"></th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td type>\n\n\n<code>\n\n\nany\n\n\n</code>\n\n\n</td>\n<td>\n\n\nThe current option value.\n\n\n</td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>`;
|
|
111
111
|
expect(page).toContain(pageContent);
|
|
112
112
|
});
|
|
113
113
|
|
|
@@ -121,10 +121,15 @@ describe('API generation', () => {
|
|
|
121
121
|
"isPublic": true
|
|
122
122
|
},
|
|
123
123
|
"comment": {
|
|
124
|
-
"
|
|
124
|
+
"blockTags": [
|
|
125
125
|
{
|
|
126
|
-
"tag": "default",
|
|
127
|
-
"
|
|
126
|
+
"tag": "@default",
|
|
127
|
+
"content": [
|
|
128
|
+
{
|
|
129
|
+
"kind": "text",
|
|
130
|
+
"text": "42\n"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
128
133
|
}
|
|
129
134
|
]
|
|
130
135
|
}
|
|
@@ -203,10 +208,15 @@ describe('API generation', () => {
|
|
|
203
208
|
"isPublic": true
|
|
204
209
|
},
|
|
205
210
|
"comment": {
|
|
206
|
-
"
|
|
211
|
+
"blockTags": [
|
|
207
212
|
{
|
|
208
|
-
"tag": "default",
|
|
209
|
-
"
|
|
213
|
+
"tag": "@default",
|
|
214
|
+
"content": [
|
|
215
|
+
{
|
|
216
|
+
"kind": "text",
|
|
217
|
+
"text": "42\n"
|
|
218
|
+
}
|
|
219
|
+
]
|
|
210
220
|
}
|
|
211
221
|
]
|
|
212
222
|
}
|
|
@@ -224,23 +234,20 @@ describe('API generation', () => {
|
|
|
224
234
|
const fieldsData = require('./fields-def.json');
|
|
225
235
|
|
|
226
236
|
it('does not render fields without comment', () => {
|
|
227
|
-
|
|
228
237
|
const page = componentPage(fieldsData.withoutComment, packageInfo);
|
|
229
238
|
|
|
230
239
|
expect(page).not.toContain('Fields');
|
|
231
240
|
});
|
|
232
241
|
|
|
233
242
|
it('render fields without decorators, but with comment', () => {
|
|
234
|
-
|
|
235
243
|
const page = componentPage(fieldsData.withComment, packageInfo);
|
|
236
|
-
const pageContent = `## Fields\n\n<table class="api-table api-table-fields">\n<thead>\n<tr>\n<th class="th-name">Name</th>\n<th class="th-type">Type</th>\n<th class="th-default">Default</th>\n<th class="th-desc">Description</th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td class="table-cell-name">\n\n\n#### bar\n\n\n</td>\n<td type class="table-cell-type">\n\n\n<code>\n\n\nQueryList<string>\n\n\n</code>\n\n\n</td>\n<td class="table-cell-default">\n\n\n\n\n</td>\n<td class="table-cell-comment">\n\n\nsome comment\
|
|
244
|
+
const pageContent = `## Fields\n\n<table class="api-table api-table-fields">\n<thead>\n<tr>\n<th class="th-name">Name</th>\n<th class="th-type">Type</th>\n<th class="th-default">Default</th>\n<th class="th-desc">Description</th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td class="table-cell-name">\n\n\n#### bar\n\n\n</td>\n<td type class="table-cell-type">\n\n\n<code>\n\n\nQueryList<string>\n\n\n</code>\n\n\n</td>\n<td class="table-cell-default">\n\n\n\n\n</td>\n<td class="table-cell-comment">\n\n\nsome comment\nlong text\n\n\n</td>\n</tr>\n</tbody>\n</table>`;
|
|
237
245
|
expect(page).toContain(pageContent);
|
|
238
246
|
});
|
|
239
247
|
|
|
240
248
|
it('render fields with decorators and comment', () => {
|
|
241
|
-
|
|
242
249
|
const page = componentPage(fieldsData.withCommentAndDecorator, packageInfo);
|
|
243
|
-
const pageContent = `## Fields\n\n<table class="api-table api-table-fields">\n<thead>\n<tr>\n<th class="th-name">Name</th>\n<th class="th-type">Type</th>\n<th class="th-default">Default</th>\n<th class="th-desc">Description</th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td class="table-cell-name">\n\n\n#### bar\n\n\n</td>\n<td type class="table-cell-type">\n\n\n<code>\n\n\nQueryList<string>\n\n\n</code>\n\n\n</td>\n<td class="table-cell-default">\n\n\n\n\n</td>\n<td class="table-cell-comment">\n\n\nsome comment\
|
|
250
|
+
const pageContent = `## Fields\n\n<table class="api-table api-table-fields">\n<thead>\n<tr>\n<th class="th-name">Name</th>\n<th class="th-type">Type</th>\n<th class="th-default">Default</th>\n<th class="th-desc">Description</th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td class="table-cell-name">\n\n\n#### bar\n\n\n</td>\n<td type class="table-cell-type">\n\n\n<code>\n\n\nQueryList<string>\n\n\n</code>\n\n\n</td>\n<td class="table-cell-default">\n\n\n\n\n</td>\n<td class="table-cell-comment">\n\n\nsome comment\nlong text\n\n\n</td>\n</tr>\n</tbody>\n</table>`;
|
|
244
251
|
expect(page).toContain(pageContent);
|
|
245
252
|
});
|
|
246
253
|
});
|
|
@@ -251,14 +258,14 @@ describe('API generation', () => {
|
|
|
251
258
|
it('render inputs name and type', () => {
|
|
252
259
|
|
|
253
260
|
const page = componentPage(inputsData.withoutNameMapping, packageInfo);
|
|
254
|
-
const pageContent = `## Inputs\n\n<table class="api-table api-table-inputs">\n<thead>\n<tr>\n<th class="th-name">Name</th>\n<th class="th-type">Type</th>\n<th class="th-default">Default</th>\n<th class="th-desc">Description</th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td class="table-cell-name">\n\n\n#### bar\n\n\n</td>\n<td type class="table-cell-type">\n\n\n<code>\n\n\nboolean\n\n\n</code>\n\n\n</td>\n<td class="table-cell-default">\n\n\n\n\n</td>\n<td class="table-cell-comment">\n\n\n\n\n\n</td>\n</tr>\n</tbody>\n</table>`;
|
|
261
|
+
const pageContent = `## Inputs\n\n<table class="api-table api-table-inputs">\n<thead>\n<tr>\n<th class="th-name">Name</th>\n<th class="th-type">Type</th>\n<th class="th-default">Default</th>\n<th class="th-desc">Description</th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td class="table-cell-name">\n\n\n#### bar\n\n\n</td>\n<td type class="table-cell-type">\n\n\n<code>\n\n\nboolean\n\n\n</code>\n\n\n</td>\n<td class="table-cell-default">\n\n\n<code>\n\n\nfalse\n\n\n</code>\n\n\n</td>\n<td class="table-cell-comment">\n\n\n\n\n\n\n\n\n</td>\n</tr>\n</tbody>\n</table>`;
|
|
255
262
|
expect(page).toContain(pageContent);
|
|
256
263
|
});
|
|
257
264
|
|
|
258
265
|
it('render fields with mapped name', () => {
|
|
259
266
|
|
|
260
267
|
const page = componentPage(inputsData.withNameMapping, packageInfo);
|
|
261
|
-
const pageContent = `## Inputs\n\n<table class="api-table api-table-inputs">\n<thead>\n<tr>\n<th class="th-name">Name</th>\n<th class="th-type">Type</th>\n<th class="th-default">Default</th>\n<th class="th-desc">Description</th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td class="table-cell-name">\n\n\n#### foo\n\n\n</td>\n<td type class="table-cell-type">\n\n\n<code>\n\n\nboolean\n\n\n</code>\n\n\n</td>\n<td class="table-cell-default">\n\n\n\n\n</td>\n<td class="table-cell-comment">\n\n\n\n\n\n</td>\n</tr>\n</tbody>\n</table>`;
|
|
268
|
+
const pageContent = `## Inputs\n\n<table class="api-table api-table-inputs">\n<thead>\n<tr>\n<th class="th-name">Name</th>\n<th class="th-type">Type</th>\n<th class="th-default">Default</th>\n<th class="th-desc">Description</th>\n</tr>\n</thead>\n<tbody class="api-table-body">\n<tr>\n<td class="table-cell-name">\n\n\n#### foo\n\n\n</td>\n<td type class="table-cell-type">\n\n\n<code>\n\n\nboolean\n\n\n</code>\n\n\n</td>\n<td class="table-cell-default">\n\n\n<code>\n\n\nfalse\n\n\n</code>\n\n\n</td>\n<td class="table-cell-comment">\n\n\n\n\n\n\n\n\n</td>\n</tr>\n</tbody>\n</table>`;
|
|
262
269
|
expect(page).toContain(pageContent);
|
|
263
270
|
});
|
|
264
271
|
});
|
package/test/class.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "Shape",
|
|
3
|
-
"
|
|
3
|
+
"kind": 128,
|
|
4
4
|
"comment": {
|
|
5
5
|
"shortText": "Represents a drawing element that can be filled and stroked"
|
|
6
6
|
},
|
|
7
7
|
"typeParameter": [
|
|
8
8
|
{
|
|
9
9
|
"name": "T",
|
|
10
|
-
"
|
|
10
|
+
"kind": 131072
|
|
11
11
|
}
|
|
12
12
|
],
|
|
13
13
|
"children": [
|
|
14
14
|
{
|
|
15
15
|
"name": "constructor",
|
|
16
|
-
"
|
|
16
|
+
"kind": 512,
|
|
17
17
|
"flags": {
|
|
18
18
|
"isExported": true
|
|
19
19
|
},
|
|
@@ -27,12 +27,17 @@
|
|
|
27
27
|
"parameters": [
|
|
28
28
|
{
|
|
29
29
|
"name": "options",
|
|
30
|
-
"
|
|
30
|
+
"kind": 32768,
|
|
31
31
|
"flags": {
|
|
32
32
|
"isOptional": true
|
|
33
33
|
},
|
|
34
34
|
"comment": {
|
|
35
|
-
"
|
|
35
|
+
"summary": [
|
|
36
|
+
{
|
|
37
|
+
"kind": "text",
|
|
38
|
+
"text": "The initial values of all options.\n"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
36
41
|
},
|
|
37
42
|
"type": {
|
|
38
43
|
"type": "instrinct",
|
|
@@ -49,18 +54,33 @@
|
|
|
49
54
|
},
|
|
50
55
|
{
|
|
51
56
|
"name": "get",
|
|
52
|
-
"
|
|
57
|
+
"kind": 2048,
|
|
53
58
|
"flags": {
|
|
54
59
|
"isExported": true
|
|
55
60
|
},
|
|
56
61
|
"signatures": [
|
|
57
62
|
{
|
|
58
63
|
"name": "get",
|
|
59
|
-
"
|
|
64
|
+
"kind": 4096,
|
|
60
65
|
"flags": {},
|
|
61
66
|
"comment": {
|
|
62
|
-
"
|
|
63
|
-
|
|
67
|
+
"summary": [
|
|
68
|
+
{
|
|
69
|
+
"kind": "text",
|
|
70
|
+
"text": "Gets the value of the specified option."
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"blockTags": [
|
|
74
|
+
{
|
|
75
|
+
"tag": "@returns",
|
|
76
|
+
"content": [
|
|
77
|
+
{
|
|
78
|
+
"kind": "text",
|
|
79
|
+
"text": "The current option value."
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
]
|
|
64
84
|
},
|
|
65
85
|
"type": {
|
|
66
86
|
"type": "instrinct",
|