@progress/kendo-typescript-api-tasks 1.1.2-dev.27 → 1.1.2-dev.32

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/lib/class-page.js CHANGED
@@ -17,8 +17,8 @@ const classPage = (member, meta) => {
17
17
  let constructors = null;
18
18
  if (member.children) {
19
19
  constructors = mapConstructors(member);
20
- methods = mapMethods(member.children, member.name);
21
- props = mapProps(member.children, member.name);
20
+ methods = mapMethods(member.children, member);
21
+ props = mapProps(member.children, member);
22
22
  }
23
23
 
24
24
  return classTemplate(Object.assign({}, meta, {
package/lib/comment.js CHANGED
@@ -34,7 +34,7 @@ const commentSummary = (comment) => {
34
34
  return comment.summary.map(c => c.text).join('').trim();
35
35
  };
36
36
 
37
- const formatComment = (member, parentName, memberKind) => {
37
+ const formatComment = (member, parent) => {
38
38
  let signatures;
39
39
  if (member.type && member.type.declaration) {
40
40
  signatures = member.type.declaration.signatures;
@@ -43,7 +43,7 @@ const formatComment = (member, parentName, memberKind) => {
43
43
  const comment = member.comment || signatures && signatures[0] && signatures[0].comment;
44
44
 
45
45
  if (!comment) {
46
- warn(member, parentName, memberKind);
46
+ warn(member, parent);
47
47
 
48
48
  return '';
49
49
  }
@@ -44,10 +44,10 @@ const componentPage = (component, meta) => {
44
44
  let events;
45
45
  let methods;
46
46
  if (component.children) {
47
- fields = ignoreWithoutComment(mapProps(component.children.filter(isField), component.name));
48
- inputs = ignoreWithoutComment(mapProps(component.children.filter(isInput), component.name));
49
- events = mapProps(component.children.filter(isEvent), component.name);
50
- methods = mapMethods(component.children, component.name);
47
+ fields = ignoreWithoutComment(mapProps(component.children.filter(isField), component));
48
+ inputs = ignoreWithoutComment(mapProps(component.children.filter(isInput), component));
49
+ events = mapProps(component.children.filter(isEvent), component);
50
+ methods = mapMethods(component.children, component);
51
51
  }
52
52
 
53
53
  return componentTemplate(Object.assign({}, meta, {
package/lib/generator.js CHANGED
@@ -161,6 +161,7 @@ const extractMembers = (packageName, modules, config) => {
161
161
  packageName: fullName,
162
162
  url: `${child.name}`,
163
163
  signatures: child.signatures,
164
+ sources: child.sources,
164
165
  slug: slug(fullName, child.name),
165
166
  typeParameter: child.typeParameter
166
167
  };
@@ -15,16 +15,14 @@ const mapConstructors = (member) => {
15
15
  return [];
16
16
  }
17
17
 
18
- return utils.flatten(member.children.filter(isConstructor).map(ctr => {
19
- const source = `${member.name}.constructor`;
20
-
21
- return ctr.signatures.map((signature) => ({
18
+ return utils.flatten(member.children.filter(isConstructor).map(ctr =>
19
+ ctr.signatures.map((signature) => ({
22
20
  signature: types.callSignature(signature),
23
- comment: comment(signature, source),
21
+ comment: comment(signature),
24
22
  name: types.fullName(member),
25
- params: types.params(signature, source)
26
- }));
27
- }));
23
+ params: types.params(signature)
24
+ }))
25
+ ));
28
26
  };
29
27
 
30
28
  module.exports = mapConstructors;
@@ -6,16 +6,14 @@ const isMethod = require('./is-method.js');
6
6
  const returnType = require('./return-type');
7
7
  const utils = require('./utils');
8
8
 
9
- const mapMethods = (children, parentName) =>
9
+ const mapMethods = (children, parent) =>
10
10
  utils.flatten(children.filter(isMethod).map(method => {
11
11
  const name = method.name;
12
- const source = `${parentName}.${name}`;
13
-
14
12
  return method.signatures.map((signature) => ({
15
- comment: comment(signature, source),
13
+ comment: comment(signature, parent),
16
14
  name: name,
17
- returns: returnType(signature, source),
18
- params: types.params(signature, source)
15
+ returns: returnType(signature, parent),
16
+ params: types.params(signature, parent)
19
17
  }));
20
18
  }));
21
19
 
package/lib/map-props.js CHANGED
@@ -19,7 +19,7 @@ const defaultValue = prop => {
19
19
  const accessor = signature => (Array.isArray(signature) ? signature[0] : signature);
20
20
 
21
21
  const isProp = (prop) => isPublic(prop) && !isConstructor(prop) && !isMethod(prop);
22
- const mapProps = (children, parentName) =>
22
+ const mapProps = (children, parent) =>
23
23
  children.filter(isProp).map(prop => {
24
24
  let type;
25
25
  let commentProp = prop;
@@ -56,7 +56,7 @@ const mapProps = (children, parentName) =>
56
56
  name: name,
57
57
  type: type,
58
58
  defaultValue: defaultValue(prop),
59
- comment: comment(commentProp, parentName)
59
+ comment: comment(commentProp, parent)
60
60
  };
61
61
  });
62
62
 
@@ -14,8 +14,8 @@ const componentPage = (component, meta) => {
14
14
  let properties;
15
15
  let methods;
16
16
  if (component.children) {
17
- properties = mapProps(component.children.filter(isField), component.name);
18
- methods = mapMethods(component.children, component.name);
17
+ properties = mapProps(component.children.filter(isField), component);
18
+ methods = mapMethods(component.children, component);
19
19
  }
20
20
 
21
21
  return componentTemplate(Object.assign({}, meta, {
@@ -2,8 +2,9 @@
2
2
 
3
3
  const types = require('./type-utils.js');
4
4
  const utils = require('./utils.js');
5
+ const source = require('./source');
5
6
 
6
- const returnType = (definition, parentName) => {
7
+ const returnType = (definition, parent) => {
7
8
  if (definition.type.name === 'void') {
8
9
  return undefined;
9
10
  }
@@ -15,11 +16,7 @@ const returnType = (definition, parentName) => {
15
16
 
16
17
  let comment = '';
17
18
  if ((!tag && definition.type.name !== 'void') || (tag && tag.content.length === 0)) {
18
- let source = `${definition.name}`;
19
- if (parentName) {
20
- source = `${parentName } - ${source}`;
21
- }
22
- utils.warn('Undocumented return type', source);
19
+ utils.warn('Undocumented return type', source(definition, parent));
23
20
  } else {
24
21
  comment = tag.content.map(c => c.text).join('').trim();
25
22
  }
package/lib/source.js ADDED
@@ -0,0 +1,7 @@
1
+ const source = (member, parent) => {
2
+ const source = parent ? parent.sources[0] : member.sources[0];
3
+ const sourceFile = `${source.fileName}:${source.line}`;
4
+ return `'${member.name}' ${sourceFile}`;
5
+ };
6
+
7
+ module.exports = source;
package/lib/type-utils.js CHANGED
@@ -35,9 +35,9 @@ const anonParams = (definition) => {
35
35
  return params;
36
36
  };
37
37
 
38
- const params = (definition, parentName) => {
38
+ const params = (definition, parent) => {
39
39
  const paramComment = (param) =>
40
- comment(param, parentName, 'parameter').trim();
40
+ comment(param, parent, 'parameter').trim();
41
41
 
42
42
  const params = anonParams(definition);
43
43
  params.forEach((param) => {
package/lib/warn.js CHANGED
@@ -2,20 +2,15 @@
2
2
 
3
3
  const utils = require('./utils.js');
4
4
  const rules = require('./warning-rules.js');
5
+ const source = require('./source');
5
6
 
6
7
  const runner = rules => member =>
7
8
  rules.reduce((result, rule) => result && rule(member), true);
8
9
 
9
- const warn = (member, parentName, kind = 'member') => {
10
+ const warn = (member, parent, kind = 'member') => {
10
11
  const shouldWarn = runner(rules);
11
- let source = member.name;
12
-
13
- if (parentName) {
14
- source = `${parentName}.${source}`;
15
- }
16
-
17
12
  if (shouldWarn(member)) {
18
- utils.warn(`Undocumented ${kind}`, source);
13
+ utils.warn(`Undocumented ${kind}`, source(member, parent));
19
14
  }
20
15
  };
21
16
 
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.27+1996482",
4
+ "version": "1.1.2-dev.32+864edf2",
5
5
  "author": "Progress",
6
6
  "license": "Apache-2.0",
7
7
  "main": "index.js",
@@ -40,5 +40,5 @@
40
40
  "jest-cli": "^29.2.2",
41
41
  "typescript": "5.2.2"
42
42
  },
43
- "gitHead": "1996482d0a54f58b78d9755e4750afce5a61d821"
43
+ "gitHead": "864edf23cc968b7eb30826398c8f926f2175e2b8"
44
44
  }
package/test/warning.js CHANGED
@@ -15,12 +15,18 @@ describe('comment warnings', () => {
15
15
  {
16
16
  name: "Input"
17
17
  }
18
+ ],
19
+ sources: [
20
+ {
21
+ "fileName": "libs/foo.ts",
22
+ "line": 42
23
+ }
18
24
  ]
19
25
  };
20
26
 
21
- warn(member, '');
27
+ warn(member);
22
28
 
23
- expect(utils.warnings()[0]).toContain('Undocumented member foo');
29
+ expect(utils.warnings()[0]).toContain('Undocumented member \'foo\' libs/foo.ts:42');
24
30
  });
25
31
 
26
32
  it('should warn for Output property', () => {
@@ -30,12 +36,18 @@ describe('comment warnings', () => {
30
36
  {
31
37
  name: "Output"
32
38
  }
39
+ ],
40
+ sources: [
41
+ {
42
+ "fileName": "libs/foo.ts",
43
+ "line": 42
44
+ }
33
45
  ]
34
46
  };
35
47
 
36
- warn(member, '');
48
+ warn(member);
37
49
 
38
- expect(utils.warnings()[0]).toContain('Undocumented member foo');
50
+ expect(utils.warnings()[0]).toContain('Undocumented member \'foo\' libs/foo.ts:42');
39
51
  });
40
52
 
41
53
  it('should warn for Output property', () => {
@@ -45,12 +57,18 @@ describe('comment warnings', () => {
45
57
  {
46
58
  name: "Output"
47
59
  }
60
+ ],
61
+ sources: [
62
+ {
63
+ "fileName": "libs/foo.ts",
64
+ "line": 42
65
+ }
48
66
  ]
49
67
  };
50
68
 
51
- warn(member, '');
69
+ warn(member);
52
70
 
53
- expect(utils.warnings()[0]).toContain('Undocumented member foo');
71
+ expect(utils.warnings()[0]).toContain('Undocumented member \'foo\' libs/foo.ts:42');
54
72
  });
55
73
 
56
74
  it('should not warn for fields without decorators', () => {
@@ -58,7 +76,7 @@ describe('comment warnings', () => {
58
76
  name: "foo"
59
77
  };
60
78
 
61
- warn(member, '');
79
+ warn(member);
62
80
 
63
81
  expect(utils.warnings().length).toEqual(0);
64
82
  });
@@ -73,7 +91,7 @@ describe('comment warnings', () => {
73
91
  ]
74
92
  };
75
93
 
76
- warn(member, '');
94
+ warn(member);
77
95
 
78
96
  expect(utils.warnings().length).toEqual(0);
79
97
  });
@@ -83,7 +101,7 @@ describe('comment warnings', () => {
83
101
  name: "__namedParameters"
84
102
  };
85
103
 
86
- warn(member, '');
104
+ warn(member);
87
105
 
88
106
  expect(utils.warnings().length).toEqual(0);
89
107
  });