@cparra/apexdocs 3.16.1 → 3.17.0-beta.1

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var logger$1 = require('../logger-Cej7LT-j.js');
4
+ var logger$1 = require('../logger-DBJhh0_O.js');
5
5
  var cosmiconfig = require('cosmiconfig');
6
6
  var yargs = require('yargs');
7
7
  var E = require('fp-ts/Either');
@@ -151,6 +151,11 @@ const markdownOptions = {
151
151
  type: "boolean",
152
152
  describe: "Enable experimental support for documenting Lightning Web Components (LWC).",
153
153
  default: logger$1.markdownDefaults.experimentalLwcSupport
154
+ },
155
+ useParallelProcessing: {
156
+ type: "boolean",
157
+ describe: "Enable parallel processing using worker threads for improved performance on large codebases.",
158
+ default: logger$1.markdownDefaults.useParallelProcessing
154
159
  }
155
160
  };
156
161
 
package/dist/index.d.ts CHANGED
@@ -400,6 +400,7 @@ type CliConfigurableMarkdownConfig = {
400
400
  includeFieldSecurityMetadata: boolean;
401
401
  includeInlineHelpTextMetadata: boolean;
402
402
  experimentalLwcSupport: boolean;
403
+ useParallelProcessing: boolean;
403
404
  };
404
405
 
405
406
  type UserDefinedMarkdownConfig = {
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var logger = require('./logger-Cej7LT-j.js');
4
+ var logger = require('./logger-DBJhh0_O.js');
5
5
  var E = require('fp-ts/Either');
6
6
  require('fp-ts/function');
7
7
  require('fp-ts/TaskEither');
@@ -179,19 +179,19 @@ const defaultTranslations = {
179
179
  }
180
180
  };
181
181
 
182
- var __defProp$r = Object.defineProperty;
183
- var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
184
- var __hasOwnProp$r = Object.prototype.hasOwnProperty;
185
- var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
186
- var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
187
- var __spreadValues$r = (a, b) => {
182
+ var __defProp$s = Object.defineProperty;
183
+ var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
184
+ var __hasOwnProp$s = Object.prototype.hasOwnProperty;
185
+ var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
186
+ var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
187
+ var __spreadValues$s = (a, b) => {
188
188
  for (var prop in b || (b = {}))
189
- if (__hasOwnProp$r.call(b, prop))
190
- __defNormalProp$r(a, prop, b[prop]);
191
- if (__getOwnPropSymbols$r)
192
- for (var prop of __getOwnPropSymbols$r(b)) {
193
- if (__propIsEnum$r.call(b, prop))
194
- __defNormalProp$r(a, prop, b[prop]);
189
+ if (__hasOwnProp$s.call(b, prop))
190
+ __defNormalProp$s(a, prop, b[prop]);
191
+ if (__getOwnPropSymbols$s)
192
+ for (var prop of __getOwnPropSymbols$s(b)) {
193
+ if (__propIsEnum$s.call(b, prop))
194
+ __defNormalProp$s(a, prop, b[prop]);
195
195
  }
196
196
  return a;
197
197
  };
@@ -207,7 +207,7 @@ function isObjectWithStringKeys(value) {
207
207
  return value !== null && typeof value === "object" && !Array.isArray(value);
208
208
  }
209
209
  function deepMerge(target, source) {
210
- const result = __spreadValues$r({}, target);
210
+ const result = __spreadValues$s({}, target);
211
211
  for (const key in source) {
212
212
  if (Object.prototype.hasOwnProperty.call(source, key)) {
213
213
  const sourceValue = source[key];
@@ -321,25 +321,25 @@ function isInlineCode(content) {
321
321
  return Object.keys(content).includes("__type") && content.__type === "inline-code";
322
322
  }
323
323
 
324
- var __defProp$q = Object.defineProperty;
325
- var __defProps$p = Object.defineProperties;
326
- var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
327
- var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
328
- var __hasOwnProp$q = Object.prototype.hasOwnProperty;
329
- var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
330
- var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
331
- var __spreadValues$q = (a, b) => {
324
+ var __defProp$r = Object.defineProperty;
325
+ var __defProps$q = Object.defineProperties;
326
+ var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
327
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
328
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
329
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
330
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
331
+ var __spreadValues$r = (a, b) => {
332
332
  for (var prop in b || (b = {}))
333
- if (__hasOwnProp$q.call(b, prop))
334
- __defNormalProp$q(a, prop, b[prop]);
335
- if (__getOwnPropSymbols$q)
336
- for (var prop of __getOwnPropSymbols$q(b)) {
337
- if (__propIsEnum$q.call(b, prop))
338
- __defNormalProp$q(a, prop, b[prop]);
333
+ if (__hasOwnProp$r.call(b, prop))
334
+ __defNormalProp$r(a, prop, b[prop]);
335
+ if (__getOwnPropSymbols$r)
336
+ for (var prop of __getOwnPropSymbols$r(b)) {
337
+ if (__propIsEnum$r.call(b, prop))
338
+ __defNormalProp$r(a, prop, b[prop]);
339
339
  }
340
340
  return a;
341
341
  };
342
- var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
342
+ var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
343
343
  function adaptDescribable(describable, linkGenerator) {
344
344
  return {
345
345
  description: describableToRenderableContent(describable, linkGenerator)
@@ -391,7 +391,7 @@ function adaptDocumentable(documentable, linkGenerator, subHeadingLevel) {
391
391
  function extractCustomTags(type) {
392
392
  var _a2, _b2;
393
393
  const baseTags = ["description", "group", "author", "date", "see", "example", "throws", "exception"];
394
- return (_b2 = (_a2 = type.docComment) == null ? void 0 : _a2.annotations.filter((currentAnnotation) => !baseTags.includes(currentAnnotation.name.toLowerCase())).map((currentAnnotation) => __spreadProps$p(__spreadValues$q({}, adaptDescribable(currentAnnotation.bodyLines, linkGenerator)), {
394
+ return (_b2 = (_a2 = type.docComment) == null ? void 0 : _a2.annotations.filter((currentAnnotation) => !baseTags.includes(currentAnnotation.name.toLowerCase())).map((currentAnnotation) => __spreadProps$q(__spreadValues$r({}, adaptDescribable(currentAnnotation.bodyLines, linkGenerator)), {
395
395
  name: currentAnnotation.name
396
396
  }))) != null ? _b2 : [];
397
397
  }
@@ -405,7 +405,7 @@ function adaptDocumentable(documentable, linkGenerator, subHeadingLevel) {
405
405
  var _a2, _b2;
406
406
  return (_b2 = (_a2 = type.docComment) == null ? void 0 : _a2.annotations.filter((currentAnnotation) => currentAnnotation.name.toLowerCase() === "see").map((currentAnnotation) => currentAnnotation.body)) != null ? _b2 : [];
407
407
  }
408
- return __spreadProps$p(__spreadValues$q({}, adaptDescribable((_a = documentable.docComment) == null ? void 0 : _a.descriptionLines, linkGenerator)), {
408
+ return __spreadProps$q(__spreadValues$r({}, adaptDescribable((_a = documentable.docComment) == null ? void 0 : _a.descriptionLines, linkGenerator)), {
409
409
  annotations: documentable.annotations.map((annotation) => annotation.type.toUpperCase()),
410
410
  customTags: extractCustomTags(documentable),
411
411
  example: {
@@ -420,25 +420,25 @@ function adaptDocumentable(documentable, linkGenerator, subHeadingLevel) {
420
420
  });
421
421
  }
422
422
 
423
- var __defProp$p = Object.defineProperty;
424
- var __defProps$o = Object.defineProperties;
425
- var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
426
- var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
427
- var __hasOwnProp$p = Object.prototype.hasOwnProperty;
428
- var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
429
- var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
430
- var __spreadValues$p = (a, b) => {
423
+ var __defProp$q = Object.defineProperty;
424
+ var __defProps$p = Object.defineProperties;
425
+ var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
426
+ var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
427
+ var __hasOwnProp$q = Object.prototype.hasOwnProperty;
428
+ var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
429
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
430
+ var __spreadValues$q = (a, b) => {
431
431
  for (var prop in b || (b = {}))
432
- if (__hasOwnProp$p.call(b, prop))
433
- __defNormalProp$p(a, prop, b[prop]);
434
- if (__getOwnPropSymbols$p)
435
- for (var prop of __getOwnPropSymbols$p(b)) {
436
- if (__propIsEnum$p.call(b, prop))
437
- __defNormalProp$p(a, prop, b[prop]);
432
+ if (__hasOwnProp$q.call(b, prop))
433
+ __defNormalProp$q(a, prop, b[prop]);
434
+ if (__getOwnPropSymbols$q)
435
+ for (var prop of __getOwnPropSymbols$q(b)) {
436
+ if (__propIsEnum$q.call(b, prop))
437
+ __defNormalProp$q(a, prop, b[prop]);
438
438
  }
439
439
  return a;
440
440
  };
441
- var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
441
+ var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
442
442
  function adaptMethod(method, linkGenerator, baseHeadingLevel, translations) {
443
443
  var _a, _b, _c;
444
444
  function buildTitle(method2) {
@@ -468,7 +468,7 @@ function adaptMethod(method, linkGenerator, baseHeadingLevel, translations) {
468
468
  returnType: {
469
469
  headingLevel: baseHeadingLevel + 1,
470
470
  heading: translations.markdown.details.returnType,
471
- value: __spreadProps$o(__spreadValues$p({}, adaptDescribable((_b = (_a = method.docComment) == null ? void 0 : _a.returnAnnotation) == null ? void 0 : _b.bodyLines, linkGenerator)), {
471
+ value: __spreadProps$p(__spreadValues$q({}, adaptDescribable((_b = (_a = method.docComment) == null ? void 0 : _a.returnAnnotation) == null ? void 0 : _b.bodyLines, linkGenerator)), {
472
472
  type: linkGenerator(method.typeReference.rawDeclaration)
473
473
  })
474
474
  },
@@ -527,13 +527,13 @@ function mapParameters(documentable, param, linkGenerator) {
527
527
  const paramAnnotation = (_a = documentable.docComment) == null ? void 0 : _a.paramAnnotations.find(
528
528
  (pa) => pa.paramName.toLowerCase() === param.name.toLowerCase()
529
529
  );
530
- return __spreadProps$o(__spreadValues$p({}, adaptDescribable(paramAnnotation == null ? void 0 : paramAnnotation.bodyLines, linkGenerator)), {
530
+ return __spreadProps$p(__spreadValues$q({}, adaptDescribable(paramAnnotation == null ? void 0 : paramAnnotation.bodyLines, linkGenerator)), {
531
531
  name: param.name,
532
532
  type: linkGenerator(param.typeReference.rawDeclaration)
533
533
  });
534
534
  }
535
535
  function mapThrows(thrown, linkGenerator) {
536
- return __spreadProps$o(__spreadValues$p({}, adaptDescribable(thrown.bodyLines, linkGenerator)), {
536
+ return __spreadProps$p(__spreadValues$q({}, adaptDescribable(thrown.bodyLines, linkGenerator)), {
537
537
  type: linkGenerator(thrown.exceptionName)
538
538
  });
539
539
  }
@@ -626,25 +626,25 @@ ${yamlString}---
626
626
  `;
627
627
  }
628
628
 
629
- var __defProp$o = Object.defineProperty;
630
- var __defProps$n = Object.defineProperties;
631
- var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
632
- var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
633
- var __hasOwnProp$o = Object.prototype.hasOwnProperty;
634
- var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
635
- var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
636
- var __spreadValues$o = (a, b) => {
629
+ var __defProp$p = Object.defineProperty;
630
+ var __defProps$o = Object.defineProperties;
631
+ var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
632
+ var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
633
+ var __hasOwnProp$p = Object.prototype.hasOwnProperty;
634
+ var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
635
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
636
+ var __spreadValues$p = (a, b) => {
637
637
  for (var prop in b || (b = {}))
638
- if (__hasOwnProp$o.call(b, prop))
639
- __defNormalProp$o(a, prop, b[prop]);
640
- if (__getOwnPropSymbols$o)
641
- for (var prop of __getOwnPropSymbols$o(b)) {
642
- if (__propIsEnum$o.call(b, prop))
643
- __defNormalProp$o(a, prop, b[prop]);
638
+ if (__hasOwnProp$p.call(b, prop))
639
+ __defNormalProp$p(a, prop, b[prop]);
640
+ if (__getOwnPropSymbols$p)
641
+ for (var prop of __getOwnPropSymbols$p(b)) {
642
+ if (__propIsEnum$p.call(b, prop))
643
+ __defNormalProp$p(a, prop, b[prop]);
644
644
  }
645
645
  return a;
646
646
  };
647
- var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
647
+ var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
648
648
  function typeToRenderable$1(parsedFile, linkGenerator, config, translations) {
649
649
  function getRenderable() {
650
650
  const { type } = parsedFile;
@@ -663,7 +663,7 @@ function typeToRenderable$1(parsedFile, linkGenerator, config, translations) {
663
663
  return lwcMetadataToRenderable(type, config, translations);
664
664
  }
665
665
  }
666
- return __spreadProps$n(__spreadValues$o({}, getRenderable()), {
666
+ return __spreadProps$o(__spreadValues$p({}, getRenderable()), {
667
667
  filePath: isInSource(parsedFile.source) ? parsedFile.source.filePath : void 0,
668
668
  namespace: config.namespace
669
669
  });
@@ -688,7 +688,7 @@ function baseTypeAdapter(type, linkGenerator, baseHeadingLevel, translations) {
688
688
  };
689
689
  }
690
690
  function enumTypeToEnumSource(enumType, linkGenerator, baseHeadingLevel = 1, translations) {
691
- return __spreadProps$n(__spreadValues$o({
691
+ return __spreadProps$o(__spreadValues$p({
692
692
  type: "enum"
693
693
  }, baseTypeAdapter(enumType, linkGenerator, baseHeadingLevel, translations)), {
694
694
  values: {
@@ -696,7 +696,7 @@ function enumTypeToEnumSource(enumType, linkGenerator, baseHeadingLevel = 1, tra
696
696
  heading: translations.markdown.sections.values,
697
697
  value: enumType.values.map((value) => {
698
698
  var _a;
699
- return __spreadProps$n(__spreadValues$o({}, adaptDescribable((_a = value.docComment) == null ? void 0 : _a.descriptionLines, linkGenerator)), {
699
+ return __spreadProps$o(__spreadValues$p({}, adaptDescribable((_a = value.docComment) == null ? void 0 : _a.descriptionLines, linkGenerator)), {
700
700
  value: value.name
701
701
  });
702
702
  })
@@ -704,7 +704,7 @@ function enumTypeToEnumSource(enumType, linkGenerator, baseHeadingLevel = 1, tra
704
704
  });
705
705
  }
706
706
  function interfaceTypeToInterfaceSource(interfaceType, linkGenerator, baseHeadingLevel = 1, translations) {
707
- return __spreadProps$n(__spreadValues$o({
707
+ return __spreadProps$o(__spreadValues$p({
708
708
  type: "interface"
709
709
  }, baseTypeAdapter(interfaceType, linkGenerator, baseHeadingLevel, translations)), {
710
710
  extends: interfaceType.extended_interfaces.map(linkGenerator),
@@ -718,7 +718,7 @@ function interfaceTypeToInterfaceSource(interfaceType, linkGenerator, baseHeadin
718
718
  });
719
719
  }
720
720
  function classTypeToClassSource(classType, linkGenerator, baseHeadingLevel = 1, translations) {
721
- return __spreadProps$n(__spreadValues$o({
721
+ return __spreadProps$o(__spreadValues$p({
722
722
  type: "class"
723
723
  }, baseTypeAdapter(classType, linkGenerator, baseHeadingLevel, translations)), {
724
724
  classModifier: classType.classModifier,
@@ -762,7 +762,7 @@ function classTypeToClassSource(classType, linkGenerator, baseHeadingLevel = 1,
762
762
  heading: translations.markdown.sections.classes,
763
763
  value: classType.classes.map(
764
764
  (innerClass) => classTypeToClassSource(
765
- __spreadProps$n(__spreadValues$o({}, innerClass), { inheritanceChain: [] }),
765
+ __spreadProps$o(__spreadValues$p({}, innerClass), { inheritanceChain: [] }),
766
766
  linkGenerator,
767
767
  baseHeadingLevel + 2,
768
768
  translations
@@ -1133,6 +1133,130 @@ function toMap(metadata) {
1133
1133
  return map;
1134
1134
  }
1135
1135
 
1136
+ var __defProp$o = Object.defineProperty;
1137
+ var __defProps$n = Object.defineProperties;
1138
+ var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
1139
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
1140
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
1141
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
1142
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1143
+ var __spreadValues$o = (a, b) => {
1144
+ for (var prop in b || (b = {}))
1145
+ if (__hasOwnProp$o.call(b, prop))
1146
+ __defNormalProp$o(a, prop, b[prop]);
1147
+ if (__getOwnPropSymbols$o)
1148
+ for (var prop of __getOwnPropSymbols$o(b)) {
1149
+ if (__propIsEnum$o.call(b, prop))
1150
+ __defNormalProp$o(a, prop, b[prop]);
1151
+ }
1152
+ return a;
1153
+ };
1154
+ var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
1155
+ var __async$6 = (__this, __arguments, generator) => {
1156
+ return new Promise((resolve, reject) => {
1157
+ var fulfilled = (value) => {
1158
+ try {
1159
+ step(generator.next(value));
1160
+ } catch (e) {
1161
+ reject(e);
1162
+ }
1163
+ };
1164
+ var rejected = (value) => {
1165
+ try {
1166
+ step(generator.throw(value));
1167
+ } catch (e) {
1168
+ reject(e);
1169
+ }
1170
+ };
1171
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
1172
+ step((generator = generator.apply(__this, __arguments)).next());
1173
+ });
1174
+ };
1175
+ function reflectAsync$2(rawSource) {
1176
+ return __async$6(this, null, function* () {
1177
+ return new Promise((resolve, reject) => {
1178
+ const result = apexReflection.reflect(rawSource);
1179
+ if (result.typeMirror) {
1180
+ return resolve(result.typeMirror);
1181
+ } else if (result.error) {
1182
+ return reject(result.error);
1183
+ } else {
1184
+ return reject(new Error("Unknown error"));
1185
+ }
1186
+ });
1187
+ });
1188
+ }
1189
+ function reflectApexSource(apexBundles) {
1190
+ const semiGroupReflectionError = {
1191
+ concat: (x, y) => new ReflectionErrors([...x.errors, ...y.errors])
1192
+ };
1193
+ const Ap = TE__namespace.getApplicativeTaskValidation(T__namespace.ApplyPar, semiGroupReflectionError);
1194
+ return _function.pipe(apexBundles, A__namespace.traverse(Ap)(reflectBundle$2));
1195
+ }
1196
+ function reflectBundle$2(apexBundle) {
1197
+ const convertToParsedFile = apply(toParsedFile$6, apexBundle.filePath);
1198
+ const withMetadata = apply(addMetadata, apexBundle.metadataContent);
1199
+ return _function.pipe(apexBundle, reflectAsTask$1, TE__namespace.map(convertToParsedFile), TE__namespace.flatMap(withMetadata));
1200
+ }
1201
+ function reflectAsTask$1(apexBundle) {
1202
+ return TE__namespace.tryCatch(
1203
+ () => reflectAsync$2(apexBundle.content),
1204
+ (error) => new ReflectionErrors([new ReflectionError(apexBundle.filePath, error.message)])
1205
+ );
1206
+ }
1207
+ function toParsedFile$6(filePath, typeMirror) {
1208
+ return {
1209
+ source: {
1210
+ filePath,
1211
+ name: typeMirror.name,
1212
+ type: typeMirror.type_name
1213
+ },
1214
+ type: typeMirror
1215
+ };
1216
+ }
1217
+ function addMetadata(rawMetadataContent, parsedFile) {
1218
+ return TE__namespace.fromEither(
1219
+ _function.pipe(
1220
+ parsedFile.type,
1221
+ (type) => addFileMetadataToTypeAnnotation$1(type, rawMetadataContent),
1222
+ E__namespace.map((type) => __spreadProps$n(__spreadValues$o({}, parsedFile), { type })),
1223
+ E__namespace.mapLeft(
1224
+ (error) => errorToReflectionErrors$1(error, isInSource(parsedFile.source) ? parsedFile.source.filePath : "")
1225
+ )
1226
+ )
1227
+ );
1228
+ }
1229
+ function errorToReflectionErrors$1(error, filePath) {
1230
+ return new ReflectionErrors([new ReflectionError(filePath, error.message)]);
1231
+ }
1232
+ function addFileMetadataToTypeAnnotation$1(type, metadata) {
1233
+ const concatAnnotationToType = apply(concatAnnotations$1, type);
1234
+ return _function.pipe(
1235
+ O__namespace.fromNullable(metadata),
1236
+ O__namespace.map(concatAnnotationToType),
1237
+ O__namespace.getOrElse(() => E__namespace.right(type))
1238
+ );
1239
+ }
1240
+ function concatAnnotations$1(type, metadataInput) {
1241
+ return _function.pipe(
1242
+ metadataInput,
1243
+ parseApexMetadata,
1244
+ E__namespace.map((metadataMap) => __spreadProps$n(__spreadValues$o({}, type), {
1245
+ annotations: [...type.annotations, ...mapToAnnotations$1(metadataMap)]
1246
+ }))
1247
+ );
1248
+ }
1249
+ function mapToAnnotations$1(metadata) {
1250
+ return Array.from(metadata.entries()).map(([key, value]) => {
1251
+ const declaration = `${key}: ${value}`;
1252
+ return {
1253
+ name: declaration,
1254
+ type: declaration,
1255
+ rawDeclaration: declaration
1256
+ };
1257
+ });
1258
+ }
1259
+
1136
1260
  var __defProp$n = Object.defineProperty;
1137
1261
  var __defProps$m = Object.defineProperties;
1138
1262
  var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
@@ -1186,24 +1310,52 @@ function reflectAsync$1(rawSource) {
1186
1310
  });
1187
1311
  });
1188
1312
  }
1189
- function reflectApexSource(apexBundles) {
1190
- const semiGroupReflectionError = {
1191
- concat: (x, y) => new ReflectionErrors([...x.errors, ...y.errors])
1192
- };
1193
- const Ap = TE__namespace.getApplicativeTaskValidation(T__namespace.ApplyPar, semiGroupReflectionError);
1194
- return _function.pipe(apexBundles, A__namespace.traverse(Ap)(reflectBundle$2));
1195
- }
1196
- function reflectBundle$2(apexBundle) {
1197
- const convertToParsedFile = apply(toParsedFile$5, apexBundle.filePath);
1198
- const withMetadata = apply(addMetadata, apexBundle.metadataContent);
1199
- return _function.pipe(apexBundle, reflectAsTask$1, TE__namespace.map(convertToParsedFile), TE__namespace.flatMap(withMetadata));
1200
- }
1201
- function reflectAsTask$1(apexBundle) {
1313
+ function reflectApexSourceParallel(apexBundles) {
1202
1314
  return TE__namespace.tryCatch(
1203
- () => reflectAsync$1(apexBundle.content),
1204
- (error) => new ReflectionErrors([new ReflectionError(apexBundle.filePath, error.message)])
1315
+ () => __async$5(null, null, function* () {
1316
+ if (apexBundles.length === 0) {
1317
+ return [];
1318
+ }
1319
+ const results = yield Promise.all(apexBundles.map((bundle) => reflectBundleAsync(bundle)));
1320
+ const errors = [];
1321
+ const parsedFiles = [];
1322
+ for (const result of results) {
1323
+ if (E__namespace.isRight(result)) {
1324
+ parsedFiles.push(result.right);
1325
+ } else {
1326
+ errors.push(...result.left.errors);
1327
+ }
1328
+ }
1329
+ if (errors.length > 0) {
1330
+ throw new ReflectionErrors(errors);
1331
+ }
1332
+ return parsedFiles;
1333
+ }),
1334
+ (error) => {
1335
+ if (error instanceof ReflectionErrors) {
1336
+ return error;
1337
+ }
1338
+ return new ReflectionErrors([new ReflectionError("", error.message)]);
1339
+ }
1205
1340
  );
1206
1341
  }
1342
+ function reflectBundleAsync(apexBundle) {
1343
+ return __async$5(this, null, function* () {
1344
+ try {
1345
+ const type = yield reflectAsync$1(apexBundle.content);
1346
+ const parsedFile = toParsedFile$5(apexBundle.filePath, type);
1347
+ if (apexBundle.metadataContent) {
1348
+ const withMetadataResult = yield addMetadataSync(apexBundle.metadataContent, parsedFile);
1349
+ return withMetadataResult;
1350
+ }
1351
+ return E__namespace.right(parsedFile);
1352
+ } catch (error) {
1353
+ return E__namespace.left(
1354
+ new ReflectionErrors([new ReflectionError(apexBundle.filePath, error.message)])
1355
+ );
1356
+ }
1357
+ });
1358
+ }
1207
1359
  function toParsedFile$5(filePath, typeMirror) {
1208
1360
  return {
1209
1361
  source: {
@@ -1214,17 +1366,17 @@ function toParsedFile$5(filePath, typeMirror) {
1214
1366
  type: typeMirror
1215
1367
  };
1216
1368
  }
1217
- function addMetadata(rawMetadataContent, parsedFile) {
1218
- return TE__namespace.fromEither(
1219
- _function.pipe(
1369
+ function addMetadataSync(rawMetadataContent, parsedFile) {
1370
+ return __async$5(this, null, function* () {
1371
+ return _function.pipe(
1220
1372
  parsedFile.type,
1221
1373
  (type) => addFileMetadataToTypeAnnotation(type, rawMetadataContent),
1222
1374
  E__namespace.map((type) => __spreadProps$m(__spreadValues$n({}, parsedFile), { type })),
1223
1375
  E__namespace.mapLeft(
1224
1376
  (error) => errorToReflectionErrors(error, isInSource(parsedFile.source) ? parsedFile.source.filePath : "")
1225
1377
  )
1226
- )
1227
- );
1378
+ );
1379
+ });
1228
1380
  }
1229
1381
  function errorToReflectionErrors(error, filePath) {
1230
1382
  return new ReflectionErrors([new ReflectionError(filePath, error.message)]);
@@ -1853,7 +2005,8 @@ const markdownDefaults = __spreadProps$j(__spreadValues$k({}, markdownAndChangel
1853
2005
  excludeTags: [],
1854
2006
  includeFieldSecurityMetadata: false,
1855
2007
  includeInlineHelpTextMetadata: false,
1856
- experimentalLwcSupport: false
2008
+ experimentalLwcSupport: false,
2009
+ useParallelProcessing: true
1857
2010
  });
1858
2011
  const openApiDefaults = __spreadProps$j(__spreadValues$k({}, commonDefaults), {
1859
2012
  fileName: "openapi",
@@ -3273,9 +3426,10 @@ function replaceMacros(unparsedBundles, macros) {
3273
3426
  function generateForApex(apexBundles, config) {
3274
3427
  const filterOutOfScope = apply(filterScope, config.scope);
3275
3428
  const removeExcluded = apply(removeExcludedTags, config.excludeTags);
3429
+ const reflectFn = config.useParallelProcessing ? reflectApexSourceParallel : reflectApexSource;
3276
3430
  return _function.pipe(
3277
3431
  apexBundles,
3278
- reflectApexSource,
3432
+ reflectFn,
3279
3433
  TE__namespace.map(filterOutOfScope),
3280
3434
  TE__namespace.map(addInheritedMembersToTypes),
3281
3435
  TE__namespace.map(addInheritanceChainToTypes),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cparra/apexdocs",
3
- "version": "3.16.1",
3
+ "version": "3.17.0-beta.1",
4
4
  "description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
5
5
  "keywords": [
6
6
  "apex",
@@ -92,7 +92,7 @@
92
92
  ]
93
93
  },
94
94
  "dependencies": {
95
- "@cparra/apex-reflection": "2.21.1",
95
+ "@cparra/apex-reflection": "2.22.0-beta.1",
96
96
  "@salesforce/source-deploy-retrieve": "^12.20.1",
97
97
  "@types/js-yaml": "^4.0.9",
98
98
  "@types/yargs": "^17.0.32",