@cparra/apexdocs 2.5.0 → 2.6.0-alpha.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/docs/README.md +1 -1
- package/docs/ts/GroupedClass.d.ts +3 -0
- package/docs/ts/SampleClass.d.ts +11 -0
- package/docs/ts/SampleInterface.d.ts +0 -0
- package/lib/cli/generate.js +2 -2
- package/lib/cli/generate.js.map +1 -1
- package/lib/model/ts-definition-file.d.ts +26 -0
- package/lib/model/ts-definition-file.js +137 -0
- package/lib/model/ts-definition-file.js.map +1 -0
- package/lib/settings.d.ts +1 -1
- package/lib/settings.js +4 -0
- package/lib/settings.js.map +1 -1
- package/lib/transpiler/markdown/class-file-generatorHelper.js.map +1 -1
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.d.ts +1 -2
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.js.map +1 -1
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.d.ts +1 -2
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js.map +1 -1
- package/lib/transpiler/markdown/markdown-transpiler-base.d.ts +2 -0
- package/lib/transpiler/markdown/markdown-transpiler-base.js.map +1 -1
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.d.ts +1 -2
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js.map +1 -1
- package/lib/transpiler/processor-type-transpiler.d.ts +0 -2
- package/lib/transpiler/processor-type-transpiler.js.map +1 -1
- package/lib/transpiler/ts-types/TsTypesTranspiler.d.ts +9 -0
- package/lib/transpiler/ts-types/TsTypesTranspiler.js +23 -0
- package/lib/transpiler/ts-types/TsTypesTranspiler.js.map +1 -0
- package/package.json +3 -2
- package/src/cli/generate.ts +2 -2
- package/src/model/ts-definition-file.ts +165 -0
- package/src/settings.ts +6 -1
- package/src/transpiler/markdown/class-file-generatorHelper.ts +2 -1
- package/src/transpiler/markdown/docsify/docsify-docs-processor.ts +1 -2
- package/src/transpiler/markdown/jekyll/jekyll-docsProcessor.ts +1 -2
- package/src/transpiler/markdown/markdown-transpiler-base.ts +4 -0
- package/src/transpiler/markdown/plain-markdown/plain-docsProcessor.ts +1 -2
- package/src/transpiler/processor-type-transpiler.ts +0 -4
- package/src/transpiler/ts-types/TsTypesTranspiler.ts +24 -0
package/docs/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Uses a block style apex doc
|
|
|
10
10
|
This is a class description. This class relates to [SampleInterface](/Sample-Interfaces/SampleInterface.md) But this [ClassThatDoesNotExist](ClassThatDoesNotExist) does not exist. You can also link using this syntax [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
11
11
|
## Miscellaneous
|
|
12
12
|
|
|
13
|
-
### [SampleClassWithoutModifier](/
|
|
13
|
+
### [SampleClassWithoutModifier](/Miscellaneous/SampleClassWithoutModifier.md)
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
## Sample Interfaces
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} SampleClass This is a class description. This class relates to {@link SampleInterface} But this {@link ClassThatDoesNotExist} does not exist. You can also link using this syntax <<SampleInterface>>
|
|
3
|
+
* @property {number} AnotherProp This is a Decimal property.
|
|
4
|
+
* @property {string} MyProp This is a String property.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} AnotherInnerClass Inner class belonging to SampleClass.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Object} InnerClass Inner class belonging to SampleClass.
|
|
11
|
+
*/
|
|
File without changes
|
package/lib/cli/generate.js
CHANGED
|
@@ -34,8 +34,8 @@ const argv = yargs.options({
|
|
|
34
34
|
type: 'string',
|
|
35
35
|
alias: 'g',
|
|
36
36
|
default: 'jekyll',
|
|
37
|
-
choices: ['jekyll', 'docsify', 'plain-markdown'],
|
|
38
|
-
describe: 'Define the static file generator for which the documents will be created. Currently supports jekyll, docsify, and
|
|
37
|
+
choices: ['jekyll', 'docsify', 'plain-markdown', 'ts-def'],
|
|
38
|
+
describe: 'Define the static file generator for which the documents will be created. Currently supports jekyll, docsify, plain markdown, and Typescript type definitions.',
|
|
39
39
|
},
|
|
40
40
|
indexOnly: {
|
|
41
41
|
type: 'boolean',
|
package/lib/cli/generate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/cli/generate.ts"],"names":[],"mappings":";;;AACA,+BAA+B;AAE/B,0CAAyD;AACzD,sDAAmD;AAEnD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC;IACzB,SAAS,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,+DAA+D;KAC1E;IACD,SAAS,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE,kEAAkE;KAC7E;IACD,SAAS,EAAE;QACT,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,kFAAkF;KAC7F;IACD,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,CAAC,QAAQ,CAAC;QACnB,QAAQ,EACN,sHAAsH;YACtH,0HAA0H;KAC7H;IACD,eAAe,EAAE;QACf,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/cli/generate.ts"],"names":[],"mappings":";;;AACA,+BAA+B;AAE/B,0CAAyD;AACzD,sDAAmD;AAEnD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC;IACzB,SAAS,EA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,mBAAQ,CAAC,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { File } from './file';
|
|
2
|
+
import { WalkerListener } from '../service/walkers/walker';
|
|
3
|
+
import { ClassMirror, ConstructorMirror, EnumMirror, FieldMirror, InterfaceMirror, MethodMirror, PropertyMirror, Type } from '@cparra/apex-reflection';
|
|
4
|
+
export default class TsDefinitionFile extends File implements WalkerListener {
|
|
5
|
+
fileExtension(): string;
|
|
6
|
+
constructor(typeMirror: Type);
|
|
7
|
+
onConstructorDeclaration(className: string, constructors: ConstructorMirror[]): void;
|
|
8
|
+
onFieldsDeclaration(fields: FieldMirror[]): void;
|
|
9
|
+
onInnerClassesDeclaration(classes: ClassMirror[]): void;
|
|
10
|
+
onInnerEnumsDeclaration(enums: EnumMirror[]): void;
|
|
11
|
+
onInnerInterfacesDeclaration(interfaces: InterfaceMirror[]): void;
|
|
12
|
+
onMethodsDeclaration(methods: MethodMirror[]): void;
|
|
13
|
+
onPropertiesDeclaration(properties: PropertyMirror[]): void;
|
|
14
|
+
onTypeDeclaration(typeMirror: Type): void;
|
|
15
|
+
private addPropertiesAndFields;
|
|
16
|
+
private addInnerClasses;
|
|
17
|
+
addBlankLine(): void;
|
|
18
|
+
initializeBlock(): void;
|
|
19
|
+
finalizeBlock(): void;
|
|
20
|
+
declareType(className: string, docDescription: string): void;
|
|
21
|
+
declareProperty(propertyType: string, propertyName: string, docDescription: string): void;
|
|
22
|
+
sanitizeApexPropertyToJavascript(propertyType: string): string;
|
|
23
|
+
isListProperty(propertyType: string): true | undefined;
|
|
24
|
+
extractTypeFromList(propertyType: string): string;
|
|
25
|
+
replaceAll(sourceString: string, strReplace: string, strWith: string): string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const file_1 = require("./file");
|
|
4
|
+
const walker_factory_1 = require("../service/walkers/walker-factory");
|
|
5
|
+
class TsDefinitionFile extends file_1.File {
|
|
6
|
+
fileExtension() {
|
|
7
|
+
return '.d.ts';
|
|
8
|
+
}
|
|
9
|
+
constructor(typeMirror) {
|
|
10
|
+
super(typeMirror.name, '');
|
|
11
|
+
const walker = walker_factory_1.WalkerFactory.get(typeMirror);
|
|
12
|
+
walker.walk(this);
|
|
13
|
+
}
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
15
|
+
onConstructorDeclaration(className, constructors) { }
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
17
|
+
onFieldsDeclaration(fields) { }
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
19
|
+
onInnerClassesDeclaration(classes) { }
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
21
|
+
onInnerEnumsDeclaration(enums) { }
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
23
|
+
onInnerInterfacesDeclaration(interfaces) { }
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
25
|
+
onMethodsDeclaration(methods) { }
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
27
|
+
onPropertiesDeclaration(properties) { }
|
|
28
|
+
onTypeDeclaration(typeMirror) {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
this.initializeBlock();
|
|
31
|
+
this.declareType(typeMirror.name, (_b = (_a = typeMirror.docComment) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : '');
|
|
32
|
+
this.addPropertiesAndFields(typeMirror);
|
|
33
|
+
// TODO: Auraenabled method support
|
|
34
|
+
// TODO: Remember that methods with getX and setX lose the get and set
|
|
35
|
+
// TODO: Classes that dont have any auraenabled things should be skipped
|
|
36
|
+
this.finalizeBlock();
|
|
37
|
+
this.addInnerClasses(typeMirror);
|
|
38
|
+
}
|
|
39
|
+
addPropertiesAndFields(typeMirror) {
|
|
40
|
+
const classModel = typeMirror;
|
|
41
|
+
if (classModel.properties.length === 0 && classModel.fields.length === 0) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const propertiesAndFields = [...classModel.properties, ...classModel.fields].filter((e) => e.annotations.findIndex((a) => a.name === 'auraenabled') !== -1);
|
|
45
|
+
propertiesAndFields
|
|
46
|
+
.sort((propA, propB) => {
|
|
47
|
+
if (propA.name < propB.name)
|
|
48
|
+
return -1;
|
|
49
|
+
if (propA.name > propB.name)
|
|
50
|
+
return 1;
|
|
51
|
+
return 0;
|
|
52
|
+
})
|
|
53
|
+
.forEach((propertyModel) => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
this.declareProperty(propertyModel.type, propertyModel.name, (_b = (_a = propertyModel.docComment) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : '');
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
addInnerClasses(typeMirror) {
|
|
59
|
+
const classModel = typeMirror;
|
|
60
|
+
if (classModel.classes.length > 0) {
|
|
61
|
+
classModel.classes
|
|
62
|
+
.sort((classA, classB) => {
|
|
63
|
+
if (classA.name < classB.name)
|
|
64
|
+
return -1;
|
|
65
|
+
if (classA.name > classB.name)
|
|
66
|
+
return 1;
|
|
67
|
+
return 0;
|
|
68
|
+
})
|
|
69
|
+
.forEach((innerClass) => {
|
|
70
|
+
this.onTypeDeclaration(innerClass);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
addBlankLine() {
|
|
75
|
+
this._contents += '\n';
|
|
76
|
+
}
|
|
77
|
+
initializeBlock() {
|
|
78
|
+
this._contents += '/**';
|
|
79
|
+
this.addBlankLine();
|
|
80
|
+
}
|
|
81
|
+
finalizeBlock() {
|
|
82
|
+
this._contents += ' */';
|
|
83
|
+
this.addBlankLine();
|
|
84
|
+
}
|
|
85
|
+
declareType(className, docDescription) {
|
|
86
|
+
this._contents += ` * @typedef {Object} ${className} ${docDescription}`;
|
|
87
|
+
this.addBlankLine();
|
|
88
|
+
}
|
|
89
|
+
declareProperty(propertyType, propertyName, docDescription) {
|
|
90
|
+
let sanitizedType;
|
|
91
|
+
// First we check if we are dealing with a list
|
|
92
|
+
if (this.isListProperty(propertyType)) {
|
|
93
|
+
// If we are then we first extract the type from the list
|
|
94
|
+
sanitizedType = this.extractTypeFromList(propertyType);
|
|
95
|
+
// then sanitize it
|
|
96
|
+
sanitizedType = this.sanitizeApexPropertyToJavascript(sanitizedType);
|
|
97
|
+
// and then we add brackets ([])
|
|
98
|
+
sanitizedType = sanitizedType + '[]';
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
sanitizedType = this.sanitizeApexPropertyToJavascript(propertyType);
|
|
102
|
+
}
|
|
103
|
+
this._contents += ` * @property {${sanitizedType}} ${propertyName} ${docDescription}`;
|
|
104
|
+
this.addBlankLine();
|
|
105
|
+
}
|
|
106
|
+
sanitizeApexPropertyToJavascript(propertyType) {
|
|
107
|
+
const lowerPropertyType = propertyType.toLowerCase();
|
|
108
|
+
if (lowerPropertyType === 'decimal' || lowerPropertyType === 'integer' || lowerPropertyType === 'double') {
|
|
109
|
+
return 'number';
|
|
110
|
+
}
|
|
111
|
+
if (lowerPropertyType === 'boolean' || lowerPropertyType === 'string') {
|
|
112
|
+
// If it is a built-in type then we return the lower-cased version.
|
|
113
|
+
return lowerPropertyType;
|
|
114
|
+
}
|
|
115
|
+
// Otherwise, we respect casing
|
|
116
|
+
return propertyType;
|
|
117
|
+
}
|
|
118
|
+
isListProperty(propertyType) {
|
|
119
|
+
const lowerPropertyType = propertyType.toLowerCase();
|
|
120
|
+
if (lowerPropertyType.includes('<') && lowerPropertyType.includes('list')) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
extractTypeFromList(propertyType) {
|
|
125
|
+
const propertyWithoutList = this.replaceAll(propertyType, 'list', '');
|
|
126
|
+
return propertyWithoutList.replace('list', '').replace('<', '').replace('>', '');
|
|
127
|
+
}
|
|
128
|
+
// Case insensitive replace
|
|
129
|
+
replaceAll(sourceString, strReplace, strWith) {
|
|
130
|
+
// See http://stackoverflow.com/a/3561711/556609
|
|
131
|
+
const esc = strReplace.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
132
|
+
const reg = new RegExp(esc, 'ig');
|
|
133
|
+
return sourceString.replace(reg, strWith);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.default = TsDefinitionFile;
|
|
137
|
+
//# sourceMappingURL=ts-definition-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-definition-file.js","sourceRoot":"","sources":["../../src/model/ts-definition-file.ts"],"names":[],"mappings":";;AAAA,iCAA8B;AAY9B,sEAAkE;AAElE,MAAqB,gBAAiB,SAAQ,WAAI;IAChD,aAAa;QACX,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,YAAY,UAAgB;QAC1B,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC3B,MAAM,MAAM,GAAG,8BAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,gEAAgE;IAChE,wBAAwB,CAAC,SAAiB,EAAE,YAAiC,IAAS,CAAC;IAEvF,gEAAgE;IAChE,mBAAmB,CAAC,MAAqB,IAAS,CAAC;IAEnD,gEAAgE;IAChE,yBAAyB,CAAC,OAAsB,IAAS,CAAC;IAE1D,gEAAgE;IAChE,uBAAuB,CAAC,KAAmB,IAAS,CAAC;IAErD,gEAAgE;IAChE,4BAA4B,CAAC,UAA6B,IAAS,CAAC;IAEpE,gEAAgE;IAChE,oBAAoB,CAAC,OAAuB,IAAS,CAAC;IAEtD,gEAAgE;IAChE,uBAAuB,CAAC,UAA4B,IAAS,CAAC;IAE9D,iBAAiB,CAAC,UAAgB;;QAChC,IAAI,CAAC,eAAe,EA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C,YAAoB,EAAE,UAAkB,EAAE,OAAe;QAClE,gDAAgD;QAChD,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;QACjE,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAClC,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF;AAtJD,mCAsJC"}
|
package/lib/settings.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ProcessorTypeTranspiler from './transpiler/processor-type-transpiler';
|
|
2
|
-
export declare type GeneratorChoices = 'jekyll' | 'docsify' | 'plain-markdown';
|
|
2
|
+
export declare type GeneratorChoices = 'jekyll' | 'docsify' | 'plain-markdown' | 'ts-def';
|
|
3
3
|
export interface SettingsConfig {
|
|
4
4
|
sourceDirectory: string;
|
|
5
5
|
recursive: boolean;
|
package/lib/settings.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.Settings = void 0;
|
|
|
4
4
|
const jekyll_docsProcessor_1 = require("./transpiler/markdown/jekyll/jekyll-docsProcessor");
|
|
5
5
|
const docsify_docs_processor_1 = require("./transpiler/markdown/docsify/docsify-docs-processor");
|
|
6
6
|
const plain_docsProcessor_1 = require("./transpiler/markdown/plain-markdown/plain-docsProcessor");
|
|
7
|
+
const TsTypesTranspiler_1 = require("./transpiler/ts-types/TsTypesTranspiler");
|
|
7
8
|
class Settings {
|
|
8
9
|
constructor(config) {
|
|
9
10
|
this.config = config;
|
|
@@ -43,6 +44,9 @@ class Settings {
|
|
|
43
44
|
case 'plain-markdown':
|
|
44
45
|
Settings.typeTranspilerCache = new plain_docsProcessor_1.PlainMarkdownDocsProcessor();
|
|
45
46
|
return Settings.typeTranspilerCache;
|
|
47
|
+
case 'ts-def':
|
|
48
|
+
Settings.typeTranspilerCache = new TsTypesTranspiler_1.TsTypesTranspiler();
|
|
49
|
+
return Settings.typeTranspilerCache;
|
|
46
50
|
default:
|
|
47
51
|
throw Error('Invalid target generator');
|
|
48
52
|
}
|
package/lib/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AACA,4FAAwF;AACxF,iGAAwF;AACxF,kGAAsG;
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AACA,4FAAwF;AACxF,iGAAwF;AACxF,kGAAsG;AACtG,+EAA4E;AAc5E,MAAa,QAAQ;IAGnB,YAA2B,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IAE9C,MAAM,CAAC,KAAK,CAAC,MAAsB;QACxC,QAAQ,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAEM,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;SACtD;QACD,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;IACrC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAID,IAAI,cAAc;QAChB,IAAI,QAAQ,CAAC,mBAAmB,EAAE;YAChC,OAAO,QAAQ,CAAC,mBAAmB,CAAC;SACrC;QACD,QAAQ,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE;YACnC,KAAK,QAAQ;gBACX,QAAQ,CAAC,mBAAmB,GAAG,IAAI,0CAAmB,EAAE,CAAC;gBACzD,OAAO,QAAQ,CAAC,mBAAmB,CAAC;YACtC,KAAK,SAAS;gBACZ,QAAQ,CAAC,mBAAmB,GAAG,IAAI,gCAAoB,EAAE,CAAC;gBAC1D,OAAO,QAAQ,CAAC,mBAAmB,CAAC;YACtC,KAAK,gBAAgB;gBACnB,QAAQ,CAAC,mBAAmB,GAAG,IAAI,gDAA0B,EAAE,CAAC;gBAChE,OAAO,QAAQ,CAAC,mBAAmB,CAAC;YACtC,KAAK,QAAQ;gBACX,QAAQ,CAAC,mBAAmB,GAAG,IAAI,qCAAiB,EAAE,CAAC;gBACvD,OAAO,QAAQ,CAAC,mBAAmB,CAAC;YACtC;gBACE,MAAM,KAAK,CAAC,0BAA0B,CAAC,CAAC;SAC3C;IACH,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAEM,mBAAmB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;IACtC,CAAC;CACF;AA/DD,4BA+DC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-file-generatorHelper.js","sourceRoot":"","sources":["../../../src/transpiler/markdown/class-file-generatorHelper.ts"],"names":[],"mappings":";;AACA,mEAA+D;AAC/D,6CAA0C;AAC1C,+CAAwC;
|
|
1
|
+
{"version":3,"file":"class-file-generatorHelper.js","sourceRoot":"","sources":["../../../src/transpiler/markdown/class-file-generatorHelper.ts"],"names":[],"mappings":";;AACA,mEAA+D;AAC/D,6CAA0C;AAC1C,+CAAwC;AAGxC,MAAqB,wBAAwB;IACpC,MAAM,CAAC,iBAAiB,CAAC,UAAgB;QAC9C,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IA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;;QAC3C,MAAM,eAAe,SAAG,UAAU,CAAC,UAAU,0CAAE,WAAW,CAAC,IAAI,CAC7D,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO,CAC1D,CAAC;QACF,aAAO,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI,mCAAI,mBAAQ,CAAC,WAAW,EAAE,CAAC,mBAAmB,EAAE,CAAC;IAC/E,CAAC;CACF;AAhDD,2CAgDC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
|
-
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
1
|
+
import { LinkingStrategy, MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
3
2
|
export default class DocsifyDocsProcessor extends MarkdownTranspilerBase {
|
|
4
3
|
homeFileName(): string;
|
|
5
4
|
getLinkingStrategy(): LinkingStrategy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docsify-docs-processor.js","sourceRoot":"","sources":["../../../../src/transpiler/markdown/docsify/docsify-docs-processor.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"docsify-docs-processor.js","sourceRoot":"","sources":["../../../../src/transpiler/markdown/docsify/docsify-docs-processor.ts"],"names":[],"mappings":";;AAAA,0EAAsF;AAEtF,MAAqB,oBAAqB,SAAQ,iDAAsB;IACtE,YAAY;QACV,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,kBAAkB;QAChB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AARD,uCAQC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
1
|
+
import { LinkingStrategy, MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
2
|
import { Type } from '@cparra/apex-reflection';
|
|
3
|
-
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
4
3
|
export declare class JekyllDocsProcessor extends MarkdownTranspilerBase {
|
|
5
4
|
homeFileName(): string;
|
|
6
5
|
onBeforeProcess: (types: Type[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jekyll-docsProcessor.js","sourceRoot":"","sources":["../../../../src/transpiler/markdown/jekyll/jekyll-docsProcessor.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"jekyll-docsProcessor.js","sourceRoot":"","sources":["../../../../src/transpiler/markdown/jekyll/jekyll-docsProcessor.ts"],"names":[],"mappings":";;;AAAA,0EAAsF;AAEtF,0EAAqE;AACrE,0EAAqE;AAErE,MAAa,mBAAoB,SAAQ,iDAAsB;IAA/D;;QAKE,oBAAe,GAAG,CAAC,KAAa,EAAE,EAAE;YAClC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,qCAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACzG,CAAC,CAAC;IAaJ,CAAC;IAnBC,YAAY;QACV,OAAO,OAAO,CAAC;IACjB,CAAC;IAMD,SAAS,CAAC,IAAU;QAClB,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,qCAAgB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACtF,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,2BAA2B,CAAC;IACrC,CAAC;IAED,kBAAkB;QAChB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AApBD,kDAoBC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ProcessorTypeTranspiler from '../processor-type-transpiler';
|
|
2
2
|
import { Type } from '@cparra/apex-reflection';
|
|
3
3
|
import { FileContainer } from '../file-container';
|
|
4
|
+
export declare type LinkingStrategy = 'root-relative' | 'path-relative';
|
|
4
5
|
export declare abstract class MarkdownTranspilerBase extends ProcessorTypeTranspiler {
|
|
5
6
|
protected readonly _fileContainer: FileContainer;
|
|
6
7
|
constructor();
|
|
@@ -8,4 +9,5 @@ export declare abstract class MarkdownTranspilerBase extends ProcessorTypeTransp
|
|
|
8
9
|
fileBuilder(): FileContainer;
|
|
9
10
|
onBeforeProcess: (types: Type[]) => void;
|
|
10
11
|
onProcess(type: Type): void;
|
|
12
|
+
abstract getLinkingStrategy(): LinkingStrategy;
|
|
11
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-transpiler-base.js","sourceRoot":"","sources":["../../../src/transpiler/markdown/markdown-transpiler-base.ts"],"names":[],"mappings":";;;AAAA,4EAAmE;AAEnE,sDAAkD;AAClD,uEAAkE;AAClE,uEAAkE;
|
|
1
|
+
{"version":3,"file":"markdown-transpiler-base.js","sourceRoot":"","sources":["../../../src/transpiler/markdown/markdown-transpiler-base.ts"],"names":[],"mappings":";;;AAAA,4EAAmE;AAEnE,sDAAkD;AAClD,uEAAkE;AAClE,uEAAkE;AAIlE,MAAsB,sBAAuB,SAAQ,mCAAuB;IAG1E;QACE,KAAK,EAAE,CAAC;QAUV,oBAAe,GAAG,CAAC,KAAa,EAAE,EAAE;YAClC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,qCAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;QACjF,CAAC,CAAC;QAXA,IAAI,CAAC,cAAc,GAAG,IAAI,8BAAa,EAAE,CAAC;IAC5C,CAAC;IAID,WAAW;QACT,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAMD,SAAS,CAAC,IAAU;QAClB,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,qCAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;CAGF;AAvBD,wDAuBC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
|
-
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
1
|
+
import { LinkingStrategy, MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
3
2
|
export declare class PlainMarkdownDocsProcessor extends MarkdownTranspilerBase {
|
|
4
3
|
homeFileName(): string;
|
|
5
4
|
getLinkingStrategy(): LinkingStrategy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plain-docsProcessor.js","sourceRoot":"","sources":["../../../../src/transpiler/markdown/plain-markdown/plain-docsProcessor.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"plain-docsProcessor.js","sourceRoot":"","sources":["../../../../src/transpiler/markdown/plain-markdown/plain-docsProcessor.ts"],"names":[],"mappings":";;;AAAA,0EAAsF;AAEtF,MAAa,0BAA2B,SAAQ,iDAAsB;IACpE,YAAY;QACV,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,kBAAkB;QAChB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AARD,gEAQC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Type } from '@cparra/apex-reflection';
|
|
2
2
|
import { FileContainer } from './file-container';
|
|
3
|
-
export declare type LinkingStrategy = 'root-relative' | 'path-relative';
|
|
4
3
|
export default abstract class ProcessorTypeTranspiler {
|
|
5
4
|
onBeforeProcess: ((types: Type[]) => void) | undefined;
|
|
6
5
|
abstract onProcess(type: Type): void;
|
|
7
6
|
onAfterProcess: ((types: Type[]) => void) | undefined;
|
|
8
7
|
abstract fileBuilder(): FileContainer;
|
|
9
|
-
abstract getLinkingStrategy(): LinkingStrategy;
|
|
10
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor-type-transpiler.js","sourceRoot":"","sources":["../../src/transpiler/processor-type-transpiler.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"processor-type-transpiler.js","sourceRoot":"","sources":["../../src/transpiler/processor-type-transpiler.ts"],"names":[],"mappings":";;AAGA,MAA8B,uBAAuB;CAQpD;AARD,0CAQC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import ProcessorTypeTranspiler from '../processor-type-transpiler';
|
|
2
|
+
import { Type } from '@cparra/apex-reflection';
|
|
3
|
+
import { FileContainer } from '../file-container';
|
|
4
|
+
export declare class TsTypesTranspiler extends ProcessorTypeTranspiler {
|
|
5
|
+
protected readonly _fileContainer: FileContainer;
|
|
6
|
+
constructor();
|
|
7
|
+
fileBuilder(): FileContainer;
|
|
8
|
+
onProcess(type: Type): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TsTypesTranspiler = void 0;
|
|
4
|
+
const processor_type_transpiler_1 = require("../processor-type-transpiler");
|
|
5
|
+
const file_container_1 = require("../file-container");
|
|
6
|
+
const ts_definition_file_1 = require("../../model/ts-definition-file");
|
|
7
|
+
class TsTypesTranspiler extends processor_type_transpiler_1.default {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this._fileContainer = new file_container_1.FileContainer();
|
|
11
|
+
}
|
|
12
|
+
fileBuilder() {
|
|
13
|
+
return this._fileContainer;
|
|
14
|
+
}
|
|
15
|
+
onProcess(type) {
|
|
16
|
+
if (type.type_name !== 'class') {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
this._fileContainer.pushFile(new ts_definition_file_1.default(type));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.TsTypesTranspiler = TsTypesTranspiler;
|
|
23
|
+
//# sourceMappingURL=TsTypesTranspiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsTypesTranspiler.js","sourceRoot":"","sources":["../../../src/transpiler/ts-types/TsTypesTranspiler.ts"],"names":[],"mappings":";;;AAAA,4EAAmE;AAEnE,sDAAkD;AAClD,uEAA8D;AAE9D,MAAa,iBAAkB,SAAQ,mCAAuB;IAG5D;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,IAAI,8BAAa,EAAE,CAAC;IAC5C,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,SAAS,CAAC,IAAU;QAClB,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE;YAC9B,OAAO;SACR;QACD,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,4BAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF;AAlBD,8CAkBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cparra/apexdocs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0-alpha.0",
|
|
4
4
|
"description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apex",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"docs:init": "docsify init docs",
|
|
26
26
|
"docs:serve": "docsify serve docs",
|
|
27
27
|
"execute:example": "node lib/cli/generate.js -s examples/force-app -t docs --scope global public private -g docsify --defaultGroupName API",
|
|
28
|
-
"execute:example:index:only": "node lib/cli/generate.js -s examples/force-app -t docs --scope global public private -g docsify --indexOnly"
|
|
28
|
+
"execute:example:index:only": "node lib/cli/generate.js -s examples/force-app -t docs --scope global public private -g docsify --indexOnly",
|
|
29
|
+
"execute:example:ts:definitions": "node lib/cli/generate.js -s examples/force-app -t docs/ts --scope global public -g ts-def"
|
|
29
30
|
},
|
|
30
31
|
"author": "Cesar Parra",
|
|
31
32
|
"license": "MIT",
|
package/src/cli/generate.ts
CHANGED
|
@@ -35,9 +35,9 @@ const argv = yargs.options({
|
|
|
35
35
|
type: 'string',
|
|
36
36
|
alias: 'g',
|
|
37
37
|
default: 'jekyll',
|
|
38
|
-
choices: ['jekyll', 'docsify', 'plain-markdown'],
|
|
38
|
+
choices: ['jekyll', 'docsify', 'plain-markdown', 'ts-def'],
|
|
39
39
|
describe:
|
|
40
|
-
'Define the static file generator for which the documents will be created. Currently supports jekyll, docsify, and
|
|
40
|
+
'Define the static file generator for which the documents will be created. Currently supports jekyll, docsify, plain markdown, and Typescript type definitions.',
|
|
41
41
|
},
|
|
42
42
|
indexOnly: {
|
|
43
43
|
type: 'boolean',
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { File } from './file';
|
|
2
|
+
import { WalkerListener } from '../service/walkers/walker';
|
|
3
|
+
import {
|
|
4
|
+
ClassMirror,
|
|
5
|
+
ConstructorMirror,
|
|
6
|
+
EnumMirror,
|
|
7
|
+
FieldMirror,
|
|
8
|
+
InterfaceMirror,
|
|
9
|
+
MethodMirror,
|
|
10
|
+
PropertyMirror,
|
|
11
|
+
Type,
|
|
12
|
+
} from '@cparra/apex-reflection';
|
|
13
|
+
import { WalkerFactory } from '../service/walkers/walker-factory';
|
|
14
|
+
|
|
15
|
+
export default class TsDefinitionFile extends File implements WalkerListener {
|
|
16
|
+
fileExtension(): string {
|
|
17
|
+
return '.d.ts';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
constructor(typeMirror: Type) {
|
|
21
|
+
super(typeMirror.name, '');
|
|
22
|
+
const walker = WalkerFactory.get(typeMirror);
|
|
23
|
+
walker.walk(this);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
27
|
+
onConstructorDeclaration(className: string, constructors: ConstructorMirror[]): void {}
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
30
|
+
onFieldsDeclaration(fields: FieldMirror[]): void {}
|
|
31
|
+
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
33
|
+
onInnerClassesDeclaration(classes: ClassMirror[]): void {}
|
|
34
|
+
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
36
|
+
onInnerEnumsDeclaration(enums: EnumMirror[]): void {}
|
|
37
|
+
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
39
|
+
onInnerInterfacesDeclaration(interfaces: InterfaceMirror[]): void {}
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
42
|
+
onMethodsDeclaration(methods: MethodMirror[]): void {}
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
45
|
+
onPropertiesDeclaration(properties: PropertyMirror[]): void {}
|
|
46
|
+
|
|
47
|
+
onTypeDeclaration(typeMirror: Type): void {
|
|
48
|
+
this.initializeBlock();
|
|
49
|
+
this.declareType(typeMirror.name, typeMirror.docComment?.description ?? '');
|
|
50
|
+
this.addPropertiesAndFields(typeMirror);
|
|
51
|
+
// TODO: Auraenabled method support
|
|
52
|
+
// TODO: Remember that methods with getX and setX lose the get and set
|
|
53
|
+
// TODO: Classes that dont have any auraenabled things should be skipped
|
|
54
|
+
this.finalizeBlock();
|
|
55
|
+
this.addInnerClasses(typeMirror);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private addPropertiesAndFields(typeMirror: Type) {
|
|
59
|
+
const classModel = typeMirror as ClassMirror;
|
|
60
|
+
if (classModel.properties.length === 0 && classModel.fields.length === 0) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const propertiesAndFields = [...classModel.properties, ...classModel.fields].filter(
|
|
65
|
+
(e) => e.annotations.findIndex((a) => a.name === 'auraenabled') !== -1,
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
propertiesAndFields
|
|
69
|
+
.sort((propA, propB) => {
|
|
70
|
+
if (propA.name < propB.name) return -1;
|
|
71
|
+
if (propA.name > propB.name) return 1;
|
|
72
|
+
return 0;
|
|
73
|
+
})
|
|
74
|
+
.forEach((propertyModel) => {
|
|
75
|
+
this.declareProperty(propertyModel.type, propertyModel.name, propertyModel.docComment?.description ?? '');
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private addInnerClasses(typeMirror: Type) {
|
|
80
|
+
const classModel = typeMirror as ClassMirror;
|
|
81
|
+
if (classModel.classes.length > 0) {
|
|
82
|
+
classModel.classes
|
|
83
|
+
.sort((classA, classB) => {
|
|
84
|
+
if (classA.name < classB.name) return -1;
|
|
85
|
+
if (classA.name > classB.name) return 1;
|
|
86
|
+
return 0;
|
|
87
|
+
})
|
|
88
|
+
.forEach((innerClass) => {
|
|
89
|
+
this.onTypeDeclaration(innerClass);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
addBlankLine() {
|
|
95
|
+
this._contents += '\n';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
initializeBlock() {
|
|
99
|
+
this._contents += '/**';
|
|
100
|
+
this.addBlankLine();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
finalizeBlock() {
|
|
104
|
+
this._contents += ' */';
|
|
105
|
+
this.addBlankLine();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declareType(className: string, docDescription: string) {
|
|
109
|
+
this._contents += ` * @typedef {Object} ${className} ${docDescription}`;
|
|
110
|
+
this.addBlankLine();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
declareProperty(propertyType: string, propertyName: string, docDescription: string) {
|
|
114
|
+
let sanitizedType;
|
|
115
|
+
// First we check if we are dealing with a list
|
|
116
|
+
if (this.isListProperty(propertyType)) {
|
|
117
|
+
// If we are then we first extract the type from the list
|
|
118
|
+
sanitizedType = this.extractTypeFromList(propertyType);
|
|
119
|
+
// then sanitize it
|
|
120
|
+
sanitizedType = this.sanitizeApexPropertyToJavascript(sanitizedType);
|
|
121
|
+
// and then we add brackets ([])
|
|
122
|
+
sanitizedType = sanitizedType + '[]';
|
|
123
|
+
} else {
|
|
124
|
+
sanitizedType = this.sanitizeApexPropertyToJavascript(propertyType);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
this._contents += ` * @property {${sanitizedType}} ${propertyName} ${docDescription}`;
|
|
128
|
+
this.addBlankLine();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
sanitizeApexPropertyToJavascript(propertyType: string) {
|
|
132
|
+
const lowerPropertyType = propertyType.toLowerCase();
|
|
133
|
+
if (lowerPropertyType === 'decimal' || lowerPropertyType === 'integer' || lowerPropertyType === 'double') {
|
|
134
|
+
return 'number';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (lowerPropertyType === 'boolean' || lowerPropertyType === 'string') {
|
|
138
|
+
// If it is a built-in type then we return the lower-cased version.
|
|
139
|
+
return lowerPropertyType;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Otherwise, we respect casing
|
|
143
|
+
return propertyType;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
isListProperty(propertyType: string) {
|
|
147
|
+
const lowerPropertyType = propertyType.toLowerCase();
|
|
148
|
+
if (lowerPropertyType.includes('<') && lowerPropertyType.includes('list')) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
extractTypeFromList(propertyType: string) {
|
|
154
|
+
const propertyWithoutList = this.replaceAll(propertyType, 'list', '');
|
|
155
|
+
return propertyWithoutList.replace('list', '').replace('<', '').replace('>', '');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Case insensitive replace
|
|
159
|
+
replaceAll(sourceString: string, strReplace: string, strWith: string) {
|
|
160
|
+
// See http://stackoverflow.com/a/3561711/556609
|
|
161
|
+
const esc = strReplace.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
162
|
+
const reg = new RegExp(esc, 'ig');
|
|
163
|
+
return sourceString.replace(reg, strWith);
|
|
164
|
+
}
|
|
165
|
+
}
|
package/src/settings.ts
CHANGED
|
@@ -2,8 +2,9 @@ import ProcessorTypeTranspiler from './transpiler/processor-type-transpiler';
|
|
|
2
2
|
import { JekyllDocsProcessor } from './transpiler/markdown/jekyll/jekyll-docsProcessor';
|
|
3
3
|
import DocsifyDocsProcessor from './transpiler/markdown/docsify/docsify-docs-processor';
|
|
4
4
|
import { PlainMarkdownDocsProcessor } from './transpiler/markdown/plain-markdown/plain-docsProcessor';
|
|
5
|
+
import { TsTypesTranspiler } from './transpiler/ts-types/TsTypesTranspiler';
|
|
5
6
|
|
|
6
|
-
export type GeneratorChoices = 'jekyll' | 'docsify' | 'plain-markdown';
|
|
7
|
+
export type GeneratorChoices = 'jekyll' | 'docsify' | 'plain-markdown' | 'ts-def';
|
|
7
8
|
|
|
8
9
|
export interface SettingsConfig {
|
|
9
10
|
sourceDirectory: string;
|
|
@@ -48,6 +49,7 @@ export class Settings {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
private static typeTranspilerCache?: ProcessorTypeTranspiler;
|
|
52
|
+
|
|
51
53
|
get typeTranspiler(): ProcessorTypeTranspiler {
|
|
52
54
|
if (Settings.typeTranspilerCache) {
|
|
53
55
|
return Settings.typeTranspilerCache;
|
|
@@ -62,6 +64,9 @@ export class Settings {
|
|
|
62
64
|
case 'plain-markdown':
|
|
63
65
|
Settings.typeTranspilerCache = new PlainMarkdownDocsProcessor();
|
|
64
66
|
return Settings.typeTranspilerCache;
|
|
67
|
+
case 'ts-def':
|
|
68
|
+
Settings.typeTranspilerCache = new TsTypesTranspiler();
|
|
69
|
+
return Settings.typeTranspilerCache;
|
|
65
70
|
default:
|
|
66
71
|
throw Error('Invalid target generator');
|
|
67
72
|
}
|
|
@@ -2,6 +2,7 @@ import { Type } from '@cparra/apex-reflection';
|
|
|
2
2
|
import { TypesRepository } from '../../model/types-repository';
|
|
3
3
|
import { Settings } from '../../settings';
|
|
4
4
|
import State from '../../service/state';
|
|
5
|
+
import { MarkdownTranspilerBase } from './markdown-transpiler-base';
|
|
5
6
|
|
|
6
7
|
export default class ClassFileGeneratorHelper {
|
|
7
8
|
public static getSanitizedGroup(classModel: Type) {
|
|
@@ -25,7 +26,7 @@ export default class ClassFileGeneratorHelper {
|
|
|
25
26
|
|
|
26
27
|
private static getDirectoryRoot(classModel: Type) {
|
|
27
28
|
// root-relative links start from the root by using a leading '/'
|
|
28
|
-
if (Settings.getInstance().typeTranspiler.getLinkingStrategy() === 'root-relative') {
|
|
29
|
+
if ((Settings.getInstance().typeTranspiler as MarkdownTranspilerBase).getLinkingStrategy() === 'root-relative') {
|
|
29
30
|
return `/${this.getSanitizedGroup(classModel)}/`;
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
|
-
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
1
|
+
import { LinkingStrategy, MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
3
2
|
|
|
4
3
|
export default class DocsifyDocsProcessor extends MarkdownTranspilerBase {
|
|
5
4
|
homeFileName(): string {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
1
|
+
import { LinkingStrategy, MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
2
|
import { Type } from '@cparra/apex-reflection';
|
|
3
3
|
import { MarkdownHomeFile } from '../../../model/markdown-home-file';
|
|
4
4
|
import { MarkdownTypeFile } from '../../../model/markdown-type-file';
|
|
5
|
-
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
6
5
|
|
|
7
6
|
export class JekyllDocsProcessor extends MarkdownTranspilerBase {
|
|
8
7
|
homeFileName(): string {
|
|
@@ -4,6 +4,8 @@ import { FileContainer } from '../file-container';
|
|
|
4
4
|
import { MarkdownHomeFile } from '../../model/markdown-home-file';
|
|
5
5
|
import { MarkdownTypeFile } from '../../model/markdown-type-file';
|
|
6
6
|
|
|
7
|
+
export type LinkingStrategy = 'root-relative' | 'path-relative';
|
|
8
|
+
|
|
7
9
|
export abstract class MarkdownTranspilerBase extends ProcessorTypeTranspiler {
|
|
8
10
|
protected readonly _fileContainer: FileContainer;
|
|
9
11
|
|
|
@@ -25,4 +27,6 @@ export abstract class MarkdownTranspilerBase extends ProcessorTypeTranspiler {
|
|
|
25
27
|
onProcess(type: Type): void {
|
|
26
28
|
this._fileContainer.pushFile(new MarkdownTypeFile(type));
|
|
27
29
|
}
|
|
30
|
+
|
|
31
|
+
abstract getLinkingStrategy(): LinkingStrategy;
|
|
28
32
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
|
-
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
1
|
+
import { LinkingStrategy, MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
3
2
|
|
|
4
3
|
export class PlainMarkdownDocsProcessor extends MarkdownTranspilerBase {
|
|
5
4
|
homeFileName(): string {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Type } from '@cparra/apex-reflection';
|
|
2
2
|
import { FileContainer } from './file-container';
|
|
3
3
|
|
|
4
|
-
export type LinkingStrategy = 'root-relative' | 'path-relative';
|
|
5
|
-
|
|
6
4
|
export default abstract class ProcessorTypeTranspiler {
|
|
7
5
|
onBeforeProcess: ((types: Type[]) => void) | undefined;
|
|
8
6
|
|
|
@@ -11,6 +9,4 @@ export default abstract class ProcessorTypeTranspiler {
|
|
|
11
9
|
onAfterProcess: ((types: Type[]) => void) | undefined;
|
|
12
10
|
|
|
13
11
|
abstract fileBuilder(): FileContainer;
|
|
14
|
-
|
|
15
|
-
abstract getLinkingStrategy(): LinkingStrategy;
|
|
16
12
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import ProcessorTypeTranspiler from '../processor-type-transpiler';
|
|
2
|
+
import { Type } from '@cparra/apex-reflection';
|
|
3
|
+
import { FileContainer } from '../file-container';
|
|
4
|
+
import TsDefinitionFile from '../../model/ts-definition-file';
|
|
5
|
+
|
|
6
|
+
export class TsTypesTranspiler extends ProcessorTypeTranspiler {
|
|
7
|
+
protected readonly _fileContainer: FileContainer;
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this._fileContainer = new FileContainer();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
fileBuilder(): FileContainer {
|
|
15
|
+
return this._fileContainer;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
onProcess(type: Type): void {
|
|
19
|
+
if (type.type_name !== 'class') {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
this._fileContainer.pushFile(new TsDefinitionFile(type));
|
|
23
|
+
}
|
|
24
|
+
}
|