@cparra/apexdocs 2.25.0-alpha.3 → 2.25.0-alpha.4

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 (288) hide show
  1. package/dist/cli/generate.js +26 -26
  2. package/examples/plain-markdown/docs/Miscellaneous/ns.Url.md +320 -0
  3. package/examples/plain-markdown/docs/index.md +82 -0
  4. package/examples/plain-markdown/force-app/classes/Url.cls +194 -0
  5. package/examples/plain-markdown/package.json +2 -1
  6. package/package.json +1 -1
  7. package/src/application/Apexdocs.ts +0 -2
  8. package/src/cli/args.ts +3 -1
  9. package/src/cli/generate.ts +1 -3
  10. package/src/core/adapters/__tests__/documentables.spec.ts +109 -0
  11. package/src/core/adapters/__tests__/references.spec.ts +12 -1
  12. package/src/core/adapters/apex-types.ts +1 -1
  13. package/src/core/adapters/documentables.ts +2 -62
  14. package/src/core/adapters/fields-and-properties.ts +7 -2
  15. package/src/core/adapters/{references.ts → inline.ts} +43 -10
  16. package/src/core/adapters/methods-and-constructors.ts +7 -2
  17. package/src/core/adapters/type-utils.ts +5 -1
  18. package/src/core/adapters/types.d.ts +8 -1
  19. package/src/core/template.ts +4 -1
  20. package/src/service/apex-file-reader.ts +1 -5
  21. package/src/settings.ts +0 -10
  22. package/src/test-helpers/SettingsBuilder.ts +0 -2
  23. package/src/transpiler/markdown/plain-markdown/constructors-partial-template.ts +1 -1
  24. package/src/util/fp.ts +3 -0
  25. package/dist/__spec__/core/expect-extensions.d.ts +0 -3
  26. package/dist/__spec__/core/expect-extensions.js +0 -55
  27. package/dist/__spec__/core/expect-extensions.js.map +0 -1
  28. package/dist/__spec__/core/generating-class-docs.spec.d.ts +0 -1
  29. package/dist/__spec__/core/generating-class-docs.spec.js +0 -444
  30. package/dist/__spec__/core/generating-class-docs.spec.js.map +0 -1
  31. package/dist/__spec__/core/generating-enum-docs.spec.d.ts +0 -1
  32. package/dist/__spec__/core/generating-enum-docs.spec.js +0 -306
  33. package/dist/__spec__/core/generating-enum-docs.spec.js.map +0 -1
  34. package/dist/__spec__/core/generating-interface-docs.spec.d.ts +0 -1
  35. package/dist/__spec__/core/generating-interface-docs.spec.js +0 -364
  36. package/dist/__spec__/core/generating-interface-docs.spec.js.map +0 -1
  37. package/dist/__spec__/core/generating-reference-guide.spec.d.ts +0 -1
  38. package/dist/__spec__/core/generating-reference-guide.spec.js +0 -162
  39. package/dist/__spec__/core/generating-reference-guide.spec.js.map +0 -1
  40. package/dist/__spec__/core/test-helpers.d.ts +0 -2
  41. package/dist/__spec__/core/test-helpers.js +0 -12
  42. package/dist/__spec__/core/test-helpers.js.map +0 -1
  43. package/dist/application/Apexdocs.d.ts +0 -15
  44. package/dist/application/Apexdocs.js +0 -113
  45. package/dist/application/Apexdocs.js.map +0 -1
  46. package/dist/application/generators/generate-markdown-files.d.ts +0 -3
  47. package/dist/application/generators/generate-markdown-files.js +0 -64
  48. package/dist/application/generators/generate-markdown-files.js.map +0 -1
  49. package/dist/cli/args.d.ts +0 -39
  50. package/dist/cli/args.js +0 -154
  51. package/dist/cli/args.js.map +0 -1
  52. package/dist/cli/generate.d.ts +0 -2
  53. package/dist/cli/generate.js.map +0 -1
  54. package/dist/core/__test__/inheritance-chain.test.d.ts +0 -1
  55. package/dist/core/__test__/inheritance-chain.test.js +0 -42
  56. package/dist/core/__test__/inheritance-chain.test.js.map +0 -1
  57. package/dist/core/adapters/apex-types.d.ts +0 -6
  58. package/dist/core/adapters/apex-types.js +0 -109
  59. package/dist/core/adapters/apex-types.js.map +0 -1
  60. package/dist/core/adapters/documentables.d.ts +0 -7
  61. package/dist/core/adapters/documentables.js +0 -154
  62. package/dist/core/adapters/documentables.js.map +0 -1
  63. package/dist/core/adapters/fields-and-properties.d.ts +0 -3
  64. package/dist/core/adapters/fields-and-properties.js +0 -37
  65. package/dist/core/adapters/fields-and-properties.js.map +0 -1
  66. package/dist/core/adapters/methods-and-constructors.d.ts +0 -5
  67. package/dist/core/adapters/methods-and-constructors.js +0 -100
  68. package/dist/core/adapters/methods-and-constructors.js.map +0 -1
  69. package/dist/core/adapters/references.d.ts +0 -4
  70. package/dist/core/adapters/references.js +0 -78
  71. package/dist/core/adapters/references.js.map +0 -1
  72. package/dist/core/adapters/type-utils.d.ts +0 -3
  73. package/dist/core/adapters/type-utils.js +0 -12
  74. package/dist/core/adapters/type-utils.js.map +0 -1
  75. package/dist/core/apex-bundle.d.ts +0 -6
  76. package/dist/core/apex-bundle.js +0 -11
  77. package/dist/core/apex-bundle.js.map +0 -1
  78. package/dist/core/generate-docs.d.ts +0 -28
  79. package/dist/core/generate-docs.js +0 -296
  80. package/dist/core/generate-docs.js.map +0 -1
  81. package/dist/core/inheritance-chain.d.ts +0 -2
  82. package/dist/core/inheritance-chain.js +0 -36
  83. package/dist/core/inheritance-chain.js.map +0 -1
  84. package/dist/core/manifest.d.ts +0 -22
  85. package/dist/core/manifest.js +0 -53
  86. package/dist/core/manifest.js.map +0 -1
  87. package/dist/core/template.d.ts +0 -10
  88. package/dist/core/template.js +0 -97
  89. package/dist/core/template.js.map +0 -1
  90. package/dist/core/templates/reference-guide.d.ts +0 -1
  91. package/dist/core/templates/reference-guide.js +0 -18
  92. package/dist/core/templates/reference-guide.js.map +0 -1
  93. package/dist/index.js.map +0 -1
  94. package/dist/model/apex-type-wrappers/ClassMirrorWrapper.d.ts +0 -7
  95. package/dist/model/apex-type-wrappers/ClassMirrorWrapper.js +0 -14
  96. package/dist/model/apex-type-wrappers/ClassMirrorWrapper.js.map +0 -1
  97. package/dist/model/apex-type-wrappers/MethodMirrorWrapper.d.ts +0 -7
  98. package/dist/model/apex-type-wrappers/MethodMirrorWrapper.js +0 -12
  99. package/dist/model/apex-type-wrappers/MethodMirrorWrapper.js.map +0 -1
  100. package/dist/model/markdown-file.d.ts +0 -16
  101. package/dist/model/markdown-file.js +0 -111
  102. package/dist/model/markdown-file.js.map +0 -1
  103. package/dist/model/markdown-generation-util/doc-comment-annotation-util.d.ts +0 -8
  104. package/dist/model/markdown-generation-util/doc-comment-annotation-util.js +0 -47
  105. package/dist/model/markdown-generation-util/doc-comment-annotation-util.js.map +0 -1
  106. package/dist/model/markdown-generation-util/field-declaration-util.d.ts +0 -3
  107. package/dist/model/markdown-generation-util/field-declaration-util.js +0 -55
  108. package/dist/model/markdown-generation-util/field-declaration-util.js.map +0 -1
  109. package/dist/model/markdown-generation-util/index.d.ts +0 -3
  110. package/dist/model/markdown-generation-util/index.js +0 -20
  111. package/dist/model/markdown-generation-util/index.js.map +0 -1
  112. package/dist/model/markdown-generation-util/method-declaration-util.d.ts +0 -4
  113. package/dist/model/markdown-generation-util/method-declaration-util.js +0 -115
  114. package/dist/model/markdown-generation-util/method-declaration-util.js.map +0 -1
  115. package/dist/model/markdown-generation-util/type-declaration-util.d.ts +0 -3
  116. package/dist/model/markdown-generation-util/type-declaration-util.js +0 -82
  117. package/dist/model/markdown-generation-util/type-declaration-util.js.map +0 -1
  118. package/dist/model/markdown-home-file.d.ts +0 -11
  119. package/dist/model/markdown-home-file.js +0 -57
  120. package/dist/model/markdown-home-file.js.map +0 -1
  121. package/dist/model/markdown-type-file.d.ts +0 -26
  122. package/dist/model/markdown-type-file.js +0 -137
  123. package/dist/model/markdown-type-file.js.map +0 -1
  124. package/dist/model/openapi/apex-doc-types.d.ts +0 -19
  125. package/dist/model/openapi/apex-doc-types.js +0 -5
  126. package/dist/model/openapi/apex-doc-types.js.map +0 -1
  127. package/dist/model/openapi/open-api-types.d.ts +0 -93
  128. package/dist/model/openapi/open-api-types.js +0 -3
  129. package/dist/model/openapi/open-api-types.js.map +0 -1
  130. package/dist/model/openapi/open-api.d.ts +0 -16
  131. package/dist/model/openapi/open-api.js +0 -34
  132. package/dist/model/openapi/open-api.js.map +0 -1
  133. package/dist/model/openapi/openapi-type-file.d.ts +0 -7
  134. package/dist/model/openapi/openapi-type-file.js +0 -17
  135. package/dist/model/openapi/openapi-type-file.js.map +0 -1
  136. package/dist/model/outputFile.d.ts +0 -10
  137. package/dist/model/outputFile.js +0 -22
  138. package/dist/model/outputFile.js.map +0 -1
  139. package/dist/model/types-repository.d.ts +0 -16
  140. package/dist/model/types-repository.js +0 -54
  141. package/dist/model/types-repository.js.map +0 -1
  142. package/dist/service/apex-file-reader.d.ts +0 -14
  143. package/dist/service/apex-file-reader.js +0 -49
  144. package/dist/service/apex-file-reader.js.map +0 -1
  145. package/dist/service/file-system.d.ts +0 -14
  146. package/dist/service/file-system.js +0 -48
  147. package/dist/service/file-system.js.map +0 -1
  148. package/dist/service/file-writer.d.ts +0 -6
  149. package/dist/service/file-writer.js +0 -57
  150. package/dist/service/file-writer.js.map +0 -1
  151. package/dist/service/manifest-factory.d.ts +0 -10
  152. package/dist/service/manifest-factory.js +0 -17
  153. package/dist/service/manifest-factory.js.map +0 -1
  154. package/dist/service/metadata-processor.d.ts +0 -3
  155. package/dist/service/metadata-processor.js +0 -17
  156. package/dist/service/metadata-processor.js.map +0 -1
  157. package/dist/service/parser.d.ts +0 -21
  158. package/dist/service/parser.js +0 -138
  159. package/dist/service/parser.js.map +0 -1
  160. package/dist/service/state.d.ts +0 -9
  161. package/dist/service/state.js +0 -20
  162. package/dist/service/state.js.map +0 -1
  163. package/dist/service/walkers/class-walker.d.ts +0 -4
  164. package/dist/service/walkers/class-walker.js +0 -33
  165. package/dist/service/walkers/class-walker.js.map +0 -1
  166. package/dist/service/walkers/enum-walker.d.ts +0 -4
  167. package/dist/service/walkers/enum-walker.js +0 -11
  168. package/dist/service/walkers/enum-walker.js.map +0 -1
  169. package/dist/service/walkers/interface-walker.d.ts +0 -4
  170. package/dist/service/walkers/interface-walker.js +0 -15
  171. package/dist/service/walkers/interface-walker.js.map +0 -1
  172. package/dist/service/walkers/walker-factory.d.ts +0 -5
  173. package/dist/service/walkers/walker-factory.js +0 -21
  174. package/dist/service/walkers/walker-factory.js.map +0 -1
  175. package/dist/service/walkers/walker.d.ts +0 -19
  176. package/dist/service/walkers/walker.js +0 -17
  177. package/dist/service/walkers/walker.js.map +0 -1
  178. package/dist/settings.d.ts +0 -67
  179. package/dist/settings.js +0 -92
  180. package/dist/settings.js.map +0 -1
  181. package/dist/test-helpers/AnnotationBuilder.d.ts +0 -12
  182. package/dist/test-helpers/AnnotationBuilder.js +0 -31
  183. package/dist/test-helpers/AnnotationBuilder.js.map +0 -1
  184. package/dist/test-helpers/ClassMirrorBuilder.d.ts +0 -22
  185. package/dist/test-helpers/ClassMirrorBuilder.js +0 -64
  186. package/dist/test-helpers/ClassMirrorBuilder.js.map +0 -1
  187. package/dist/test-helpers/DocCommentAnnotationBuilder.d.ts +0 -8
  188. package/dist/test-helpers/DocCommentAnnotationBuilder.js +0 -26
  189. package/dist/test-helpers/DocCommentAnnotationBuilder.js.map +0 -1
  190. package/dist/test-helpers/DocCommentBuilder.d.ts +0 -12
  191. package/dist/test-helpers/DocCommentBuilder.js +0 -38
  192. package/dist/test-helpers/DocCommentBuilder.js.map +0 -1
  193. package/dist/test-helpers/FieldMirrorBuilder.d.ts +0 -18
  194. package/dist/test-helpers/FieldMirrorBuilder.js +0 -54
  195. package/dist/test-helpers/FieldMirrorBuilder.js.map +0 -1
  196. package/dist/test-helpers/InterfaceMirrorBuilder.d.ts +0 -16
  197. package/dist/test-helpers/InterfaceMirrorBuilder.js +0 -43
  198. package/dist/test-helpers/InterfaceMirrorBuilder.js.map +0 -1
  199. package/dist/test-helpers/MethodMirrorBuilder.d.ts +0 -29
  200. package/dist/test-helpers/MethodMirrorBuilder.js +0 -72
  201. package/dist/test-helpers/MethodMirrorBuilder.js.map +0 -1
  202. package/dist/test-helpers/SettingsBuilder.d.ts +0 -8
  203. package/dist/test-helpers/SettingsBuilder.js +0 -28
  204. package/dist/test-helpers/SettingsBuilder.js.map +0 -1
  205. package/dist/transpiler/factory.d.ts +0 -6
  206. package/dist/transpiler/factory.js +0 -33
  207. package/dist/transpiler/factory.js.map +0 -1
  208. package/dist/transpiler/file-container.d.ts +0 -6
  209. package/dist/transpiler/file-container.js +0 -16
  210. package/dist/transpiler/file-container.js.map +0 -1
  211. package/dist/transpiler/generator-choices.d.ts +0 -1
  212. package/dist/transpiler/generator-choices.js +0 -3
  213. package/dist/transpiler/generator-choices.js.map +0 -1
  214. package/dist/transpiler/markdown/class-file-generatorHelper.d.ts +0 -9
  215. package/dist/transpiler/markdown/class-file-generatorHelper.js +0 -61
  216. package/dist/transpiler/markdown/class-file-generatorHelper.js.map +0 -1
  217. package/dist/transpiler/markdown/docsify/docsify-docs-processor.d.ts +0 -6
  218. package/dist/transpiler/markdown/docsify/docsify-docs-processor.js +0 -13
  219. package/dist/transpiler/markdown/docsify/docsify-docs-processor.js.map +0 -1
  220. package/dist/transpiler/markdown/jekyll/jekyll-docsProcessor.d.ts +0 -11
  221. package/dist/transpiler/markdown/jekyll/jekyll-docsProcessor.js +0 -51
  222. package/dist/transpiler/markdown/jekyll/jekyll-docsProcessor.js.map +0 -1
  223. package/dist/transpiler/markdown/markdown-transpiler-base.d.ts +0 -11
  224. package/dist/transpiler/markdown/markdown-transpiler-base.js +0 -27
  225. package/dist/transpiler/markdown/markdown-transpiler-base.js.map +0 -1
  226. package/dist/transpiler/markdown/plain-markdown/class-template.d.ts +0 -1
  227. package/dist/transpiler/markdown/plain-markdown/class-template.js +0 -77
  228. package/dist/transpiler/markdown/plain-markdown/class-template.js.map +0 -1
  229. package/dist/transpiler/markdown/plain-markdown/constructors-partial-template.d.ts +0 -1
  230. package/dist/transpiler/markdown/plain-markdown/constructors-partial-template.js +0 -36
  231. package/dist/transpiler/markdown/plain-markdown/constructors-partial-template.js.map +0 -1
  232. package/dist/transpiler/markdown/plain-markdown/documentable-partial-template.d.ts +0 -1
  233. package/dist/transpiler/markdown/plain-markdown/documentable-partial-template.js +0 -30
  234. package/dist/transpiler/markdown/plain-markdown/documentable-partial-template.js.map +0 -1
  235. package/dist/transpiler/markdown/plain-markdown/enum-template.d.ts +0 -1
  236. package/dist/transpiler/markdown/plain-markdown/enum-template.js +0 -16
  237. package/dist/transpiler/markdown/plain-markdown/enum-template.js.map +0 -1
  238. package/dist/transpiler/markdown/plain-markdown/fieldsPartialTemplate.d.ts +0 -1
  239. package/dist/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js +0 -27
  240. package/dist/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js.map +0 -1
  241. package/dist/transpiler/markdown/plain-markdown/grouped-members-partial-template.d.ts +0 -1
  242. package/dist/transpiler/markdown/plain-markdown/grouped-members-partial-template.js +0 -10
  243. package/dist/transpiler/markdown/plain-markdown/grouped-members-partial-template.js.map +0 -1
  244. package/dist/transpiler/markdown/plain-markdown/interface-template.d.ts +0 -1
  245. package/dist/transpiler/markdown/plain-markdown/interface-template.js +0 -20
  246. package/dist/transpiler/markdown/plain-markdown/interface-template.js.map +0 -1
  247. package/dist/transpiler/markdown/plain-markdown/methods-partial-template.d.ts +0 -1
  248. package/dist/transpiler/markdown/plain-markdown/methods-partial-template.js +0 -47
  249. package/dist/transpiler/markdown/plain-markdown/methods-partial-template.js.map +0 -1
  250. package/dist/transpiler/markdown/plain-markdown/type-doc-partial.d.ts +0 -1
  251. package/dist/transpiler/markdown/plain-markdown/type-doc-partial.js +0 -31
  252. package/dist/transpiler/markdown/plain-markdown/type-doc-partial.js.map +0 -1
  253. package/dist/transpiler/openapi/open-api-docs-processor.d.ts +0 -13
  254. package/dist/transpiler/openapi/open-api-docs-processor.js +0 -78
  255. package/dist/transpiler/openapi/open-api-docs-processor.js.map +0 -1
  256. package/dist/transpiler/openapi/parsers/Builder.d.ts +0 -16
  257. package/dist/transpiler/openapi/parsers/Builder.js +0 -30
  258. package/dist/transpiler/openapi/parsers/Builder.js.map +0 -1
  259. package/dist/transpiler/openapi/parsers/MethodParser.d.ts +0 -20
  260. package/dist/transpiler/openapi/parsers/MethodParser.js +0 -190
  261. package/dist/transpiler/openapi/parsers/MethodParser.js.map +0 -1
  262. package/dist/transpiler/openapi/parsers/ParameterObjectBuilder.d.ts +0 -7
  263. package/dist/transpiler/openapi/parsers/ParameterObjectBuilder.js +0 -11
  264. package/dist/transpiler/openapi/parsers/ParameterObjectBuilder.js.map +0 -1
  265. package/dist/transpiler/openapi/parsers/ReferenceBuilder.d.ts +0 -39
  266. package/dist/transpiler/openapi/parsers/ReferenceBuilder.js +0 -250
  267. package/dist/transpiler/openapi/parsers/ReferenceBuilder.js.map +0 -1
  268. package/dist/transpiler/openapi/parsers/RequestBodyBuilder.d.ts +0 -10
  269. package/dist/transpiler/openapi/parsers/RequestBodyBuilder.js +0 -20
  270. package/dist/transpiler/openapi/parsers/RequestBodyBuilder.js.map +0 -1
  271. package/dist/transpiler/openapi/parsers/ResponsesBuilder.d.ts +0 -7
  272. package/dist/transpiler/openapi/parsers/ResponsesBuilder.js +0 -22
  273. package/dist/transpiler/openapi/parsers/ResponsesBuilder.js.map +0 -1
  274. package/dist/transpiler/processor-type-transpiler.d.ts +0 -10
  275. package/dist/transpiler/processor-type-transpiler.js +0 -9
  276. package/dist/transpiler/processor-type-transpiler.js.map +0 -1
  277. package/dist/transpiler/transpiler.d.ts +0 -5
  278. package/dist/transpiler/transpiler.js +0 -30
  279. package/dist/transpiler/transpiler.js.map +0 -1
  280. package/dist/util/error-logger.d.ts +0 -8
  281. package/dist/util/error-logger.js +0 -90
  282. package/dist/util/error-logger.js.map +0 -1
  283. package/dist/util/logger.d.ts +0 -21
  284. package/dist/util/logger.js +0 -61
  285. package/dist/util/logger.js.map +0 -1
  286. package/dist/util/string-utils.d.ts +0 -2
  287. package/dist/util/string-utils.js +0 -15
  288. package/dist/util/string-utils.js.map +0 -1
@@ -0,0 +1,109 @@
1
+ import { adaptDescribable } from '../documentables';
2
+
3
+ function linkGenerator(typeName: string) {
4
+ return typeName;
5
+ }
6
+
7
+ describe('describable', () => {
8
+ it('returns undefined if describable is undefined', () => {
9
+ const result = adaptDescribable(undefined, linkGenerator);
10
+
11
+ expect(result).toEqual({
12
+ description: undefined,
13
+ });
14
+ });
15
+
16
+ it('returns an empty array if describable is an empty array', () => {
17
+ const result = adaptDescribable([], linkGenerator);
18
+
19
+ expect(result).toEqual({
20
+ description: [],
21
+ });
22
+ });
23
+
24
+ it('returns a string if describable contains a string', () => {
25
+ const describable = ['This is a test'];
26
+
27
+ const result = adaptDescribable(describable, linkGenerator);
28
+
29
+ expect(result).toEqual({
30
+ description: ['This is a test'],
31
+ });
32
+ });
33
+
34
+ it('separates strings with an empty line', () => {
35
+ const describable = ['This is a test', 'This is another test'];
36
+
37
+ const result = adaptDescribable(describable, linkGenerator);
38
+
39
+ expect(result).toEqual({
40
+ description: ['This is a test', { __type: 'empty-line' }, 'This is another test'],
41
+ });
42
+ });
43
+
44
+ it('returns a code block if describable contains code', () => {
45
+ const describable = ['```typescript', 'const a = 1;', '```'];
46
+
47
+ const result = adaptDescribable(describable, linkGenerator);
48
+
49
+ expect(result).toEqual({
50
+ description: [
51
+ {
52
+ __type: 'code-block',
53
+ language: 'typescript',
54
+ content: ['const a = 1;'],
55
+ },
56
+ ],
57
+ });
58
+ });
59
+
60
+ it('sets the code blocks language to apex if one is not provided', () => {
61
+ const describable = ['```', 'const a = 1;', '```'];
62
+
63
+ const result = adaptDescribable(describable, linkGenerator);
64
+
65
+ expect(result).toEqual({
66
+ description: [
67
+ {
68
+ __type: 'code-block',
69
+ language: 'apex',
70
+ content: ['const a = 1;'],
71
+ },
72
+ ],
73
+ });
74
+ });
75
+
76
+ it('returns a code block followed by an empty line and then whatever content is in the describable', () => {
77
+ const describable = ['```typescript', 'const a = 1;', '```', 'This is a test'];
78
+
79
+ const result = adaptDescribable(describable, linkGenerator);
80
+
81
+ expect(result).toEqual({
82
+ description: [
83
+ {
84
+ __type: 'code-block',
85
+ language: 'typescript',
86
+ content: ['const a = 1;'],
87
+ },
88
+ { __type: 'empty-line' },
89
+ 'This is a test',
90
+ ],
91
+ });
92
+ });
93
+
94
+ it('returns a code block even when there is no closing tag', () => {
95
+ const describable = ['```typescript', 'const a = 1;'];
96
+
97
+ const result = adaptDescribable(describable, linkGenerator);
98
+
99
+ expect(result).toEqual({
100
+ description: [
101
+ {
102
+ __type: 'code-block',
103
+ language: 'typescript',
104
+ content: ['const a = 1;'],
105
+ },
106
+ ],
107
+ });
108
+ });
109
+ });
@@ -1,4 +1,4 @@
1
- import { replaceInlineReferences } from '../references';
1
+ import { replaceInlineReferences } from '../inline';
2
2
  import { Link } from '../types';
3
3
 
4
4
  function getFileLink(typeName: string): Link {
@@ -27,6 +27,17 @@ describe('reference utilities', () => {
27
27
  expect(result).toEqual(expected);
28
28
  });
29
29
 
30
+ describe('replace inline code', () => {
31
+ it('replaces inline code with InlineCode', () => {
32
+ const text = 'This is a test `ClassName`.';
33
+ const result = replaceInlineReferences(text, getFileLink, getEmailLink);
34
+
35
+ const expected = ['This is a test ', { __type: 'inline-code', content: 'ClassName' }, '.'];
36
+
37
+ expect(result).toEqual(expected);
38
+ });
39
+ });
40
+
30
41
  describe('replace inline links', () => {
31
42
  it('replaces links in the format of <<ClassName>>', () => {
32
43
  const text = 'This is a test <<ClassName>>.';
@@ -9,9 +9,9 @@ import {
9
9
  ClassMirrorWithInheritanceChain,
10
10
  FieldMirrorWithInheritance,
11
11
  PropertyMirrorWithInheritance,
12
+ GetRenderableContentByTypeName,
12
13
  } from './types';
13
14
  import { adaptDescribable, adaptDocumentable } from './documentables';
14
- import { GetRenderableContentByTypeName } from './references';
15
15
  import { adaptConstructor, adaptMethod } from './methods-and-constructors';
16
16
  import { adaptFieldOrProperty } from './fields-and-properties';
17
17
 
@@ -1,6 +1,6 @@
1
1
  import { CustomTag, RenderableDocumentation, RenderableContent, CodeBlock } from './types';
2
- import { Describable, Documentable } from './types';
3
- import { GetRenderableContentByTypeName, replaceInlineReferences } from './references';
2
+ import { Describable, Documentable, GetRenderableContentByTypeName } from './types';
3
+ import { replaceInlineReferences } from './inline';
4
4
  import { isEmptyLine } from './type-utils';
5
5
 
6
6
  export function adaptDescribable(
@@ -32,7 +32,6 @@ export function adaptDescribable(
32
32
  codeBlockLines.push(currentLine);
33
33
  i++;
34
34
  }
35
- console.log('codeBlockLines', codeBlockLines);
36
35
  content = [
37
36
  ...content,
38
37
  {
@@ -55,68 +54,9 @@ export function adaptDescribable(
55
54
  }
56
55
  return (
57
56
  content
58
- .flatMap((line) => line)
59
57
  // If the last element is an empty line, remove it
60
58
  .filter((line, index, lines) => !(isEmptyLine(line) && index === lines.length - 1))
61
59
  );
62
-
63
- // TODO: Now we want to also extract code blocks if we encounter any line that starts with "```"
64
-
65
- // return describable.reduce<RenderableContent[]>(
66
- // (acc, line) => {
67
- // if (line.trim() === '') {
68
- // return [...acc, { __type: 'empty-line' }];
69
- // }
70
- //
71
- // // The language might or might not be present after ```
72
- // const codeBlockMatch = line.match(/^```([a-zA-Z]*)$/);
73
- // if (codeBlockMatch) {
74
- // console.log('codeBlockMatch', codeBlockMatch);
75
- // // Check if the language is present, if not, fallback to "apex"
76
- // const language = codeBlockMatch[1] || 'apex';
77
- // const codeBlockLines: string[] = [];
78
- // let index = acc.length + 1;
79
- // while (index < describable.length) {
80
- // const currentLine = describable[index];
81
- // if (currentLine.trim() === '```') {
82
- // break;
83
- // }
84
- // codeBlockLines.push(currentLine);
85
- // index++;
86
- // }
87
- // return [
88
- // ...acc,
89
- // {
90
- // __type: 'code-block',
91
- // language,
92
- // content: codeBlockLines,
93
- // },
94
- // ];
95
- // }
96
- //
97
- // return [
98
- // ...acc,
99
- // ...replaceInlineReferences(line, linkGenerator),
100
- // {
101
- // __type: 'empty-line',
102
- // },
103
- // ];
104
- // },
105
- // <RenderableContent[]>[],
106
- // );
107
-
108
- // return (
109
- // describable
110
- // .map<RenderableContent[]>((line) => [
111
- // ...replaceInlineReferences(line, linkGenerator),
112
- // {
113
- // __type: 'empty-line',
114
- // },
115
- // ])
116
- // .flatMap((line) => line)
117
- // // If the last element is an empty line, remove it
118
- // .filter((line, index, lines) => !(isEmptyLine(line) && index === lines.length - 1))
119
- // );
120
60
  }
121
61
 
122
62
  return {
@@ -1,6 +1,11 @@
1
- import { CodeBlock, FieldMirrorWithInheritance, PropertyMirrorWithInheritance, RenderableField } from './types';
1
+ import {
2
+ CodeBlock,
3
+ FieldMirrorWithInheritance,
4
+ PropertyMirrorWithInheritance,
5
+ RenderableField,
6
+ GetRenderableContentByTypeName,
7
+ } from './types';
2
8
  import { adaptDocumentable } from './documentables';
3
- import { GetRenderableContentByTypeName } from './references';
4
9
 
5
10
  export function adaptFieldOrProperty(
6
11
  field: FieldMirrorWithInheritance | PropertyMirrorWithInheritance,
@@ -1,6 +1,10 @@
1
- import { Link, RenderableContent, StringOrLink } from './types';
1
+ import { InlineCode, Link, RenderableContent } from './types';
2
+ import { pipe } from 'fp-ts/function';
3
+ import { apply } from '../../util/fp';
2
4
 
3
- export type GetRenderableContentByTypeName = (typeName: string) => StringOrLink;
5
+ type InlineRenderableContent = InlineCode | Link | string;
6
+
7
+ type ToInlineRenderableContent = (typeName: string) => InlineRenderableContent;
4
8
 
5
9
  function defaultGetEmailByReference(email: string): Link {
6
10
  return {
@@ -12,22 +16,51 @@ function defaultGetEmailByReference(email: string): Link {
12
16
 
13
17
  export function replaceInlineReferences(
14
18
  text: string,
15
- linkReplacer: GetRenderableContentByTypeName,
16
- emailReplacer: GetRenderableContentByTypeName = defaultGetEmailByReference,
19
+ linkReplacer: ToInlineRenderableContent,
20
+ emailReplacer: ToInlineRenderableContent = defaultGetEmailByReference,
17
21
  ): RenderableContent[] {
18
- return replaceInlineEmails(replaceInlineLinks([text], linkReplacer), emailReplacer);
22
+ const inlineLinks = apply(replaceInlineLinks, linkReplacer);
23
+ const inlineEmails = apply(replaceInlineEmails, emailReplacer);
24
+
25
+ return pipe(inlineCode([text]), inlineLinks, inlineEmails);
26
+ }
27
+
28
+ function inlineCode(renderableContents: RenderableContent[]): RenderableContent[] {
29
+ return renderableContents.flatMap((renderableContent) => inlineCodeContent(renderableContent));
30
+ }
31
+
32
+ // Replace string that is inline code with InlineCode
33
+ // Inline code is any text that backticks surround
34
+ function inlineCodeContent(renderableContent: RenderableContent): RenderableContent[] {
35
+ if (typeof renderableContent !== 'string') {
36
+ return [renderableContent];
37
+ }
38
+
39
+ function inlineCodeLink(text: string): InlineCode {
40
+ return {
41
+ __type: 'inline-code',
42
+ content: text,
43
+ };
44
+ }
45
+
46
+ const text = renderableContent;
47
+
48
+ // Matches any text surrounded by backticks
49
+ const codeFormatRegEx = '`([^`]*)`';
50
+ const matches = match(codeFormatRegEx, text);
51
+ return createRenderableContents(matches, text, inlineCodeLink);
19
52
  }
20
53
 
21
54
  function replaceInlineLinks(
55
+ getLinkByTypeName: ToInlineRenderableContent,
22
56
  renderableContents: RenderableContent[],
23
- getLinkByTypeName: GetRenderableContentByTypeName,
24
57
  ): RenderableContent[] {
25
58
  return renderableContents.flatMap((renderableContent) => inlineLinkContent(renderableContent, getLinkByTypeName));
26
59
  }
27
60
 
28
61
  function inlineLinkContent(
29
62
  renderableContent: RenderableContent,
30
- getLinkByTypeName: GetRenderableContentByTypeName,
63
+ getLinkByTypeName: ToInlineRenderableContent,
31
64
  ): RenderableContent[] {
32
65
  if (typeof renderableContent !== 'string') {
33
66
  return [renderableContent];
@@ -42,15 +75,15 @@ function inlineLinkContent(
42
75
  }
43
76
 
44
77
  export function replaceInlineEmails(
78
+ getLinkByTypeName: ToInlineRenderableContent,
45
79
  renderableContents: RenderableContent[],
46
- getLinkByTypeName: GetRenderableContentByTypeName,
47
80
  ): RenderableContent[] {
48
81
  return renderableContents.flatMap((renderableContent) => inlineEmailContent(renderableContent, getLinkByTypeName));
49
82
  }
50
83
 
51
84
  function inlineEmailContent(
52
85
  renderableContent: RenderableContent,
53
- getLinkByTypeName: GetRenderableContentByTypeName,
86
+ getLinkByTypeName: ToInlineRenderableContent,
54
87
  ): RenderableContent[] {
55
88
  if (typeof renderableContent !== 'string') {
56
89
  return [renderableContent];
@@ -79,7 +112,7 @@ function match(regex: string, text: string) {
79
112
  return matches;
80
113
  }
81
114
 
82
- function createRenderableContents(matches: RegExpExecArray[], text: string, linker: GetRenderableContentByTypeName) {
115
+ function createRenderableContents(matches: RegExpExecArray[], text: string, linker: ToInlineRenderableContent) {
83
116
  if (matches.length === 0) {
84
117
  return [text];
85
118
  }
@@ -1,7 +1,12 @@
1
1
  import { ConstructorMirror, MethodMirror, ParameterMirror, ThrowsAnnotation } from '@cparra/apex-reflection';
2
- import { RenderableConstructor, RenderableMethod, MethodMirrorWithInheritance, CodeBlock } from './types';
2
+ import {
3
+ RenderableConstructor,
4
+ RenderableMethod,
5
+ MethodMirrorWithInheritance,
6
+ CodeBlock,
7
+ GetRenderableContentByTypeName,
8
+ } from './types';
3
9
  import { adaptDescribable, adaptDocumentable } from './documentables';
4
- import { GetRenderableContentByTypeName } from './references';
5
10
  import { Documentable } from './types';
6
11
 
7
12
  export function adaptMethod(
@@ -1,4 +1,4 @@
1
- import { CodeBlock, EmptyLine, RenderableContent } from './types';
1
+ import { CodeBlock, EmptyLine, InlineCode, RenderableContent } from './types';
2
2
 
3
3
  export function isEmptyLine(content: RenderableContent): content is EmptyLine {
4
4
  return Object.keys(content).includes('__type') && (content as { __type: string }).__type === 'empty-line';
@@ -7,3 +7,7 @@ export function isEmptyLine(content: RenderableContent): content is EmptyLine {
7
7
  export function isCodeBlock(content: RenderableContent): content is CodeBlock {
8
8
  return Object.keys(content).includes('__type') && (content as { __type: string }).__type === 'code-block';
9
9
  }
10
+
11
+ export function isInlineCode(content: RenderableContent): content is InlineCode {
12
+ return Object.keys(content).includes('__type') && (content as { __type: string }).__type === 'inline-code';
13
+ }
@@ -36,7 +36,9 @@ export type EmptyLine = {
36
36
 
37
37
  export type StringOrLink = string | Link;
38
38
 
39
- export type RenderableContent = StringOrLink | EmptyLine | CodeBlock;
39
+ export type GetRenderableContentByTypeName = (typeName: string) => StringOrLink;
40
+
41
+ export type RenderableContent = StringOrLink | EmptyLine | CodeBlock | InlineCode;
40
42
 
41
43
  type EnumValue = {
42
44
  value: string;
@@ -59,6 +61,11 @@ type CodeBlock = {
59
61
  content: string[];
60
62
  };
61
63
 
64
+ type InlineCode = {
65
+ readonly __type: 'inline-code';
66
+ content: string;
67
+ };
68
+
62
69
  type RenderableDocumentation = {
63
70
  annotations?: Annotation[];
64
71
  description?: RenderableContent[];
@@ -8,7 +8,7 @@ import { classMarkdownTemplate } from '../transpiler/markdown/plain-markdown/cla
8
8
  import { enumMarkdownTemplate } from '../transpiler/markdown/plain-markdown/enum-template';
9
9
  import { interfaceMarkdownTemplate } from '../transpiler/markdown/plain-markdown/interface-template';
10
10
  import { CodeBlock, RenderableContent, StringOrLink } from './adapters/types';
11
- import { isCodeBlock, isEmptyLine } from './adapters/type-utils';
11
+ import { isCodeBlock, isEmptyLine, isInlineCode } from './adapters/type-utils';
12
12
  import { groupedMembersPartialTemplate } from '../transpiler/markdown/plain-markdown/grouped-members-partial-template';
13
13
 
14
14
  export type CompilationRequest = {
@@ -94,6 +94,9 @@ const resolveRenderableContent = (description?: RenderableContent[]): string =>
94
94
  }
95
95
  if (isCodeBlock(curr)) {
96
96
  return acc + convertCodeBlock(curr) + '\n';
97
+ }
98
+ if (isInlineCode(curr)) {
99
+ return acc + inlineCode(curr.content).toString() + ' ';
97
100
  } else {
98
101
  return acc + Handlebars.escapeExpression(link(curr)).trim() + ' ';
99
102
  }
@@ -17,7 +17,7 @@ export class ApexFileReader {
17
17
  const directoryContents = fileSystem.readDirectory(rootPath);
18
18
  directoryContents.forEach((currentFilePath) => {
19
19
  const currentPath = fileSystem.joinPath(rootPath, currentFilePath);
20
- if (this.readRecursively && fileSystem.isDirectory(currentPath)) {
20
+ if (fileSystem.isDirectory(currentPath)) {
21
21
  bundles = bundles.concat(this.processFiles(fileSystem, currentPath));
22
22
  }
23
23
 
@@ -44,8 +44,4 @@ export class ApexFileReader {
44
44
  private static get sourceDirectory() {
45
45
  return Settings.getInstance().sourceDirectory;
46
46
  }
47
-
48
- private static get readRecursively() {
49
- return Settings.getInstance().recursive;
50
- }
51
47
  }
package/src/settings.ts CHANGED
@@ -24,13 +24,11 @@ export type TargetType = {
24
24
 
25
25
  export interface SettingsConfig {
26
26
  sourceDirectory: string;
27
- recursive: boolean;
28
27
  scope: string[];
29
28
  outputDir: string;
30
29
  targetGenerator: GeneratorChoices;
31
30
  indexOnly: boolean;
32
31
  defaultGroupName: string;
33
- sanitizeHtml: boolean;
34
32
  openApiTitle?: string;
35
33
  title: string;
36
34
  namespace?: string;
@@ -64,10 +62,6 @@ export class Settings {
64
62
  return this.config.sourceDirectory;
65
63
  }
66
64
 
67
- get recursive(): boolean {
68
- return this.config.recursive;
69
- }
70
-
71
65
  get scope(): string[] {
72
66
  return this.config.scope;
73
67
  }
@@ -84,10 +78,6 @@ export class Settings {
84
78
  return this.config.indexOnly;
85
79
  }
86
80
 
87
- get sanitizeHtml(): boolean {
88
- return this.config.sanitizeHtml;
89
- }
90
-
91
81
  public getDefaultGroupName(): string {
92
82
  return this.config.defaultGroupName;
93
83
  }
@@ -8,13 +8,11 @@ export class SettingsBuilder {
8
8
  build(): SettingsConfig {
9
9
  return {
10
10
  sourceDirectory: './',
11
- recursive: true,
12
11
  scope: [],
13
12
  outputDir: './',
14
13
  targetGenerator: 'openapi',
15
14
  indexOnly: false,
16
15
  defaultGroupName: 'Misc',
17
- sanitizeHtml: true,
18
16
  openApiTitle: 'Apex API',
19
17
  openApiFileName: 'openapi',
20
18
  title: 'Classes',
@@ -13,7 +13,7 @@ export const constructorsPartialTemplate = `
13
13
  | Name | Type | Description |
14
14
  |------|------|-------------|
15
15
  {{#each parameters.value}}
16
- | {{name}} | {{type}} | {{description}} |
16
+ | {{name}} | {{link type}} | {{description}} |
17
17
  {{/each}}
18
18
  {{/if}}
19
19
 
package/src/util/fp.ts ADDED
@@ -0,0 +1,3 @@
1
+ export function apply<T extends unknown[], U extends unknown[], R>(fn: (...args: [...T, ...U]) => R, ...front: T) {
2
+ return (...tailArgs: U) => fn(...front, ...tailArgs);
3
+ }
@@ -1,3 +0,0 @@
1
- import * as E from 'fp-ts/Either';
2
- export declare function extendExpect(): void;
3
- export declare function assertEither<T, U>(result: E.Either<T, U>, assertion: (data: U) => void): void;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.assertEither = exports.extendExpect = void 0;
27
- const E = __importStar(require("fp-ts/Either"));
28
- function extendExpect() {
29
- expect.extend({
30
- documentationBundleHasLength(received, length) {
31
- return {
32
- pass: E.isRight(received) && received.right.docs.length === length,
33
- message: () => `Expected documentation bundle to have length ${length}`,
34
- };
35
- },
36
- firstDocContains(doc, content) {
37
- return {
38
- pass: doc.docs[0].docContents.includes(content),
39
- message: () => `Expected documentation to contain ${content}. Got ${doc.docs[0].docContents}`,
40
- };
41
- },
42
- firstDocContainsNot(doc, content) {
43
- return {
44
- pass: !doc.docs[0].docContents.includes(content),
45
- message: () => `Expected documentation to not contain ${content}. Got ${doc.docs[0].docContents}`,
46
- };
47
- },
48
- });
49
- }
50
- exports.extendExpect = extendExpect;
51
- function assertEither(result, assertion) {
52
- E.match((error) => fail(error), (data) => assertion(data))(result);
53
- }
54
- exports.assertEither = assertEither;
55
- //# sourceMappingURL=expect-extensions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expect-extensions.js","sourceRoot":"","sources":["../../../src/__spec__/core/expect-extensions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAGlC,SAAgB,YAAY;IAC1B,MAAM,CAAC,MAAM,CAAC;QACZ,4BAA4B,CAAC,QAAiD,EAAE,MAAc;YAC5F,OAAO;gBACL,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,MAAM;gBAClE,OAAO,EAAE,GAAG,EAAE,CAAC,gDAAgD,MAAM,EAAE;aACxE,CAAC;QACJ,CAAC;QACD,gBAAgB,CAAC,GAAwB,EAAE,OAAe;YACxD,OAAO;gBACL,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAC/C,OAAO,EAAE,GAAG,EAAE,CAAC,qCAAqC,OAAO,SAAS,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;aAC9F,CAAC;QACJ,CAAC;QACD,mBAAmB,CAAC,GAAwB,EAAE,OAAe;YAC3D,OAAO;gBACL,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAChD,OAAO,EAAE,GAAG,EAAE,CAAC,yCAAyC,OAAO,SAAS,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;aAClG,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AArBD,oCAqBC;AAED,SAAgB,YAAY,CAAO,MAAsB,EAAE,SAA4B;IACrF,CAAC,CAAC,KAAK,CACL,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EACtB,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAC1B,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AALD,oCAKC"}
@@ -1 +0,0 @@
1
- export {};