@cparra/apexdocs 2.0.0 → 2.1.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/README.md +37 -9
- package/ROADMAP.md +2 -2
- package/docs/Misc/SampleClassWithoutModifier.md +11 -0
- package/docs/README.md +5 -6
- package/docs/Sample-Classes/SampleClass.md +23 -7
- package/examples/force-app/main/default/classes/SampleClass.cls +16 -0
- package/examples/force-app/main/default/classes/SampleClassWithoutModifier.cls +9 -0
- package/lib/model/markdown-file.d.ts +2 -0
- package/lib/model/markdown-file.js +27 -0
- package/lib/model/markdown-file.js.map +1 -1
- package/lib/model/markdown-generation-util/field-declaration-util.d.ts +1 -1
- package/lib/model/markdown-generation-util/field-declaration-util.js +33 -12
- package/lib/model/markdown-generation-util/field-declaration-util.js.map +1 -1
- package/lib/model/markdown-generation-util/method-declaration-util.d.ts +1 -1
- package/lib/model/markdown-generation-util/method-declaration-util.js +1 -2
- package/lib/model/markdown-generation-util/method-declaration-util.js.map +1 -1
- package/lib/model/markdown-generation-util/type-declaration-util.d.ts +1 -1
- package/lib/model/markdown-generation-util/type-declaration-util.js +1 -2
- package/lib/model/markdown-generation-util/type-declaration-util.js.map +1 -1
- package/lib/model/markdown-home-file.d.ts +1 -0
- package/lib/model/markdown-home-file.js +6 -5
- package/lib/model/markdown-home-file.js.map +1 -1
- package/lib/model/markdown-type-file.d.ts +9 -4
- package/lib/model/markdown-type-file.js +63 -31
- package/lib/model/markdown-type-file.js.map +1 -1
- package/package.json +3 -3
- package/src/model/markdown-file.ts +32 -0
- package/src/model/markdown-generation-util/field-declaration-util.ts +33 -11
- package/src/model/markdown-generation-util/method-declaration-util.ts +0 -2
- package/src/model/markdown-generation-util/type-declaration-util.ts +1 -3
- package/src/model/markdown-home-file.ts +9 -5
- package/src/model/markdown-type-file.ts +71 -32
package/README.md
CHANGED
|
@@ -109,15 +109,15 @@ apexdocs-generate
|
|
|
109
109
|
|
|
110
110
|
The CLI supports the following parameters:
|
|
111
111
|
|
|
112
|
-
| Parameter | Alias | Description
|
|
113
|
-
| ----------------- | -----
|
|
114
|
-
| --sourceDir | -s | The directory location which contains your apex .cls classes.
|
|
115
|
-
| --targetDir | -t | The directory location where documentation will be generated to.
|
|
116
|
-
| --recursive | -r | Whether .cls classes will be searched for recursively in the directory provided.
|
|
117
|
-
| --scope | -p | A list of scopes to document. Values should be separated by a space, e.g --scope public private
|
|
118
|
-
| --targetGenerator | -g | Define the static file generator for which the documents will be created. Currently supports jekyll and docsify.
|
|
119
|
-
| --configPath | -c | The path to the JSON configuration file that defines the structure of the documents to docGenerator.
|
|
120
|
-
| --group | -o | Define whether the generated files should be grouped by the @group tag on the top level classes.
|
|
112
|
+
| Parameter | Alias | Description | Default | Required |
|
|
113
|
+
| ----------------- | ----- |--------------------------------------------------------------------------------------------------------------------------| ----------------------------------- | -------- |
|
|
114
|
+
| --sourceDir | -s | The directory location which contains your apex .cls classes. | N/A | Yes |
|
|
115
|
+
| --targetDir | -t | The directory location where documentation will be generated to. | `docs` | No |
|
|
116
|
+
| --recursive | -r | Whether .cls classes will be searched for recursively in the directory provided. | `true` | No |
|
|
117
|
+
| --scope | -p | A list of scopes to document. Values should be separated by a space, e.g --scope public private | `global namespaceaccessible public` | No |
|
|
118
|
+
| --targetGenerator | -g | Define the static file generator for which the documents will be created. Currently supports jekyll and docsify. | `jekyll` | No |
|
|
119
|
+
| --configPath | -c | (Only versions 1.X) The path to the JSON configuration file that defines the structure of the documents to docGenerator. | N/A | No |
|
|
120
|
+
| --group | -o | (Only versions 1.X) Define whether the generated files should be grouped by the @group tag on the top level classes. | `true` | No |
|
|
121
121
|
|
|
122
122
|
#### Configuration File
|
|
123
123
|
|
|
@@ -314,6 +314,34 @@ The following tags are supported on the method level:
|
|
|
314
314
|
public static Object call(String action) {
|
|
315
315
|
```
|
|
316
316
|
|
|
317
|
+
### Grouping Declarations Within A Class
|
|
318
|
+
|
|
319
|
+
A class might have members that should be grouped together. For example, you can have a class for constants with
|
|
320
|
+
groups of constants that should be grouped together because they share a common behavior (e.g. different groups
|
|
321
|
+
of constants representing the possible values for different picklists.)
|
|
322
|
+
|
|
323
|
+
You can group things together within a class by using the following syntax:
|
|
324
|
+
```apex
|
|
325
|
+
// @start-group Group Name or Description
|
|
326
|
+
public static final String CONSTANT_FOO = 'Foo';
|
|
327
|
+
public static final String CONSTANT_BAR = 'Bar';
|
|
328
|
+
// @end-group
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Groups of members are displayed together under their own subsection after its name or description.
|
|
332
|
+
|
|
333
|
+
Some notes about grouping:
|
|
334
|
+
* This is only supported on classes, NOT enums and interfaces
|
|
335
|
+
* Supports
|
|
336
|
+
* Properties
|
|
337
|
+
* Fields (variables and constants)
|
|
338
|
+
* Constructors
|
|
339
|
+
* Methods
|
|
340
|
+
* BUT only members of the same type are grouped together. For example,
|
|
341
|
+
if you have a group that contains properties and methods the properties will be grouped together under Properties -> Group Name, and the methods will be grouped together under Methods -> Group Name
|
|
342
|
+
* Does not support inner types (inner classes, interfaces, and enums)
|
|
343
|
+
* It is necessary to use `// @end-group` whenever a group has been started, otherwise a parsing error will be raised for that file.
|
|
344
|
+
|
|
317
345
|
### Inline linking
|
|
318
346
|
|
|
319
347
|
Apexdocs allows you to reference other classes from anywhere in your docs, and automatically creates a link to that
|
package/ROADMAP.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
[] Automatic Resolution of links (@see and {@link FileName})
|
|
2
|
-
|
|
3
1
|
[] Respect access modifiers where the properties/methods are different from the class declaration. For example,
|
|
4
2
|
AuraEnabled properties do not live in an AuraEnabled class, so there's no way to just generate docs to showcase the
|
|
5
3
|
AuraEnabled properties of a class without some sort of combination of also exposing other public/globals
|
|
@@ -16,3 +14,5 @@ files, instead of just overriding
|
|
|
16
14
|
[] Add configuration setting that allows someone to set the "namespace"
|
|
17
15
|
|
|
18
16
|
[] Homepage support similar to what docsify does
|
|
17
|
+
|
|
18
|
+
[] TW template
|
package/docs/README.md
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
# Classes
|
|
2
2
|
## Sample Classes
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
### [SampleClass](/Sample-Classes/SampleClass.md)
|
|
5
5
|
|
|
6
|
+
This is a class description. This class relates to [SampleInterface](/Sample-Interfaces/SampleInterface.md) But this ClassThatDoesNotExist does not exist. You can also link using this syntax [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
7
|
+
## Miscellaneous
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
### [SampleClassWithoutModifier](/Misc/SampleClassWithoutModifier.md)
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
## Sample Interfaces
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
### [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
14
15
|
|
|
15
16
|
This is an interface description.
|
|
16
|
-
|
|
17
|
-
|
|
@@ -17,13 +17,14 @@ This is a class description. This class relates to [SampleInterface](/Sample-Int
|
|
|
17
17
|
**See** [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
18
18
|
|
|
19
19
|
## Constructors
|
|
20
|
-
###
|
|
20
|
+
### My Super Group
|
|
21
|
+
##### `SampleClass()`
|
|
21
22
|
|
|
22
23
|
`NAMESPACEACCESSIBLE`
|
|
23
24
|
|
|
24
25
|
Constructs a SampleClass without any arguments. This relates to [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
###### Throws
|
|
27
28
|
|Exception|Description|
|
|
28
29
|
|---|---|
|
|
29
30
|
|`ExcName`|some exception|
|
|
@@ -33,32 +34,45 @@ Constructs a SampleClass without any arguments. This relates to [SampleInterface
|
|
|
33
34
|
|
|
34
35
|
**See** [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
###### Example
|
|
37
38
|
```apex
|
|
38
39
|
// Example
|
|
39
40
|
SampleClass sampleInstance = new SampleClass();
|
|
40
41
|
```
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
---
|
|
44
|
+
### Other
|
|
45
|
+
##### `SampleClass(String argument)`
|
|
43
46
|
|
|
44
47
|
Constructs a SampleClass with an argument.
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
###### Parameters
|
|
47
50
|
|Param|Description|
|
|
48
51
|
|---|---|
|
|
49
52
|
|`argument`|Argument definition|
|
|
50
53
|
---
|
|
54
|
+
## Fields
|
|
55
|
+
### Common Constants
|
|
56
|
+
|
|
57
|
+
* `ANOTHER_CONSTANT` → `String`
|
|
58
|
+
* `A_CONSTANT` → `String` [`NAMESPACEACCESSIBLE` ] - This is a constant.
|
|
59
|
+
---
|
|
60
|
+
### Other variables
|
|
61
|
+
|
|
62
|
+
* `someVariable` → `String`
|
|
63
|
+
---
|
|
51
64
|
## Properties
|
|
52
65
|
|
|
53
66
|
### `AnotherProp` → `Decimal`
|
|
54
67
|
|
|
55
|
-
`AURAENABLED`
|
|
68
|
+
`AURAENABLED`
|
|
56
69
|
|
|
57
70
|
This is a Decimal property.
|
|
58
71
|
|
|
59
72
|
### `MyProp` → `String`
|
|
60
73
|
|
|
61
|
-
`AURAENABLED`
|
|
74
|
+
`AURAENABLED`
|
|
75
|
+
`DEPRECATED`
|
|
62
76
|
|
|
63
77
|
This is a String property.
|
|
64
78
|
|
|
@@ -113,6 +127,7 @@ Inner class belonging to SampleClass.
|
|
|
113
127
|
|
|
114
128
|
##### `InnerProp` → `String`
|
|
115
129
|
|
|
130
|
+
|
|
116
131
|
Description of the inner property.
|
|
117
132
|
|
|
118
133
|
---
|
|
@@ -131,6 +146,7 @@ Inner class belonging to SampleClass.
|
|
|
131
146
|
|
|
132
147
|
##### `InnerProp` → `String`
|
|
133
148
|
|
|
149
|
+
|
|
134
150
|
Description of the inner property.
|
|
135
151
|
|
|
136
152
|
---
|
|
@@ -19,6 +19,20 @@ public with sharing class SampleClass {
|
|
|
19
19
|
C
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// @start-group Common Constants
|
|
23
|
+
/**
|
|
24
|
+
* @description This is a constant.
|
|
25
|
+
*/
|
|
26
|
+
@NamespaceAccessible
|
|
27
|
+
public static final String A_CONSTANT = 'My Constant Value';
|
|
28
|
+
public static final String ANOTHER_CONSTANT = 'My Constant Value';
|
|
29
|
+
// @end-group
|
|
30
|
+
|
|
31
|
+
// @start-group Other variables
|
|
32
|
+
public String someVariable = 'test';
|
|
33
|
+
// @end-group
|
|
34
|
+
|
|
35
|
+
// @start-group My Super Group
|
|
22
36
|
/**
|
|
23
37
|
* @description Constructs a SampleClass without any arguments. This relates to {@link SampleInterface}
|
|
24
38
|
* @throws ExcName some exception
|
|
@@ -32,6 +46,7 @@ public with sharing class SampleClass {
|
|
|
32
46
|
public SampleClass() {
|
|
33
47
|
System.debug('Constructor');
|
|
34
48
|
}
|
|
49
|
+
// @end-group
|
|
35
50
|
|
|
36
51
|
/**
|
|
37
52
|
* @description Constructs a SampleClass with an argument.
|
|
@@ -67,6 +82,7 @@ public with sharing class SampleClass {
|
|
|
67
82
|
* @description This is a String property.
|
|
68
83
|
*/
|
|
69
84
|
@AuraEnabled
|
|
85
|
+
@Deprecated
|
|
70
86
|
public String MyProp { get; set; }
|
|
71
87
|
|
|
72
88
|
/**
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MarkdownFile = void 0;
|
|
4
4
|
const file_1 = require("./file");
|
|
5
|
+
const class_file_generatorHelper_1 = require("../transpiler/markdown/class-file-generatorHelper");
|
|
5
6
|
class MarkdownFile extends file_1.File {
|
|
6
7
|
fileExtension() {
|
|
7
8
|
return '.md';
|
|
@@ -48,6 +49,32 @@ class MarkdownFile extends file_1.File {
|
|
|
48
49
|
this._contents += column + '|';
|
|
49
50
|
});
|
|
50
51
|
}
|
|
52
|
+
addListItem(text) {
|
|
53
|
+
this._contents += `* ${text}`;
|
|
54
|
+
}
|
|
55
|
+
static replaceInlineLinks(text) {
|
|
56
|
+
// Parsing text to extract possible linking classes.
|
|
57
|
+
const possibleLinks = text.match(/<<.*?>>/g);
|
|
58
|
+
possibleLinks === null || possibleLinks === void 0 ? void 0 : possibleLinks.forEach((currentMatch) => {
|
|
59
|
+
const classNameForMatch = currentMatch.replace('<<', '').replace('>>', '');
|
|
60
|
+
text = text.replace(currentMatch, class_file_generatorHelper_1.default.getFileLinkByTypeName(classNameForMatch));
|
|
61
|
+
});
|
|
62
|
+
// Parsing links using {@link ClassName} format
|
|
63
|
+
const linkFormatRegEx = '{@link (.*?)}';
|
|
64
|
+
const expression = new RegExp(linkFormatRegEx, 'gi');
|
|
65
|
+
let match;
|
|
66
|
+
const matches = [];
|
|
67
|
+
do {
|
|
68
|
+
match = expression.exec(text);
|
|
69
|
+
if (match) {
|
|
70
|
+
matches.push(match);
|
|
71
|
+
}
|
|
72
|
+
} while (match);
|
|
73
|
+
for (const currentMatch of matches) {
|
|
74
|
+
text = text.replace(currentMatch[0], class_file_generatorHelper_1.default.getFileLinkByTypeName(currentMatch[1]));
|
|
75
|
+
}
|
|
76
|
+
return text;
|
|
77
|
+
}
|
|
51
78
|
}
|
|
52
79
|
exports.MarkdownFile = MarkdownFile;
|
|
53
80
|
//# sourceMappingURL=markdown-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-file.js","sourceRoot":"","sources":["../../src/model/markdown-file.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;
|
|
1
|
+
{"version":3,"file":"markdown-file.js","sourceRoot":"","sources":["../../src/model/markdown-file.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAC9B,kGAAyF;AAEzF,MAAa,YAAa,SAAQ,WAAI;IACpC,aAAa;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,KAAK,GAAG,CAAC;QAC9B,IAAI,KAAK,GAAG,EAAE,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FD,oCAoFC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MarkdownFile } from '../markdown-file';
|
|
2
2
|
import { FieldMirror, PropertyMirror } from '@cparra/apex-reflection';
|
|
3
|
-
export declare function declareField(
|
|
3
|
+
export declare function declareField(markdownFile: MarkdownFile, fields: FieldMirror[] | PropertyMirror[], startingHeadingLevel: number, grouped?: boolean): void;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.declareField = void 0;
|
|
4
|
-
function declareField(
|
|
5
|
-
markdownFile.addTitle(title, startingHeadingLevel + 1);
|
|
4
|
+
function declareField(markdownFile, fields, startingHeadingLevel, grouped = false) {
|
|
6
5
|
markdownFile.addBlankLine();
|
|
7
6
|
fields
|
|
8
7
|
.sort((propA, propB) => {
|
|
@@ -13,22 +12,44 @@ function declareField(title, markdownFile, fields, startingHeadingLevel) {
|
|
|
13
12
|
return 0;
|
|
14
13
|
})
|
|
15
14
|
.forEach((propertyModel) => {
|
|
16
|
-
addFieldSection(markdownFile, propertyModel, startingHeadingLevel);
|
|
15
|
+
addFieldSection(markdownFile, propertyModel, startingHeadingLevel, grouped);
|
|
17
16
|
});
|
|
18
17
|
markdownFile.addHorizontalRule();
|
|
19
18
|
}
|
|
20
19
|
exports.declareField = declareField;
|
|
21
|
-
function addFieldSection(markdownFile,
|
|
22
|
-
var _a;
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
function addFieldSection(markdownFile, mirrorModel, startingHeadingLevel, grouped) {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
if (!grouped) {
|
|
23
|
+
markdownFile.addTitle(`\`${mirrorModel.name}\` → \`${mirrorModel.type}\``, startingHeadingLevel + 2);
|
|
25
24
|
markdownFile.addBlankLine();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
mirrorModel.annotations.forEach((annotation) => {
|
|
26
|
+
markdownFile.addText(`\`${annotation.type.toUpperCase()}\` `);
|
|
27
|
+
});
|
|
28
|
+
if ((_a = mirrorModel.docComment) === null || _a === void 0 ? void 0 : _a.description) {
|
|
29
|
+
markdownFile.addBlankLine();
|
|
30
|
+
markdownFile.addText(mirrorModel.docComment.description);
|
|
31
|
+
}
|
|
32
|
+
markdownFile.addBlankLine();
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
let annotations = '';
|
|
36
|
+
const hasAnnotations = !!mirrorModel.annotations.length;
|
|
37
|
+
if (hasAnnotations) {
|
|
38
|
+
annotations += ' [';
|
|
39
|
+
}
|
|
40
|
+
mirrorModel.annotations.forEach((annotation) => {
|
|
41
|
+
annotations += `\`${annotation.type.toUpperCase()}\` `;
|
|
42
|
+
});
|
|
43
|
+
if (hasAnnotations) {
|
|
44
|
+
annotations += ']';
|
|
45
|
+
}
|
|
46
|
+
// If grouped we want to display these as a list
|
|
47
|
+
let description = '';
|
|
48
|
+
if ((_b = mirrorModel.docComment) === null || _b === void 0 ? void 0 : _b.description) {
|
|
49
|
+
description = ` - ${(_c = mirrorModel.docComment) === null || _c === void 0 ? void 0 : _c.description}`;
|
|
50
|
+
}
|
|
51
|
+
markdownFile.addListItem(`\`${mirrorModel.name}\` → \`${mirrorModel.type}\`${annotations} ${description}`);
|
|
29
52
|
markdownFile.addBlankLine();
|
|
30
|
-
markdownFile.addText(propertyModel.docComment.description);
|
|
31
53
|
}
|
|
32
|
-
markdownFile.addBlankLine();
|
|
33
54
|
}
|
|
34
55
|
//# sourceMappingURL=field-declaration-util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/field-declaration-util.ts"],"names":[],"mappings":";;;AAGA,SAAgB,YAAY,CAC1B,
|
|
1
|
+
{"version":3,"file":"field-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/field-declaration-util.ts"],"names":[],"mappings":";;;AAGA,SAAgB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CAAC;KAC7B;SAAM;QACL,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC;QACxD,IAAI,cAAc,EAAE;YAClB,WAAW,IAAI,IAAI,CAAC;SACrB;QACD,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YAC7C,WAAW,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,IAAI,cAAc,EAAE;YAClB,WAAW,IAAI,GAAG,CAAC;SACpB;QAED,gDAAgD;QAChD,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,UAAI,WAAW,CAAC,UAAU,0CAAE,WAAW,EAAE;YACvC,WAAW,GAAG,MAAM,MAAA,WAAW,CAAC,UAAU,0CAAE,WAAW,EAAE,CAAC;SAC3D;QACD,YAAY,CAAC,WAAW,CAAC,KAAK,WAAW,CAAC,IAAI,UAAU,WAAW,CAAC,IAAI,KAAK,WAAW,IAAI,WAAW,EAAE,CAAC,CAAC;QAC3G,YAAY,CAAC,YAAY,EAAE,CAAC;KAC7B;AACH,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ConstructorMirror, MethodMirror } from '@cparra/apex-reflection';
|
|
2
2
|
import { MarkdownFile } from '../markdown-file';
|
|
3
|
-
export declare function declareMethod(
|
|
3
|
+
export declare function declareMethod(markdownFile: MarkdownFile, methods: ConstructorMirror[] | MethodMirror[], startingHeadingLevel: number, className?: string): void;
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.declareMethod = void 0;
|
|
4
4
|
const doc_comment_annotation_util_1 = require("./doc-comment-annotation-util");
|
|
5
|
-
function declareMethod(
|
|
6
|
-
markdownFile.addTitle(title, startingHeadingLevel + 1);
|
|
5
|
+
function declareMethod(markdownFile, methods, startingHeadingLevel, className = '') {
|
|
7
6
|
methods.forEach((currentMethod) => {
|
|
8
7
|
var _a, _b;
|
|
9
8
|
const signatureName = isMethod(currentMethod) ? currentMethod.name : className;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/method-declaration-util.ts"],"names":[],"mappings":";;;AAGA,+EAA+E;AAE/E,SAAgB,aAAa,CAC3B,
|
|
1
|
+
{"version":3,"file":"method-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/method-declaration-util.ts"],"names":[],"mappings":";;;AAGA,+EAA+E;AAE/E,SAAgB,aAAa,CAC3B,YAA0B,EAC1B,OAA6C,EAC7C,oBAA4B,EAC5B,SAAS,GAAG,EAAE;IAEd,OAAO,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;;QAChC,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAE,aAA8B,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACjG,YAAY,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,aAAa,EAAE,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,CAAC,CAAC,CAAC;QACvG,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YAC/C,YAAY,CAAC,YAAY,EAAE,CAAC;YAC5B,YAAY,CAAC,OAAO,CAAC,KAAK,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;QAEH,UAAI,aAAa,CAAC,UAAU,0CAAE,WAAW,EAAE;YACzC,YAAY,CAAC,YAAY,EAAE,CAAC;YAC5B,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YAC3D,YAAY,CAAC,YAAY,EAAE,CAAC;SAC7B;QAED,IAAI,aAAa,CA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AAU,0CAAE,iBAAiB,CAAC,MAAM,CAAA,EAAE;QACzD,OAAO;KACR;IACD,YAAY,CAAC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,GAAG,CAAC,CAAC,CAAC;IAC1D,YAAY,CAAC,eAAe,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAEzD,MAAA,eAAe,CAAC,UAAU,0CAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QACnE,MAAM,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QAC/C,MAAM,oBAAoB,GAAG,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE5D,YAAY,CAAC,WAAW,CAAC,KAAK,aAAa,IAAI,EAAE,oBAAoB,CAAC,CAAC;IACzE,CAAC,EAAE;IAEH,YAAY,CAAC,YAAY,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,UAAU,CAAC,YAA0B,EAAE,eAAgC,EAAE,oBAA4B;;IAC5G,YAAY,CAAC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,GAAG,CAAC,CAAC,CAAC;IAC3D,YAAY,CAAC,cAAc,EAAE,CAAC;IAC9B,MAAA,eAAe,CAAC,UAAU,0CAAE,iBAAiB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACvE,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC,EAAE;IACH,YAAY,CAAC,YAAY,EAAE,CAAC;IAC5B,YAAY,CAAC,YAAY,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,QAAQ,CAAC,MAAyD;IACzE,OAAQ,MAAuB,CAAC,IAAI,KAAK,SAAS,CAAC;AACrD,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MarkdownFile } from '../markdown-file';
|
|
2
2
|
import { Type } from '@cparra/apex-reflection';
|
|
3
|
-
export declare function declareType(markdownFile: MarkdownFile, typeMirror: Type
|
|
3
|
+
export declare function declareType(markdownFile: MarkdownFile, typeMirror: Type): void;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.declareType = void 0;
|
|
4
4
|
const doc_comment_annotation_util_1 = require("./doc-comment-annotation-util");
|
|
5
|
-
function declareType(markdownFile, typeMirror
|
|
5
|
+
function declareType(markdownFile, typeMirror) {
|
|
6
6
|
var _a;
|
|
7
|
-
markdownFile.addTitle(typeMirror.name, startingHeadingLevel);
|
|
8
7
|
typeMirror.annotations.forEach((currentAnnotation) => {
|
|
9
8
|
markdownFile.addBlankLine();
|
|
10
9
|
markdownFile.addText(`\`${currentAnnotation.type.toUpperCase()}\``);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/type-declaration-util.ts"],"names":[],"mappings":";;;AACA,+EAA+E;AAG/E,SAAgB,WAAW,CAAC,YAA0B,EAAE,UAAgB
|
|
1
|
+
{"version":3,"file":"type-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/type-declaration-util.ts"],"names":[],"mappings":";;;AACA,+EAA+E;AAG/E,SAAgB,WAAW,CAAC,YAA0B,EAAE,UAAgB;;IACtE,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,iBAA6B,EAAE,EAAE;QAC/D,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,YAAY,CAAC,OAAO,CAAC,KAAK,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,UAAI,UAAU,CAAC,UAAU,0CAAE,WAAW,EAAE;QACtC,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACxD,YAAY,CAAC,YAAY,EAAE,CAAC;KAC7B;IAED,4DAA8B,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AAC3D,CAAC;AAbD,kCAaC"}
|
|
@@ -4,6 +4,7 @@ export declare class MarkdownHomeFile extends MarkdownFile {
|
|
|
4
4
|
fileName: string;
|
|
5
5
|
types: Type[];
|
|
6
6
|
constructor(fileName: string, types: Type[], headerContent?: string);
|
|
7
|
+
addText(text: string, encodeHtml?: boolean): void;
|
|
7
8
|
private addTypeEntries;
|
|
8
9
|
private addTypeEntry;
|
|
9
10
|
private group;
|
|
@@ -14,6 +14,10 @@ class MarkdownHomeFile extends markdown_file_1.MarkdownFile {
|
|
|
14
14
|
this.addTitle('Classes');
|
|
15
15
|
this.addTypeEntries(types);
|
|
16
16
|
}
|
|
17
|
+
addText(text, encodeHtml = true) {
|
|
18
|
+
text = markdown_file_1.MarkdownFile.replaceInlineLinks(text);
|
|
19
|
+
super.addText(text, encodeHtml);
|
|
20
|
+
}
|
|
17
21
|
addTypeEntries(types) {
|
|
18
22
|
const groupedClasses = this.group(types);
|
|
19
23
|
groupedClasses.forEach((value, key) => {
|
|
@@ -26,12 +30,9 @@ class MarkdownHomeFile extends markdown_file_1.MarkdownFile {
|
|
|
26
30
|
addTypeEntry(typeMirror) {
|
|
27
31
|
var _a, _b;
|
|
28
32
|
this.addBlankLine();
|
|
29
|
-
this.addTitle(class_file_generatorHelper_1.default.getFileLink(typeMirror),
|
|
30
|
-
this.addBlankLine();
|
|
33
|
+
this.addTitle(class_file_generatorHelper_1.default.getFileLink(typeMirror), 3);
|
|
31
34
|
this.addBlankLine();
|
|
32
35
|
this.addText((_b = (_a = typeMirror.docComment) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : '');
|
|
33
|
-
this.addBlankLine();
|
|
34
|
-
this.addBlankLine();
|
|
35
36
|
}
|
|
36
37
|
group(classes) {
|
|
37
38
|
return classes.reduce((groups, currentClass) => {
|
|
@@ -44,7 +45,7 @@ class MarkdownHomeFile extends markdown_file_1.MarkdownFile {
|
|
|
44
45
|
}
|
|
45
46
|
getClassGroup(classModel) {
|
|
46
47
|
var _a, _b, _c;
|
|
47
|
-
return (_c = (_b = (_a = classModel.docComment) === null || _a === void 0 ? void 0 : _a.annotations.find((annotation) => annotation.name === 'group')) === null || _b === void 0 ? void 0 : _b.body) !== null && _c !== void 0 ? _c : '';
|
|
48
|
+
return ((_c = (_b = (_a = classModel.docComment) === null || _a === void 0 ? void 0 : _a.annotations.find((annotation) => annotation.name === 'group')) === null || _b === void 0 ? void 0 : _b.body) !== null && _c !== void 0 ? _c : 'Miscellaneous');
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
exports.MarkdownHomeFile = MarkdownHomeFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-home-file.js","sourceRoot":"","sources":["../../src/model/markdown-home-file.ts"],"names":[],"mappings":";;;AACA,kGAAyF;AACzF,mDAA+C;AAE/C,MAAa,gBAAiB,SAAQ,4BAAY;IAChD,YAAmB,QAAgB,EAAS,KAAa,EAAE,aAAsB;QAC/E,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QADH,aAAQ,GAAR,QAAQ,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAQ;QAEvD,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SAC7B;QACD,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACzB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEO,cAAc,CAAC,KAAa;QAClC,MAAM,cAAc,GAAwB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9D,cAAc,CAAC,OAAO,CAAC,CAAC,KAAa,EAAE,GAAW,EAAE,EAAE;YACpD,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACtB,KAAK,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,E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ownTypeFile extends MarkdownFile implements WalkerListener {
|
|
5
5
|
type: Type;
|
|
6
|
-
|
|
7
|
-
constructor(type: Type,
|
|
6
|
+
headingLevel: number;
|
|
7
|
+
constructor(type: Type, headingLevel?: number, headerContent?: string);
|
|
8
8
|
addText(text: string, encodeHtml?: boolean): void;
|
|
9
|
-
onTypeDeclaration(typeMirror: Type
|
|
9
|
+
onTypeDeclaration(typeMirror: Type): void;
|
|
10
10
|
onConstructorDeclaration(className: string, constructors: ConstructorMirror[]): void;
|
|
11
11
|
onFieldsDeclaration(fields: FieldMirror[]): void;
|
|
12
12
|
onPropertiesDeclaration(properties: PropertyMirror[]): void;
|
|
@@ -15,5 +15,10 @@ export declare class MarkdownTypeFile extends MarkdownFile implements WalkerList
|
|
|
15
15
|
onInnerClassesDeclaration(classes: ClassMirror[]): void;
|
|
16
16
|
onInnerInterfacesDeclaration(interfaces: InterfaceMirror[]): void;
|
|
17
17
|
private addInnerTypes;
|
|
18
|
-
private
|
|
18
|
+
private hasGroupings;
|
|
19
|
+
private declareMethodWithGroupings;
|
|
20
|
+
private declareFieldOrProperty;
|
|
21
|
+
private startGroup;
|
|
22
|
+
private endGroup;
|
|
23
|
+
private group;
|
|
19
24
|
}
|
|
@@ -6,10 +6,10 @@ const markdown_file_1 = require("./markdown-file");
|
|
|
6
6
|
const markdown_generation_util_1 = require("./markdown-generation-util");
|
|
7
7
|
const class_file_generatorHelper_1 = require("../transpiler/markdown/class-file-generatorHelper");
|
|
8
8
|
class MarkdownTypeFile extends markdown_file_1.MarkdownFile {
|
|
9
|
-
constructor(type,
|
|
9
|
+
constructor(type, headingLevel = 1, headerContent) {
|
|
10
10
|
super(`${type.name}`, class_file_generatorHelper_1.default.getSanitizedGroup(type));
|
|
11
11
|
this.type = type;
|
|
12
|
-
this.
|
|
12
|
+
this.headingLevel = headingLevel;
|
|
13
13
|
if (headerContent) {
|
|
14
14
|
this.addText(headerContent);
|
|
15
15
|
}
|
|
@@ -17,23 +17,28 @@ class MarkdownTypeFile extends markdown_file_1.MarkdownFile {
|
|
|
17
17
|
walker.walk(this);
|
|
18
18
|
}
|
|
19
19
|
addText(text, encodeHtml = true) {
|
|
20
|
-
text =
|
|
20
|
+
text = markdown_file_1.MarkdownFile.replaceInlineLinks(text);
|
|
21
21
|
super.addText(text, encodeHtml);
|
|
22
22
|
}
|
|
23
|
-
onTypeDeclaration(typeMirror
|
|
24
|
-
|
|
23
|
+
onTypeDeclaration(typeMirror) {
|
|
24
|
+
this.addTitle(typeMirror.name, this.headingLevel);
|
|
25
|
+
markdown_generation_util_1.declareType(this, typeMirror);
|
|
25
26
|
}
|
|
26
27
|
onConstructorDeclaration(className, constructors) {
|
|
27
|
-
|
|
28
|
+
this.addTitle('Constructors', this.headingLevel + 1);
|
|
29
|
+
this.declareMethodWithGroupings(constructors, className);
|
|
28
30
|
}
|
|
29
31
|
onFieldsDeclaration(fields) {
|
|
30
|
-
|
|
32
|
+
this.addTitle('Fields', this.headingLevel + 1);
|
|
33
|
+
this.declareFieldOrProperty(fields);
|
|
31
34
|
}
|
|
32
35
|
onPropertiesDeclaration(properties) {
|
|
33
|
-
|
|
36
|
+
this.addTitle('Properties', this.headingLevel + 1);
|
|
37
|
+
this.declareFieldOrProperty(properties);
|
|
34
38
|
}
|
|
35
39
|
onMethodsDeclaration(methods) {
|
|
36
|
-
|
|
40
|
+
this.addTitle('Methods', this.headingLevel + 1);
|
|
41
|
+
this.declareMethodWithGroupings(methods);
|
|
37
42
|
}
|
|
38
43
|
onInnerEnumsDeclaration(enums) {
|
|
39
44
|
this.addInnerTypes('Enums', enums);
|
|
@@ -45,7 +50,7 @@ class MarkdownTypeFile extends markdown_file_1.MarkdownFile {
|
|
|
45
50
|
this.addInnerTypes('Interfaces', interfaces, false);
|
|
46
51
|
}
|
|
47
52
|
addInnerTypes(title, types, addSeparator = true) {
|
|
48
|
-
this.addTitle(title, this.
|
|
53
|
+
this.addTitle(title, this.headingLevel + 1);
|
|
49
54
|
types
|
|
50
55
|
.sort((typeA, typeB) => {
|
|
51
56
|
if (typeA.name < typeB.name)
|
|
@@ -55,35 +60,62 @@ class MarkdownTypeFile extends markdown_file_1.MarkdownFile {
|
|
|
55
60
|
return 0;
|
|
56
61
|
})
|
|
57
62
|
.forEach((currentType) => {
|
|
58
|
-
const innerFile = new MarkdownTypeFile(currentType, this.
|
|
63
|
+
const innerFile = new MarkdownTypeFile(currentType, this.headingLevel + 2);
|
|
59
64
|
this.addText(innerFile._contents);
|
|
60
65
|
});
|
|
61
66
|
if (addSeparator) {
|
|
62
67
|
this.addHorizontalRule();
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
hasGroupings(groupAware) {
|
|
71
|
+
return !!groupAware.find((current) => !!current.group);
|
|
72
|
+
}
|
|
73
|
+
declareMethodWithGroupings(methods, className = '') {
|
|
74
|
+
const hasGroupings = this.hasGroupings(methods);
|
|
75
|
+
if (!hasGroupings) {
|
|
76
|
+
markdown_generation_util_1.declareMethod(this, methods, this.headingLevel, className);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const groupedConstructors = this.group(methods);
|
|
80
|
+
for (const key in groupedConstructors) {
|
|
81
|
+
this.startGroup(key);
|
|
82
|
+
const constructorsForGroup = groupedConstructors[key];
|
|
83
|
+
markdown_generation_util_1.declareMethod(this, constructorsForGroup, this.headingLevel, className);
|
|
84
|
+
this.endGroup();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
declareFieldOrProperty(fieldsOrProperties) {
|
|
89
|
+
const hasGroupings = this.hasGroupings(fieldsOrProperties);
|
|
90
|
+
if (!hasGroupings) {
|
|
91
|
+
markdown_generation_util_1.declareField(this, fieldsOrProperties, this.headingLevel, false);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
const groupedFields = this.group(fieldsOrProperties);
|
|
95
|
+
for (const key in groupedFields) {
|
|
96
|
+
this.startGroup(key);
|
|
97
|
+
const fieldsForGroup = groupedFields[key];
|
|
98
|
+
markdown_generation_util_1.declareField(this, fieldsForGroup, this.headingLevel, true);
|
|
99
|
+
this.endGroup();
|
|
81
100
|
}
|
|
82
|
-
} while (match);
|
|
83
|
-
for (const currentMatch of matches) {
|
|
84
|
-
text = text.replace(currentMatch[0], class_file_generatorHelper_1.default.getFileLinkByTypeName(currentMatch[1]));
|
|
85
101
|
}
|
|
86
|
-
|
|
102
|
+
}
|
|
103
|
+
startGroup(groupName) {
|
|
104
|
+
this.headingLevel = this.headingLevel + 2;
|
|
105
|
+
this.addTitle(groupName, this.headingLevel);
|
|
106
|
+
}
|
|
107
|
+
endGroup() {
|
|
108
|
+
this.headingLevel = this.headingLevel - 2;
|
|
109
|
+
}
|
|
110
|
+
group(list) {
|
|
111
|
+
return list.reduce((groups, item) => {
|
|
112
|
+
var _a;
|
|
113
|
+
const groupName = (_a = item.group) !== null && _a !== void 0 ? _a : 'Other';
|
|
114
|
+
const group = groups[groupName] || [];
|
|
115
|
+
group.push(item);
|
|
116
|
+
groups[groupName] = group;
|
|
117
|
+
return groups;
|
|
118
|
+
}, {});
|
|
87
119
|
}
|
|
88
120
|
}
|
|
89
121
|
exports.MarkdownTypeFile = MarkdownTypeFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-type-file.js","sourceRoot":"","sources":["../../src/model/markdown-type-file.ts"],"names":[],"mappings":";;;AAUA,sEAAkE;AAElE,mDAA+C;AAC/C,yEAAsF;AACtF,kGAAyF;
|
|
1
|
+
{"version":3,"file":"markdown-type-file.js","sourceRoot":"","sources":["../../src/model/markdown-type-file.ts"],"names":[],"mappings":";;;AAUA,sEAAkE;AAElE,mDAA+C;AAC/C,yEAAsF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AK,MAAM,GAAG,IAAI,aAAa,EAAE;gBAC/B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;gBACrB,MAAM,cAAc,GAAG,aAAa,CAAC,GAAG,CAAkB,CAAC;gBAC3D,uCAAY,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;gBAC5D,IAAI,CAAC,QAAQ,EAAE,CAAC;aACjB;SACF;IACH,CAAC;IAEO,UAAU,CAAC,SAAiB;QAClC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC;IAEO,QAAQ;QACd,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;IAC5C,CAAC;IAEO,KAAK,CAAC,IAAkB;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,MAAgB,EAAE,IAAI,EAAE,EAAE;;YAC5C,MAAM,SAAS,SAAW,IAAI,CAAC,KAAK,mCAAI,OAAO,CAAC;YAChD,MAAM,KAAK,GAAiB,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YACpD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjB,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;YAC1B,OAAO,MAAM,CAAC;QAChB,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;CACF;AAzHD,4CAyHC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cparra/apexdocs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apex",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"postversion": "git push && git push --tags",
|
|
25
25
|
"docs:init": "docsify init docs",
|
|
26
26
|
"docs:serve": "docsify serve docs",
|
|
27
|
-
"execute:example": "node lib/cli/generate.js -s examples/force-app -t docs --scope global public -g docsify"
|
|
27
|
+
"execute:example": "node lib/cli/generate.js -s examples/force-app -t docs --scope global public private -g docsify"
|
|
28
28
|
},
|
|
29
29
|
"author": "Cesar Parra",
|
|
30
30
|
"license": "MIT",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@cparra/apex-reflection": "^
|
|
66
|
+
"@cparra/apex-reflection": "^1.1.1",
|
|
67
67
|
"chalk": "^4.1.2",
|
|
68
68
|
"html-entities": "^2.3.2",
|
|
69
69
|
"yargs": "^16.0.3"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { File } from './file';
|
|
2
|
+
import ClassFileGeneratorHelper from '../transpiler/markdown/class-file-generatorHelper';
|
|
2
3
|
|
|
3
4
|
export class MarkdownFile extends File {
|
|
4
5
|
fileExtension(): string {
|
|
@@ -53,4 +54,35 @@ export class MarkdownFile extends File {
|
|
|
53
54
|
this._contents += column + '|';
|
|
54
55
|
});
|
|
55
56
|
}
|
|
57
|
+
|
|
58
|
+
addListItem(text: string) {
|
|
59
|
+
this._contents += `* ${text}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
protected static replaceInlineLinks(text: string) {
|
|
63
|
+
// Parsing text to extract possible linking classes.
|
|
64
|
+
const possibleLinks = text.match(/<<.*?>>/g);
|
|
65
|
+
possibleLinks?.forEach((currentMatch) => {
|
|
66
|
+
const classNameForMatch = currentMatch.replace('<<', '').replace('>>', '');
|
|
67
|
+
text = text.replace(currentMatch, ClassFileGeneratorHelper.getFileLinkByTypeName(classNameForMatch));
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Parsing links using {@link ClassName} format
|
|
71
|
+
const linkFormatRegEx = '{@link (.*?)}';
|
|
72
|
+
const expression = new RegExp(linkFormatRegEx, 'gi');
|
|
73
|
+
let match;
|
|
74
|
+
const matches = [];
|
|
75
|
+
|
|
76
|
+
do {
|
|
77
|
+
match = expression.exec(text);
|
|
78
|
+
if (match) {
|
|
79
|
+
matches.push(match);
|
|
80
|
+
}
|
|
81
|
+
} while (match);
|
|
82
|
+
|
|
83
|
+
for (const currentMatch of matches) {
|
|
84
|
+
text = text.replace(currentMatch[0], ClassFileGeneratorHelper.getFileLinkByTypeName(currentMatch[1]));
|
|
85
|
+
}
|
|
86
|
+
return text;
|
|
87
|
+
}
|
|
56
88
|
}
|
|
@@ -2,12 +2,11 @@ import { MarkdownFile } from '../markdown-file';
|
|
|
2
2
|
import { FieldMirror, PropertyMirror } from '@cparra/apex-reflection';
|
|
3
3
|
|
|
4
4
|
export function declareField(
|
|
5
|
-
title: string,
|
|
6
5
|
markdownFile: MarkdownFile,
|
|
7
6
|
fields: FieldMirror[] | PropertyMirror[],
|
|
8
7
|
startingHeadingLevel: number,
|
|
8
|
+
grouped = false,
|
|
9
9
|
) {
|
|
10
|
-
markdownFile.addTitle(title, startingHeadingLevel + 1);
|
|
11
10
|
markdownFile.addBlankLine();
|
|
12
11
|
fields
|
|
13
12
|
.sort((propA, propB) => {
|
|
@@ -16,7 +15,7 @@ export function declareField(
|
|
|
16
15
|
return 0;
|
|
17
16
|
})
|
|
18
17
|
.forEach((propertyModel) => {
|
|
19
|
-
addFieldSection(markdownFile, propertyModel, startingHeadingLevel);
|
|
18
|
+
addFieldSection(markdownFile, propertyModel, startingHeadingLevel, grouped);
|
|
20
19
|
});
|
|
21
20
|
|
|
22
21
|
markdownFile.addHorizontalRule();
|
|
@@ -24,19 +23,42 @@ export function declareField(
|
|
|
24
23
|
|
|
25
24
|
function addFieldSection(
|
|
26
25
|
markdownFile: MarkdownFile,
|
|
27
|
-
|
|
26
|
+
mirrorModel: FieldMirror | PropertyMirror,
|
|
28
27
|
startingHeadingLevel: number,
|
|
28
|
+
grouped: boolean,
|
|
29
29
|
) {
|
|
30
|
-
|
|
30
|
+
if (!grouped) {
|
|
31
|
+
markdownFile.addTitle(`\`${mirrorModel.name}\` → \`${mirrorModel.type}\``, startingHeadingLevel + 2);
|
|
32
|
+
markdownFile.addBlankLine();
|
|
33
|
+
|
|
34
|
+
mirrorModel.annotations.forEach((annotation) => {
|
|
35
|
+
markdownFile.addText(`\`${annotation.type.toUpperCase()}\` `);
|
|
36
|
+
});
|
|
31
37
|
|
|
32
|
-
|
|
38
|
+
if (mirrorModel.docComment?.description) {
|
|
39
|
+
markdownFile.addBlankLine();
|
|
40
|
+
markdownFile.addText(mirrorModel.docComment.description);
|
|
41
|
+
}
|
|
33
42
|
markdownFile.addBlankLine();
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
} else {
|
|
44
|
+
let annotations = '';
|
|
45
|
+
const hasAnnotations = !!mirrorModel.annotations.length;
|
|
46
|
+
if (hasAnnotations) {
|
|
47
|
+
annotations += ' [';
|
|
48
|
+
}
|
|
49
|
+
mirrorModel.annotations.forEach((annotation) => {
|
|
50
|
+
annotations += `\`${annotation.type.toUpperCase()}\` `;
|
|
51
|
+
});
|
|
52
|
+
if (hasAnnotations) {
|
|
53
|
+
annotations += ']';
|
|
54
|
+
}
|
|
36
55
|
|
|
37
|
-
|
|
56
|
+
// If grouped we want to display these as a list
|
|
57
|
+
let description = '';
|
|
58
|
+
if (mirrorModel.docComment?.description) {
|
|
59
|
+
description = ` - ${mirrorModel.docComment?.description}`;
|
|
60
|
+
}
|
|
61
|
+
markdownFile.addListItem(`\`${mirrorModel.name}\` → \`${mirrorModel.type}\`${annotations} ${description}`);
|
|
38
62
|
markdownFile.addBlankLine();
|
|
39
|
-
markdownFile.addText(propertyModel.docComment.description);
|
|
40
63
|
}
|
|
41
|
-
markdownFile.addBlankLine();
|
|
42
64
|
}
|
|
@@ -4,13 +4,11 @@ import { ParameterMirror } from '@cparra/apex-reflection/index';
|
|
|
4
4
|
import { addCustomDocCommentAnnotations } from './doc-comment-annotation-util';
|
|
5
5
|
|
|
6
6
|
export function declareMethod(
|
|
7
|
-
title: string,
|
|
8
7
|
markdownFile: MarkdownFile,
|
|
9
8
|
methods: ConstructorMirror[] | MethodMirror[],
|
|
10
9
|
startingHeadingLevel: number,
|
|
11
10
|
className = '',
|
|
12
11
|
): void {
|
|
13
|
-
markdownFile.addTitle(title, startingHeadingLevel + 1);
|
|
14
12
|
methods.forEach((currentMethod) => {
|
|
15
13
|
const signatureName = isMethod(currentMethod) ? (currentMethod as MethodMirror).name : className;
|
|
16
14
|
markdownFile.addTitle(`\`${buildSignature(signatureName, currentMethod)}\``, startingHeadingLevel + 2);
|
|
@@ -2,9 +2,7 @@ import { MarkdownFile } from '../markdown-file';
|
|
|
2
2
|
import { addCustomDocCommentAnnotations } from './doc-comment-annotation-util';
|
|
3
3
|
import { Annotation, Type } from '@cparra/apex-reflection';
|
|
4
4
|
|
|
5
|
-
export function declareType(markdownFile: MarkdownFile, typeMirror: Type
|
|
6
|
-
markdownFile.addTitle(typeMirror.name, startingHeadingLevel);
|
|
7
|
-
|
|
5
|
+
export function declareType(markdownFile: MarkdownFile, typeMirror: Type): void {
|
|
8
6
|
typeMirror.annotations.forEach((currentAnnotation: Annotation) => {
|
|
9
7
|
markdownFile.addBlankLine();
|
|
10
8
|
markdownFile.addText(`\`${currentAnnotation.type.toUpperCase()}\``);
|
|
@@ -12,6 +12,11 @@ export class MarkdownHomeFile extends MarkdownFile {
|
|
|
12
12
|
this.addTypeEntries(types);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
public addText(text: string, encodeHtml = true) {
|
|
16
|
+
text = MarkdownFile.replaceInlineLinks(text);
|
|
17
|
+
super.addText(text, encodeHtml);
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
private addTypeEntries(types: Type[]) {
|
|
16
21
|
const groupedClasses: Map<string, Type[]> = this.group(types);
|
|
17
22
|
groupedClasses.forEach((value: Type[], key: string) => {
|
|
@@ -24,12 +29,9 @@ export class MarkdownHomeFile extends MarkdownFile {
|
|
|
24
29
|
|
|
25
30
|
private addTypeEntry(typeMirror: Type) {
|
|
26
31
|
this.addBlankLine();
|
|
27
|
-
this.addTitle(ClassFileGeneratorHelper.getFileLink(typeMirror),
|
|
28
|
-
this.addBlankLine();
|
|
32
|
+
this.addTitle(ClassFileGeneratorHelper.getFileLink(typeMirror), 3);
|
|
29
33
|
this.addBlankLine();
|
|
30
34
|
this.addText(typeMirror.docComment?.description ?? '');
|
|
31
|
-
this.addBlankLine();
|
|
32
|
-
this.addBlankLine();
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
private group(classes: Type[]): Map<string, Type[]> {
|
|
@@ -43,6 +45,8 @@ export class MarkdownHomeFile extends MarkdownFile {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
private getClassGroup(classModel: Type): string {
|
|
46
|
-
return
|
|
48
|
+
return (
|
|
49
|
+
classModel.docComment?.annotations.find((annotation) => annotation.name === 'group')?.body ?? 'Miscellaneous'
|
|
50
|
+
);
|
|
47
51
|
}
|
|
48
52
|
}
|
|
@@ -14,8 +14,16 @@ import { MarkdownFile } from './markdown-file';
|
|
|
14
14
|
import { declareType, declareMethod, declareField } from './markdown-generation-util';
|
|
15
15
|
import ClassFileGeneratorHelper from '../transpiler/markdown/class-file-generatorHelper';
|
|
16
16
|
|
|
17
|
+
interface GroupAware {
|
|
18
|
+
group?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface GroupMap {
|
|
22
|
+
[key: string]: GroupAware[];
|
|
23
|
+
}
|
|
24
|
+
|
|
17
25
|
export class MarkdownTypeFile extends MarkdownFile implements WalkerListener {
|
|
18
|
-
constructor(public type: Type, public
|
|
26
|
+
constructor(public type: Type, public headingLevel: number = 1, headerContent?: string) {
|
|
19
27
|
super(`${type.name}`, ClassFileGeneratorHelper.getSanitizedGroup(type));
|
|
20
28
|
if (headerContent) {
|
|
21
29
|
this.addText(headerContent);
|
|
@@ -25,28 +33,33 @@ export class MarkdownTypeFile extends MarkdownFile implements WalkerListener {
|
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
public addText(text: string, encodeHtml = true) {
|
|
28
|
-
text =
|
|
36
|
+
text = MarkdownFile.replaceInlineLinks(text);
|
|
29
37
|
super.addText(text, encodeHtml);
|
|
30
38
|
}
|
|
31
39
|
|
|
32
|
-
public onTypeDeclaration(typeMirror: Type
|
|
33
|
-
|
|
40
|
+
public onTypeDeclaration(typeMirror: Type): void {
|
|
41
|
+
this.addTitle(typeMirror.name, this.headingLevel);
|
|
42
|
+
declareType(this, typeMirror);
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
public onConstructorDeclaration(className: string, constructors: ConstructorMirror[]): void {
|
|
37
|
-
|
|
46
|
+
this.addTitle('Constructors', this.headingLevel + 1);
|
|
47
|
+
this.declareMethodWithGroupings(constructors, className);
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
public onFieldsDeclaration(fields: FieldMirror[]): void {
|
|
41
|
-
|
|
51
|
+
this.addTitle('Fields', this.headingLevel + 1);
|
|
52
|
+
this.declareFieldOrProperty(fields);
|
|
42
53
|
}
|
|
43
54
|
|
|
44
55
|
public onPropertiesDeclaration(properties: PropertyMirror[]): void {
|
|
45
|
-
|
|
56
|
+
this.addTitle('Properties', this.headingLevel + 1);
|
|
57
|
+
this.declareFieldOrProperty(properties);
|
|
46
58
|
}
|
|
47
59
|
|
|
48
60
|
public onMethodsDeclaration(methods: MethodMirror[]): void {
|
|
49
|
-
|
|
61
|
+
this.addTitle('Methods', this.headingLevel + 1);
|
|
62
|
+
this.declareMethodWithGroupings(methods);
|
|
50
63
|
}
|
|
51
64
|
|
|
52
65
|
public onInnerEnumsDeclaration(enums: EnumMirror[]): void {
|
|
@@ -62,7 +75,7 @@ export class MarkdownTypeFile extends MarkdownFile implements WalkerListener {
|
|
|
62
75
|
}
|
|
63
76
|
|
|
64
77
|
private addInnerTypes(title: string, types: Type[], addSeparator = true) {
|
|
65
|
-
this.addTitle(title, this.
|
|
78
|
+
this.addTitle(title, this.headingLevel + 1);
|
|
66
79
|
types
|
|
67
80
|
.sort((typeA, typeB) => {
|
|
68
81
|
if (typeA.name < typeB.name) return -1;
|
|
@@ -70,7 +83,7 @@ export class MarkdownTypeFile extends MarkdownFile implements WalkerListener {
|
|
|
70
83
|
return 0;
|
|
71
84
|
})
|
|
72
85
|
.forEach((currentType) => {
|
|
73
|
-
const innerFile = new MarkdownTypeFile(currentType, this.
|
|
86
|
+
const innerFile = new MarkdownTypeFile(currentType, this.headingLevel + 2);
|
|
74
87
|
this.addText(innerFile._contents);
|
|
75
88
|
});
|
|
76
89
|
if (addSeparator) {
|
|
@@ -78,30 +91,56 @@ export class MarkdownTypeFile extends MarkdownFile implements WalkerListener {
|
|
|
78
91
|
}
|
|
79
92
|
}
|
|
80
93
|
|
|
81
|
-
private
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
match = expression.exec(text);
|
|
97
|
-
if (match) {
|
|
98
|
-
matches.push(match);
|
|
94
|
+
private hasGroupings(groupAware: GroupAware[]): boolean {
|
|
95
|
+
return !!groupAware.find((current) => !!current.group);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private declareMethodWithGroupings(methods: ConstructorMirror[] | MethodMirror[], className = ''): void {
|
|
99
|
+
const hasGroupings = this.hasGroupings(methods);
|
|
100
|
+
if (!hasGroupings) {
|
|
101
|
+
declareMethod(this, methods, this.headingLevel, className);
|
|
102
|
+
} else {
|
|
103
|
+
const groupedConstructors = this.group(methods);
|
|
104
|
+
for (const key in groupedConstructors) {
|
|
105
|
+
this.startGroup(key);
|
|
106
|
+
const constructorsForGroup = groupedConstructors[key] as ConstructorMirror[];
|
|
107
|
+
declareMethod(this, constructorsForGroup, this.headingLevel, className);
|
|
108
|
+
this.endGroup();
|
|
99
109
|
}
|
|
100
|
-
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
101
112
|
|
|
102
|
-
|
|
103
|
-
|
|
113
|
+
private declareFieldOrProperty(fieldsOrProperties: FieldMirror[] | PropertyMirror[]): void {
|
|
114
|
+
const hasGroupings = this.hasGroupings(fieldsOrProperties);
|
|
115
|
+
if (!hasGroupings) {
|
|
116
|
+
declareField(this, fieldsOrProperties, this.headingLevel, false);
|
|
117
|
+
} else {
|
|
118
|
+
const groupedFields = this.group(fieldsOrProperties);
|
|
119
|
+
for (const key in groupedFields) {
|
|
120
|
+
this.startGroup(key);
|
|
121
|
+
const fieldsForGroup = groupedFields[key] as FieldMirror[];
|
|
122
|
+
declareField(this, fieldsForGroup, this.headingLevel, true);
|
|
123
|
+
this.endGroup();
|
|
124
|
+
}
|
|
104
125
|
}
|
|
105
|
-
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private startGroup(groupName: string) {
|
|
129
|
+
this.headingLevel = this.headingLevel + 2;
|
|
130
|
+
this.addTitle(groupName, this.headingLevel);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private endGroup() {
|
|
134
|
+
this.headingLevel = this.headingLevel - 2;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
private group(list: GroupAware[]) {
|
|
138
|
+
return list.reduce((groups: GroupMap, item) => {
|
|
139
|
+
const groupName: string = item.group ?? 'Other';
|
|
140
|
+
const group: GroupAware[] = groups[groupName] || [];
|
|
141
|
+
group.push(item);
|
|
142
|
+
groups[groupName] = group;
|
|
143
|
+
return groups;
|
|
144
|
+
}, {});
|
|
106
145
|
}
|
|
107
146
|
}
|