@cparra/apexdocs 2.2.3 → 2.3.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.
Files changed (55) hide show
  1. package/.github/workflows/close_stale.yml +22 -0
  2. package/README.md +33 -8
  3. package/docs/Misc/SampleClass.md +168 -0
  4. package/docs/README.md +1 -1
  5. package/docs/Sample-Classes/SampleClass.md +7 -1
  6. package/examples/force-app/main/default/classes/SampleClass.cls +1 -1
  7. package/lib/application/Apexdocs.d.ts +2 -1
  8. package/lib/application/Apexdocs.js +7 -5
  9. package/lib/application/Apexdocs.js.map +1 -1
  10. package/lib/model/apex-bundle.d.ts +2 -1
  11. package/lib/model/apex-bundle.js +2 -1
  12. package/lib/model/apex-bundle.js.map +1 -1
  13. package/lib/model/file.js +5 -2
  14. package/lib/model/file.js.map +1 -1
  15. package/lib/model/markdown-file.d.ts +2 -0
  16. package/lib/model/markdown-file.js +22 -0
  17. package/lib/model/markdown-file.js.map +1 -1
  18. package/lib/model/markdown-generation-util/doc-comment-annotation-util.js +0 -1
  19. package/lib/model/markdown-generation-util/doc-comment-annotation-util.js.map +1 -1
  20. package/lib/model/markdown-home-file.d.ts +0 -1
  21. package/lib/model/markdown-home-file.js +0 -4
  22. package/lib/model/markdown-home-file.js.map +1 -1
  23. package/lib/model/markdown-type-file.d.ts +0 -1
  24. package/lib/model/markdown-type-file.js +0 -4
  25. package/lib/model/markdown-type-file.js.map +1 -1
  26. package/lib/service/apex-file-reader.js +4 -4
  27. package/lib/service/apex-file-reader.js.map +1 -1
  28. package/lib/service/manifest-factory.d.ts +2 -1
  29. package/lib/service/manifest-factory.js.map +1 -1
  30. package/lib/service/parser.d.ts +2 -2
  31. package/lib/service/parser.js +3 -1
  32. package/lib/service/parser.js.map +1 -1
  33. package/lib/transpiler/markdown/class-file-generatorHelper.js +2 -2
  34. package/lib/transpiler/markdown/class-file-generatorHelper.js.map +1 -1
  35. package/lib/util/error-logger.js +25 -24
  36. package/lib/util/error-logger.js.map +1 -1
  37. package/lib/util/logger.d.ts +4 -1
  38. package/lib/util/logger.js +28 -3
  39. package/lib/util/logger.js.map +1 -1
  40. package/package.json +5 -4
  41. package/src/application/Apexdocs.ts +8 -5
  42. package/src/model/apex-bundle.ts +1 -1
  43. package/src/model/file.ts +6 -2
  44. package/src/model/markdown-file.ts +26 -0
  45. package/src/model/markdown-generation-util/doc-comment-annotation-util.ts +0 -1
  46. package/src/model/markdown-home-file.ts +0 -5
  47. package/src/model/markdown-type-file.ts +0 -5
  48. package/src/service/apex-file-reader.ts +4 -4
  49. package/src/service/manifest-factory.ts +5 -1
  50. package/src/service/parser.ts +5 -3
  51. package/src/transpiler/markdown/class-file-generatorHelper.ts +2 -2
  52. package/src/util/error-logger.ts +25 -24
  53. package/src/util/logger.ts +29 -3
  54. package/docs/Some-group/GroupedClass.md +0 -7
  55. package/docs/index.html +0 -21
@@ -1,10 +1,10 @@
1
1
  import { Type, ReflectionResult } from '@cparra/apex-reflection';
2
2
  import ApexBundle from '../model/apex-bundle';
3
3
  export interface TypeParser {
4
- parse(reflect: (typeBody: string) => ReflectionResult): Type[];
4
+ parse(reflect: (apexBundle: ApexBundle) => ReflectionResult): Type[];
5
5
  }
6
6
  export declare class RawBodyParser implements TypeParser {
7
7
  typeBundles: ApexBundle[];
8
8
  constructor(typeBundles: ApexBundle[]);
9
- parse(reflect: (typeBody: string) => ReflectionResult): Type[];
9
+ parse(reflect: (apexBundle: ApexBundle) => ReflectionResult): Type[];
10
10
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RawBodyParser = void 0;
4
4
  const metadata_processor_1 = require("./metadata-processor");
5
+ const logger_1 = require("../util/logger");
5
6
  class RawBodyParser {
6
7
  constructor(typeBundles) {
7
8
  this.typeBundles = typeBundles;
@@ -9,7 +10,8 @@ class RawBodyParser {
9
10
  parse(reflect) {
10
11
  return this.typeBundles
11
12
  .map((currentBundle) => {
12
- const result = reflect(currentBundle.rawTypeContent);
13
+ logger_1.Logger.log(`Parsing file: ${currentBundle.filePath}`);
14
+ const result = reflect(currentBundle);
13
15
  if (!!result.typeMirror && !!currentBundle.rawMetadataContent) {
14
16
  // If successful and there is a metadata file
15
17
  const metadataParams = metadata_processor_1.default.process(currentBundle.rawMetadataContent);
@@ -1 +1 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/service/parser.ts"],"names":[],"mappings":";;;AAEA,6DAAqD;AAMrD,MAAa,aAAa;IACxB,YAAmB,WAAyB;QAAzB,gBAAW,GAAX,WAAW,CAAc;IAAG,CAAC;IAEhD,KAAK,CAAC,OAA+C;QACnD,OAAO,IAAI,CAAC,WAAW;aACpB,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE;YACrB,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;YACrD,IAAI,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,aAAa,CAAC,kBAAkB,EAAE;gBAC7D,6CAA6C;gBAC7C,MAAM,cAAc,GAAG,4BAAiB,CAAC,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;gBACnF,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;oBACpC,MAAM,WAAW,GAAG,GAAG,GAAG,KAAK,KAAK,EAAE,CAAC;oBACvC,MAAM,CAAC,UAAW,CAAC,WAAW,CAAC,IAAI,CAAC;wBAClC,cAAc,EAAE,WAAW;wBAC3B,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,WAAW;qBAClB,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;aACJ;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,gBAAgB,EAAE,EAAE;YAC3B,OAAO,gBAAgB,CAAC,UAAU,CAAC;QACrC,CAAC,CAAC;aACD,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE,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D,sCA2BC"}
@@ -11,8 +11,8 @@ class ClassFileGeneratorHelper {
11
11
  static getFileLinkByTypeName(typeName) {
12
12
  const type = types_repository_1.TypesRepository.getInstance().getByName(typeName);
13
13
  if (!type) {
14
- // If the type is not found we simply return the file name we received
15
- return typeName;
14
+ // If the type is not found we return a Markdown hyperlink with whatever we received.
15
+ return `[${typeName}](${typeName})`;
16
16
  }
17
17
  return this.getFileLink(type);
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"class-file-generatorHelper.js","sourceRoot":"","sources":["../../../src/transpiler/markdown/class-file-generatorHelper.ts"],"names":[],"mappings":";;AACA,mEAA+D;AAE/D,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;IAC5E,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,UAAgB;QACxC,OAAO,IAAI,UAAU,CAAC,IAAI,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,IAAI,MAAM,CAAC;IAC9F,CAAC;IAEM,MAAM,CAAC,qBAAqB,CAAC,QAAgB;QAClD,MAAM,IAAI,GAAG,kCAAe,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC/D,IAAI,CAAC,IAAI,EAAE;YACT,sEAAsE;YACtE,OAAO,QAAQ,CAAC;SACjB;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAEO,MAAM,CAAC,aAAa,CAAC,UAAgB;;QAC3C,MAAM,eAAe,SAAG,UAAU,CAAC,UAAU,0CAAE,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;QAC7G,aAAO,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI,mCAAI,MAAM,CAAC;IACzC,CAAC;CACF;AAvBD,2CAuBC"}
1
+ {"version":3,"file":"class-file-generatorHelper.js","sourceRoot":"","sources":["../../../src/transpiler/markdown/class-file-generatorHelper.ts"],"names":[],"mappings":";;AACA,mEAA+D;AAE/D,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;IAC5E,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,UAAgB;QACxC,OAAO,IAAI,UAAU,CAAC,IAAI,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,IAAI,MAAM,CAAC;IAC9F,CAAC;IAEM,MAAM,CAAC,qBAAqB,CAAC,QAAgB;QAClD,MAAM,IAAI,GAAG,kCAAe,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC/D,IAAI,CAAC,IAAI,EAAE;YACT,qFAAqF;YACrF,OAAO,IAAI,QAAQ,KAAK,QAAQ,GAAG,CAAC;SACrC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAEO,MAAM,CAAC,aAAa,CAAC,UAAgB;;QAC3C,MAAM,eAAe,SAAG,UAAU,CAAC,UAAU,0CAAE,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;QAC7G,aAAO,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI,mCAAI,MAAM,CAAC;IACzC,CAAC;CACF;AAvBD,2CAuBC"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const logger_1 = require("./logger");
3
4
  class ErrorLogger {
4
5
  static logErrors(types) {
5
6
  types.forEach((currentType) => {
@@ -19,10 +20,10 @@ class ErrorLogger {
19
20
  var _a;
20
21
  if ((_a = currentType.docComment) === null || _a === void 0 ? void 0 : _a.error) {
21
22
  const typeName = parentType ? `${parentType.name}.${currentType.name}` : currentType.name;
22
- console.log(`${typeName} - Doc comment parsing error. Level: Type`);
23
- console.log(`Comment:\n ${currentType.docComment.rawDeclaration}`);
24
- console.log(currentType.docComment.error);
25
- console.log('=================================');
23
+ logger_1.Logger.error(`${typeName} - Doc comment parsing error. Level: Type`);
24
+ logger_1.Logger.error(`Comment:\n ${currentType.docComment.rawDeclaration}`);
25
+ logger_1.Logger.error(currentType.docComment.error);
26
+ logger_1.Logger.error('=================================');
26
27
  }
27
28
  }
28
29
  static logErrorsForClass(classMirror, parentType) {
@@ -30,37 +31,37 @@ class ErrorLogger {
30
31
  classMirror.constructors.forEach((currentConstructor) => {
31
32
  var _a;
32
33
  if ((_a = currentConstructor.docComment) === null || _a === void 0 ? void 0 : _a.error) {
33
- console.log(`${typeName} - Doc comment parsing error. Level: Constructor`);
34
- console.log(`Comment:\n ${currentConstructor.docComment.rawDeclaration}`);
35
- console.log(currentConstructor.docComment.error);
36
- console.log('=================================');
34
+ logger_1.Logger.error(`${typeName} - Doc comment parsing error. Level: Constructor`);
35
+ logger_1.Logger.error(`Comment:\n ${currentConstructor.docComment.rawDeclaration}`);
36
+ logger_1.Logger.error(currentConstructor.docComment.error);
37
+ logger_1.Logger.error('=================================');
37
38
  }
38
39
  });
39
40
  classMirror.fields.forEach((currentField) => {
40
41
  var _a;
41
42
  if ((_a = currentField.docComment) === null || _a === void 0 ? void 0 : _a.error) {
42
- console.log(`${typeName} - Doc comment parsing error. Level: Field`);
43
- console.log(`Comment:\n ${currentField.docComment.rawDeclaration}`);
44
- console.log(currentField.docComment.error);
45
- console.log('=================================');
43
+ logger_1.Logger.error(`${typeName} - Doc comment parsing error. Level: Field`);
44
+ logger_1.Logger.error(`Comment:\n ${currentField.docComment.rawDeclaration}`);
45
+ logger_1.Logger.error(currentField.docComment.error);
46
+ logger_1.Logger.error('=================================');
46
47
  }
47
48
  });
48
49
  classMirror.properties.forEach((currentProperty) => {
49
50
  var _a;
50
51
  if ((_a = currentProperty.docComment) === null || _a === void 0 ? void 0 : _a.error) {
51
- console.log(`${typeName} - Doc comment parsing error. Level: Property`);
52
- console.log(`Comment:\n ${currentProperty.docComment.rawDeclaration}`);
53
- console.log(currentProperty.docComment.error);
54
- console.log('=================================');
52
+ logger_1.Logger.error(`${typeName} - Doc comment parsing error. Level: Property`);
53
+ logger_1.Logger.error(`Comment:\n ${currentProperty.docComment.rawDeclaration}`);
54
+ logger_1.Logger.error(currentProperty.docComment.error);
55
+ logger_1.Logger.error('=================================');
55
56
  }
56
57
  });
57
58
  classMirror.methods.forEach((currentMethod) => {
58
59
  var _a;
59
60
  if ((_a = currentMethod.docComment) === null || _a === void 0 ? void 0 : _a.error) {
60
- console.log(`${typeName} - Doc comment parsing error. Level: Method`);
61
- console.log(`Comment:\n ${currentMethod.docComment.rawDeclaration}`);
62
- console.log(currentMethod.docComment.error);
63
- console.log('=================================');
61
+ logger_1.Logger.error(`${typeName} - Doc comment parsing error. Level: Method`);
62
+ logger_1.Logger.error(`Comment:\n ${currentMethod.docComment.rawDeclaration}`);
63
+ logger_1.Logger.error(currentMethod.docComment.error);
64
+ logger_1.Logger.error('=================================');
64
65
  }
65
66
  });
66
67
  classMirror.enums.forEach((currentEnum) => {
@@ -77,10 +78,10 @@ class ErrorLogger {
77
78
  interfaceMirror.methods.forEach((currentMethod) => {
78
79
  var _a;
79
80
  if ((_a = currentMethod.docComment) === null || _a === void 0 ? void 0 : _a.error) {
80
- console.log(`${interfaceMirror.name} - Doc comment parsing error. Level: Method`);
81
- console.log(`Comment: ${currentMethod.docComment.rawDeclaration}`);
82
- console.log(currentMethod.docComment.error);
83
- console.log('=================================');
81
+ logger_1.Logger.error(`${interfaceMirror.name} - Doc comment parsing error. Level: Method`);
82
+ logger_1.Logger.error(`Comment: ${currentMethod.docComment.rawDeclaration}`);
83
+ logger_1.Logger.error(currentMethod.docComment.error);
84
+ logger_1.Logger.error('=================================');
84
85
  }
85
86
  });
86
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"error-logger.js","sourceRoot":"","sources":["../../src/util/error-logger.ts"],"names":[],"mappings":";;AAEA,MAAqB,WAAW;IACvB,MAAM,CAAC,SAAS,CAAC,KAAa;QACnC,KAAK,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;YAC5B,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,sBAAsB,CAAC,WAAiB,EAAE,UAAiB;QACxE,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QAEhC,IAAI,WAAW,CAAC,SAAS,KAAK,OAAO,EAAE;YACrC,IAAI,CAAC,iBAAiB,CAAC,WAA0B,CAAC,CAAC;SACpD;aAAM,IAAI,WAAW,CAAC,SAAS,KAAK,WAAW,EAAE;YAChD,IAAI,CAAC,qBAAqB,CAAC,WAA8B,CAAC,CAAC;SAC5D;IACH,CAAC;IAEO,MAAM,CAAC,aAAa,CAAC,WAAiB,EAAE,UAAiB;;QAC/D,UAAI,WAAW,CAAC,UAAU,0CAAE,KAAK,EAAE;YACjC,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAW,CAAC,IAAI,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC;YAC3F,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,2CAA2C,CAAC,CAAC;YACpE,OAAO,CAAC,GAAG,CAAC,cAAc,WAAW,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;YACnE,OAAO,CAAC,GAAG,C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AE,WAAW,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,EAAE;YAClD,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;YAC3C,IAAI,CAAC,sBAAsB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,eAAgC;QACnE,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;;YAChD,UAAI,aAAa,CAAC,UAAU,0CAAE,KAAK,EAAE;gBACnC,eAAM,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC,IAAI,6CAA6C,CAAC,CAAC;gBACnF,eAAM,CAAC,KAAK,CAAC,YAAY,aAAa,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;gBACpE,eAAM,CAAC,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;gBAC7C,eAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;aACnD;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxFD,8BAwFC"}
@@ -2,6 +2,8 @@
2
2
  * Logs messages to the console.
3
3
  */
4
4
  export declare class Logger {
5
+ static currentFrame: number;
6
+ static frames: string[];
5
7
  /**
6
8
  * Logs a message with optional arguments.
7
9
  * @param message The message to log.
@@ -14,5 +16,6 @@ export declare class Logger {
14
16
  * @param args Optional arguments.
15
17
  */
16
18
  static error(message: string, ...args: string[]): void;
17
- private static logSingle;
19
+ static logSingle(text: string, showSpinner?: boolean, color?: 'green' | 'red', overrideConsole?: boolean): void;
20
+ static clear(): void;
18
21
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Logger = void 0;
4
4
  const chalk = require("chalk");
5
+ const logUpdate = require("log-update");
5
6
  /**
6
7
  * Logs messages to the console.
7
8
  */
@@ -23,11 +24,35 @@ class Logger {
23
24
  * @param args Optional arguments.
24
25
  */
25
26
  static error(message, ...args) {
26
- this.log(`${chalk.red(message)}`, ...args);
27
+ this.logSingle(message, false, 'red', false);
28
+ args.forEach((arg) => {
29
+ this.logSingle(message, false, 'red', false);
30
+ });
31
+ }
32
+ static logSingle(text, showSpinner = true, color = 'green', overrideConsole = true) {
33
+ if (this.currentFrame > 9) {
34
+ this.currentFrame = 0;
35
+ }
36
+ const spinner = showSpinner ? `${this.frames[this.currentFrame++]}` : '';
37
+ let logMessage;
38
+ if (color === 'green') {
39
+ logMessage = `${chalk.green(new Date().toLocaleString() + ': ')}${text}\n`;
40
+ }
41
+ else {
42
+ logMessage = `${chalk.red(new Date().toLocaleString() + ': ')}${text}\n`;
43
+ }
44
+ if (overrideConsole) {
45
+ logUpdate(`${spinner} ${logMessage}`);
46
+ }
47
+ else {
48
+ process.stdout.write(`${spinner} ${logMessage}`);
49
+ }
27
50
  }
28
- static logSingle(message) {
29
- process.stdout.write(`${chalk.green(new Date().toLocaleString() + ': ')}${message}\n`);
51
+ static clear() {
52
+ logUpdate.clear();
30
53
  }
31
54
  }
32
55
  exports.Logger = Logger;
56
+ Logger.currentFrame = -1;
57
+ Logger.frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
33
58
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/util/logger.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAE/B;;GAEG;AACH,MAAa,MAAM;IACjB;;;;OAIG;IACI,MAAM,CAAC,GAAG,CAAC,OAAe,EAAE,GAAG,IAAc;QAClD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAA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  "name": "@cparra/apexdocs",
3
- "version": "2.2.3",
3
+ "version": "2.3.0",
4
4
  "description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
5
5
  "keywords": [
6
6
  "apex",
@@ -64,10 +64,11 @@
64
64
  ]
65
65
  },
66
66
  "dependencies": {
67
- "@cparra/apex-reflection": "^1.5.0",
68
- "fast-xml-parser": "^4.0.1",
67
+ "@cparra/apex-reflection": "^1.6.0",
69
68
  "chalk": "^4.1.2",
70
- "html-entities": "^2.3.2",
69
+ "fast-xml-parser": "^4.0.1",
70
+ "log-update": "4.0.0",
71
+ "xss": "^1.0.11",
71
72
  "yargs": "^16.0.3"
72
73
  }
73
74
  }
@@ -9,6 +9,7 @@ import Transpiler from '../transpiler/transpiler';
9
9
  import { FileWriter } from '../service/file-writer';
10
10
  import { TypesRepository } from '../model/types-repository';
11
11
  import ErrorLogger from '../util/error-logger';
12
+ import ApexBundle from '../model/apex-bundle';
12
13
 
13
14
  /**
14
15
  * Application entry-point to generate documentation out of Apex source files.
@@ -18,28 +19,30 @@ export class Apexdocs {
18
19
  * Generates documentation out of Apex source files.
19
20
  */
20
21
  static generate(): void {
22
+ Logger.log('Initializing...');
21
23
  const fileBodies = ApexFileReader.processFiles(new DefaultFileSystem());
22
24
  const manifest = createManifest(new RawBodyParser(fileBodies), this._reflectionWithLogger);
23
25
 
24
26
  const filteredTypes: Type[] = manifest.filteredByAccessModifierAndAnnotations(Settings.getInstance().scope);
25
27
  TypesRepository.getInstance().populate(filteredTypes);
28
+ Logger.clear();
26
29
 
27
- Logger.log(`Parsed ${filteredTypes.length} files`);
30
+ Logger.logSingle(`Parsed ${filteredTypes.length} files`, false, 'green', false);
28
31
  const processor = Settings.getInstance().typeTranspiler;
29
32
  Transpiler.generate(filteredTypes, processor);
30
33
  const generatedFiles = processor.fileBuilder().files();
31
34
  FileWriter.write(generatedFiles, (fileName: string) => {
32
- Logger.log(`${fileName} processed.`);
35
+ Logger.logSingle(`${fileName} processed.`, false, 'green', false);
33
36
  });
34
37
 
35
38
  // Error logging
36
39
  ErrorLogger.logErrors(filteredTypes);
37
40
  }
38
41
 
39
- static _reflectionWithLogger = (declarationBody: string): ReflectionResult => {
40
- const result = reflect(declarationBody);
42
+ static _reflectionWithLogger = (apexBundle: ApexBundle): ReflectionResult => {
43
+ const result = reflect(apexBundle.rawTypeContent);
41
44
  if (result.error) {
42
- Logger.log(`Parsing error ${result.error?.message}`);
45
+ Logger.error(`${apexBundle.filePath} - Parsing error ${result.error?.message}`);
43
46
  }
44
47
  return result;
45
48
  };
@@ -1,3 +1,3 @@
1
1
  export default class ApexBundle {
2
- constructor(public rawTypeContent: string, public rawMetadataContent: string | null) {}
2
+ constructor(public filePath: string, public rawTypeContent: string, public rawMetadataContent: string | null) {}
3
3
  }
package/src/model/file.ts CHANGED
@@ -1,4 +1,8 @@
1
- import { encode } from 'html-entities';
1
+ import xss = require('xss');
2
+
3
+ const xssFilter = new xss.FilterXSS({
4
+ whiteList: { br: [], p: [], ul: [], li: [] },
5
+ });
2
6
 
3
7
  export abstract class File {
4
8
  _contents = '';
@@ -12,7 +16,7 @@ export abstract class File {
12
16
  }
13
17
 
14
18
  addText(text: string, encodeHtml = true) {
15
- const textToAdd = encodeHtml ? encode(text) : text;
19
+ const textToAdd = encodeHtml ? xssFilter.process(text) : text;
16
20
  this._contents += textToAdd;
17
21
  this.addBlankLine();
18
22
  }
@@ -18,6 +18,12 @@ export class MarkdownFile extends File {
18
18
  this.addBlankLine();
19
19
  }
20
20
 
21
+ public addText(text: string, encodeHtml = true) {
22
+ text = MarkdownFile.replaceInlineLinks(text);
23
+ text = MarkdownFile.replaceInlineEmails(text);
24
+ super.addText(text, encodeHtml);
25
+ }
26
+
21
27
  startCodeBlock() {
22
28
  this._contents += '```';
23
29
  const sourceLanguage = 'apex';
@@ -86,4 +92,24 @@ export class MarkdownFile extends File {
86
92
  }
87
93
  return text;
88
94
  }
95
+
96
+ protected static replaceInlineEmails(text: string) {
97
+ // Parsing links using {@link ClassName} format
98
+ const linkFormatRegEx = '{@email (.*?)}';
99
+ const expression = new RegExp(linkFormatRegEx, 'gi');
100
+ let match;
101
+ const matches = [];
102
+
103
+ do {
104
+ match = expression.exec(text);
105
+ if (match) {
106
+ matches.push(match);
107
+ }
108
+ } while (match);
109
+
110
+ for (const currentMatch of matches) {
111
+ text = text.replace(currentMatch[0], `[${currentMatch[1]}](mailto:${currentMatch[1]})`);
112
+ }
113
+ return text;
114
+ }
89
115
  }
@@ -19,7 +19,6 @@ export function addCustomDocCommentAnnotations(markdownFile: MarkdownFile, docCo
19
19
  const words = text.split(/[-_]+/);
20
20
  const capitalizedWords = [];
21
21
  for (const word of words) {
22
- console.log(`current word ${word}`);
23
22
  capitalizedWords.push(word.charAt(0).toUpperCase() + word.slice(1));
24
23
  }
25
24
  return capitalizedWords.join(' ');
@@ -12,11 +12,6 @@ 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
-
20
15
  private addTypeEntries(types: Type[]) {
21
16
  const groupedClasses: Map<string, Type[]> = this.group(types);
22
17
  groupedClasses.forEach((value: Type[], key: string) => {
@@ -32,11 +32,6 @@ export class MarkdownTypeFile extends MarkdownFile implements WalkerListener {
32
32
  walker.walk(this);
33
33
  }
34
34
 
35
- public addText(text: string, encodeHtml = true) {
36
- text = MarkdownFile.replaceInlineLinks(text);
37
- super.addText(text, encodeHtml);
38
- }
39
-
40
35
  public onTypeDeclaration(typeMirror: Type): void {
41
36
  this.addTitle(typeMirror.name, this.headingLevel);
42
37
  declareType(this, typeMirror);
@@ -12,13 +12,13 @@ export class ApexFileReader {
12
12
  * Reads from .cls files and returns their raw body.
13
13
  */
14
14
  static processFiles(fileSystem: FileSystem, rootPath: string = this.sourceDirectory): ApexBundle[] {
15
- let bodies: ApexBundle[] = [];
15
+ let bundles: ApexBundle[] = [];
16
16
 
17
17
  const directoryContents = fileSystem.readDirectory(rootPath);
18
18
  directoryContents.forEach((currentFilePath) => {
19
19
  const currentPath = fileSystem.joinPath(rootPath, currentFilePath);
20
20
  if (this.readRecursively && fileSystem.isDirectory(currentPath)) {
21
- bodies = bodies.concat(this.processFiles(fileSystem, currentPath));
21
+ bundles = bundles.concat(this.processFiles(fileSystem, currentPath));
22
22
  }
23
23
 
24
24
  if (!this.isApexFile(currentFilePath)) {
@@ -28,9 +28,9 @@ export class ApexFileReader {
28
28
  const rawApexFile = fileSystem.readFile(currentPath);
29
29
  const metadataPath = fileSystem.joinPath(rootPath, `${currentFilePath}-meta.xml`);
30
30
  const rawMetadataFile = fileSystem.exists(metadataPath) ? fileSystem.readFile(metadataPath) : null;
31
- bodies.push(new ApexBundle(rawApexFile, rawMetadataFile));
31
+ bundles.push(new ApexBundle(currentFilePath, rawApexFile, rawMetadataFile));
32
32
  });
33
- return bodies;
33
+ return bundles;
34
34
  }
35
35
 
36
36
  private static isApexFile(currentFile: string): boolean {
@@ -1,12 +1,16 @@
1
1
  import Manifest from '../model/manifest';
2
2
  import { TypeParser } from './parser';
3
3
  import { ReflectionResult } from '@cparra/apex-reflection';
4
+ import ApexBundle from '../model/apex-bundle';
4
5
 
5
6
  /**
6
7
  * Builds a new Manifest object, sourcing its types from the received TypeParser.
7
8
  * @param typeParser In charge of returning the list of reflected types.
8
9
  * @param reflect Reflection function.
9
10
  */
10
- export function createManifest(typeParser: TypeParser, reflect: (typeBody: string) => ReflectionResult): Manifest {
11
+ export function createManifest(
12
+ typeParser: TypeParser,
13
+ reflect: (apexBundle: ApexBundle) => ReflectionResult,
14
+ ): Manifest {
11
15
  return new Manifest(typeParser.parse(reflect));
12
16
  }
@@ -1,18 +1,20 @@
1
1
  import { Type, ReflectionResult } from '@cparra/apex-reflection';
2
2
  import ApexBundle from '../model/apex-bundle';
3
3
  import MetadataProcessor from './metadata-processor';
4
+ import { Logger } from '../util/logger';
4
5
 
5
6
  export interface TypeParser {
6
- parse(reflect: (typeBody: string) => ReflectionResult): Type[];
7
+ parse(reflect: (apexBundle: ApexBundle) => ReflectionResult): Type[];
7
8
  }
8
9
 
9
10
  export class RawBodyParser implements TypeParser {
10
11
  constructor(public typeBundles: ApexBundle[]) {}
11
12
 
12
- parse(reflect: (typeBody: string) => ReflectionResult): Type[] {
13
+ parse(reflect: (apexBundle: ApexBundle) => ReflectionResult): Type[] {
13
14
  return this.typeBundles
14
15
  .map((currentBundle) => {
15
- const result = reflect(currentBundle.rawTypeContent);
16
+ Logger.log(`Parsing file: ${currentBundle.filePath}`);
17
+ const result = reflect(currentBundle);
16
18
  if (!!result.typeMirror && !!currentBundle.rawMetadataContent) {
17
19
  // If successful and there is a metadata file
18
20
  const metadataParams = MetadataProcessor.process(currentBundle.rawMetadataContent);
@@ -13,8 +13,8 @@ export default class ClassFileGeneratorHelper {
13
13
  public static getFileLinkByTypeName(typeName: string) {
14
14
  const type = TypesRepository.getInstance().getByName(typeName);
15
15
  if (!type) {
16
- // If the type is not found we simply return the file name we received
17
- return typeName;
16
+ // If the type is not found we return a Markdown hyperlink with whatever we received.
17
+ return `[${typeName}](${typeName})`;
18
18
  }
19
19
 
20
20
  return this.getFileLink(type);
@@ -1,4 +1,5 @@
1
1
  import { ClassMirror, InterfaceMirror, Type } from '@cparra/apex-reflection';
2
+ import { Logger } from './logger';
2
3
 
3
4
  export default class ErrorLogger {
4
5
  public static logErrors(types: Type[]): void {
@@ -20,10 +21,10 @@ export default class ErrorLogger {
20
21
  private static logTypeErrors(currentType: Type, parentType?: Type) {
21
22
  if (currentType.docComment?.error) {
22
23
  const typeName = parentType ? `${parentType!.name}.${currentType.name}` : currentType.name;
23
- console.log(`${typeName} - Doc comment parsing error. Level: Type`);
24
- console.log(`Comment:\n ${currentType.docComment.rawDeclaration}`);
25
- console.log(currentType.docComment.error);
26
- console.log('=================================');
24
+ Logger.error(`${typeName} - Doc comment parsing error. Level: Type`);
25
+ Logger.error(`Comment:\n ${currentType.docComment.rawDeclaration}`);
26
+ Logger.error(currentType.docComment.error);
27
+ Logger.error('=================================');
27
28
  }
28
29
  }
29
30
 
@@ -31,37 +32,37 @@ export default class ErrorLogger {
31
32
  const typeName = parentType ? `${parentType!.name}.${classMirror.name}` : classMirror.name;
32
33
  classMirror.constructors.forEach((currentConstructor) => {
33
34
  if (currentConstructor.docComment?.error) {
34
- console.log(`${typeName} - Doc comment parsing error. Level: Constructor`);
35
- console.log(`Comment:\n ${currentConstructor.docComment.rawDeclaration}`);
36
- console.log(currentConstructor.docComment.error);
37
- console.log('=================================');
35
+ Logger.error(`${typeName} - Doc comment parsing error. Level: Constructor`);
36
+ Logger.error(`Comment:\n ${currentConstructor.docComment.rawDeclaration}`);
37
+ Logger.error(currentConstructor.docComment.error);
38
+ Logger.error('=================================');
38
39
  }
39
40
  });
40
41
 
41
42
  classMirror.fields.forEach((currentField) => {
42
43
  if (currentField.docComment?.error) {
43
- console.log(`${typeName} - Doc comment parsing error. Level: Field`);
44
- console.log(`Comment:\n ${currentField.docComment.rawDeclaration}`);
45
- console.log(currentField.docComment.error);
46
- console.log('=================================');
44
+ Logger.error(`${typeName} - Doc comment parsing error. Level: Field`);
45
+ Logger.error(`Comment:\n ${currentField.docComment.rawDeclaration}`);
46
+ Logger.error(currentField.docComment.error);
47
+ Logger.error('=================================');
47
48
  }
48
49
  });
49
50
 
50
51
  classMirror.properties.forEach((currentProperty) => {
51
52
  if (currentProperty.docComment?.error) {
52
- console.log(`${typeName} - Doc comment parsing error. Level: Property`);
53
- console.log(`Comment:\n ${currentProperty.docComment.rawDeclaration}`);
54
- console.log(currentProperty.docComment.error);
55
- console.log('=================================');
53
+ Logger.error(`${typeName} - Doc comment parsing error. Level: Property`);
54
+ Logger.error(`Comment:\n ${currentProperty.docComment.rawDeclaration}`);
55
+ Logger.error(currentProperty.docComment.error);
56
+ Logger.error('=================================');
56
57
  }
57
58
  });
58
59
 
59
60
  classMirror.methods.forEach((currentMethod) => {
60
61
  if (currentMethod.docComment?.error) {
61
- console.log(`${typeName} - Doc comment parsing error. Level: Method`);
62
- console.log(`Comment:\n ${currentMethod.docComment.rawDeclaration}`);
63
- console.log(currentMethod.docComment.error);
64
- console.log('=================================');
62
+ Logger.error(`${typeName} - Doc comment parsing error. Level: Method`);
63
+ Logger.error(`Comment:\n ${currentMethod.docComment.rawDeclaration}`);
64
+ Logger.error(currentMethod.docComment.error);
65
+ Logger.error('=================================');
65
66
  }
66
67
  });
67
68
 
@@ -81,10 +82,10 @@ export default class ErrorLogger {
81
82
  private static logErrorsForInterface(interfaceMirror: InterfaceMirror): void {
82
83
  interfaceMirror.methods.forEach((currentMethod) => {
83
84
  if (currentMethod.docComment?.error) {
84
- console.log(`${interfaceMirror.name} - Doc comment parsing error. Level: Method`);
85
- console.log(`Comment: ${currentMethod.docComment.rawDeclaration}`);
86
- console.log(currentMethod.docComment.error);
87
- console.log('=================================');
85
+ Logger.error(`${interfaceMirror.name} - Doc comment parsing error. Level: Method`);
86
+ Logger.error(`Comment: ${currentMethod.docComment.rawDeclaration}`);
87
+ Logger.error(currentMethod.docComment.error);
88
+ Logger.error('=================================');
88
89
  }
89
90
  });
90
91
  }