@cparra/apexdocs 3.17.0-beta.1 → 3.17.0-beta.2

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-DBJhh0_O.js');
4
+ var logger$1 = require('../logger-CBoQUQAm.js');
5
5
  var cosmiconfig = require('cosmiconfig');
6
6
  var yargs = require('yargs');
7
7
  var E = require('fp-ts/Either');
@@ -15,6 +15,10 @@ require('fp-ts/lib/Array');
15
15
  require('@cparra/apex-reflection');
16
16
  require('fp-ts/Option');
17
17
  require('fast-xml-parser');
18
+ require('node:worker_threads');
19
+ require('node:path');
20
+ require('node:os');
21
+ require('node:fs');
18
22
  require('handlebars');
19
23
  require('fp-ts/boolean');
20
24
  require('fp-ts/Array');
@@ -152,10 +156,15 @@ const markdownOptions = {
152
156
  describe: "Enable experimental support for documenting Lightning Web Components (LWC).",
153
157
  default: logger$1.markdownDefaults.experimentalLwcSupport
154
158
  },
155
- useParallelProcessing: {
159
+ parallelReflection: {
156
160
  type: "boolean",
157
- describe: "Enable parallel processing using worker threads for improved performance on large codebases.",
158
- default: logger$1.markdownDefaults.useParallelProcessing
161
+ describe: "Parallelize CPU-heavy reflection via worker threads.",
162
+ default: logger$1.markdownDefaults.parallelReflection
163
+ },
164
+ parallelReflectionMaxWorkers: {
165
+ type: "number",
166
+ describe: "Maximum number of worker threads to use for parallel reflection. Defaults to a reasonable value based on CPU count.",
167
+ default: logger$1.markdownDefaults.parallelReflectionMaxWorkers
159
168
  }
160
169
  };
161
170
 
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_worker_threads_1 = require("node:worker_threads");
4
+ const apex_reflection_1 = require("@cparra/apex-reflection");
5
+ function isRequestMessage(msg) {
6
+ if (!msg || typeof msg !== 'object')
7
+ return false;
8
+ const m = msg;
9
+ if (typeof m.id !== 'number')
10
+ return false;
11
+ if (!m.payload || typeof m.payload !== 'object')
12
+ return false;
13
+ const p = m.payload;
14
+ return typeof p.content === 'string';
15
+ }
16
+ function post(msg) {
17
+ // `parentPort` should always exist in a worker, but guard anyway.
18
+ if (!node_worker_threads_1.parentPort) {
19
+ return;
20
+ }
21
+ node_worker_threads_1.parentPort.postMessage(msg);
22
+ }
23
+ function reflectOrThrow(rawSource) {
24
+ const result = (0, apex_reflection_1.reflect)(rawSource);
25
+ if (result.typeMirror) {
26
+ return result.typeMirror;
27
+ }
28
+ if (result.error) {
29
+ throw result.error;
30
+ }
31
+ throw new Error('Unknown reflection failure: no typeMirror or error returned.');
32
+ }
33
+ if (!node_worker_threads_1.parentPort) {
34
+ throw new Error('apex-reflection.worker started without a parentPort');
35
+ }
36
+ node_worker_threads_1.parentPort.on('message', (msg) => {
37
+ if (!isRequestMessage(msg)) {
38
+ // Can't correlate without a valid id; ignore.
39
+ return;
40
+ }
41
+ const { id, payload } = msg;
42
+ try {
43
+ const typeMirror = reflectOrThrow(payload.content);
44
+ post({ id, ok: true, result: typeMirror });
45
+ }
46
+ catch (e) {
47
+ const message = (e === null || e === void 0 ? void 0 : e.message) &&
48
+ typeof e.message === 'string'
49
+ ? e.message
50
+ : 'Unknown error';
51
+ post({
52
+ id,
53
+ ok: false,
54
+ error: { message },
55
+ });
56
+ }
57
+ });
package/dist/index.d.ts CHANGED
@@ -400,7 +400,18 @@ type CliConfigurableMarkdownConfig = {
400
400
  includeFieldSecurityMetadata: boolean;
401
401
  includeInlineHelpTextMetadata: boolean;
402
402
  experimentalLwcSupport: boolean;
403
- useParallelProcessing: boolean;
403
+
404
+ /**
405
+ * Whether to parallelize CPU-heavy reflection steps via worker threads.
406
+ * Defaults to true.
407
+ */
408
+ parallelReflection: boolean;
409
+
410
+ /**
411
+ * Max number of worker threads to use for parallel reflection.
412
+ * Defaults to a reasonable value based on CPU count.
413
+ */
414
+ parallelReflectionMaxWorkers?: number;
404
415
  };
405
416
 
406
417
  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-DBJhh0_O.js');
4
+ var logger = require('./logger-CBoQUQAm.js');
5
5
  var E = require('fp-ts/Either');
6
6
  require('fp-ts/function');
7
7
  require('fp-ts/TaskEither');
@@ -12,6 +12,10 @@ require('fp-ts/lib/Array');
12
12
  require('@cparra/apex-reflection');
13
13
  require('fp-ts/Option');
14
14
  require('fast-xml-parser');
15
+ require('node:worker_threads');
16
+ require('node:path');
17
+ require('node:os');
18
+ require('node:fs');
15
19
  require('handlebars');
16
20
  require('fp-ts/boolean');
17
21
  require('fp-ts/Array');
@@ -10,10 +10,14 @@ var A = require('fp-ts/lib/Array');
10
10
  var apexReflection = require('@cparra/apex-reflection');
11
11
  var O = require('fp-ts/Option');
12
12
  var fastXmlParser = require('fast-xml-parser');
13
+ var node_worker_threads = require('node:worker_threads');
14
+ var path$1 = require('node:path');
15
+ var os = require('node:os');
16
+ var fs = require('node:fs');
13
17
  var Handlebars = require('handlebars');
14
18
  var boolean = require('fp-ts/boolean');
15
19
  var A$1 = require('fp-ts/Array');
16
- var fs = require('fs');
20
+ var fs$1 = require('fs');
17
21
  var TE$1 = require('fp-ts/lib/TaskEither');
18
22
  var minimatch = require('minimatch');
19
23
  var sourceDeployRetrieve = require('@salesforce/source-deploy-retrieve');
@@ -44,7 +48,7 @@ var T__namespace = /*#__PURE__*/_interopNamespaceDefault(T);
44
48
  var A__namespace = /*#__PURE__*/_interopNamespaceDefault(A);
45
49
  var O__namespace = /*#__PURE__*/_interopNamespaceDefault(O);
46
50
  var A__namespace$1 = /*#__PURE__*/_interopNamespaceDefault(A$1);
47
- var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
51
+ var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs$1);
48
52
  var TE__namespace$1 = /*#__PURE__*/_interopNamespaceDefault(TE$1);
49
53
 
50
54
  function apply(fn, ...front) {
@@ -179,19 +183,19 @@ const defaultTranslations = {
179
183
  }
180
184
  };
181
185
 
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) => {
186
+ var __defProp$r = Object.defineProperty;
187
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
188
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
189
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
190
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
191
+ var __spreadValues$r = (a, b) => {
188
192
  for (var prop in b || (b = {}))
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]);
193
+ if (__hasOwnProp$r.call(b, prop))
194
+ __defNormalProp$r(a, prop, b[prop]);
195
+ if (__getOwnPropSymbols$r)
196
+ for (var prop of __getOwnPropSymbols$r(b)) {
197
+ if (__propIsEnum$r.call(b, prop))
198
+ __defNormalProp$r(a, prop, b[prop]);
195
199
  }
196
200
  return a;
197
201
  };
@@ -207,7 +211,7 @@ function isObjectWithStringKeys(value) {
207
211
  return value !== null && typeof value === "object" && !Array.isArray(value);
208
212
  }
209
213
  function deepMerge(target, source) {
210
- const result = __spreadValues$s({}, target);
214
+ const result = __spreadValues$r({}, target);
211
215
  for (const key in source) {
212
216
  if (Object.prototype.hasOwnProperty.call(source, key)) {
213
217
  const sourceValue = source[key];
@@ -321,25 +325,25 @@ function isInlineCode(content) {
321
325
  return Object.keys(content).includes("__type") && content.__type === "inline-code";
322
326
  }
323
327
 
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) => {
328
+ var __defProp$q = Object.defineProperty;
329
+ var __defProps$p = Object.defineProperties;
330
+ var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
331
+ var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
332
+ var __hasOwnProp$q = Object.prototype.hasOwnProperty;
333
+ var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
334
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
335
+ var __spreadValues$q = (a, b) => {
332
336
  for (var prop in b || (b = {}))
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]);
337
+ if (__hasOwnProp$q.call(b, prop))
338
+ __defNormalProp$q(a, prop, b[prop]);
339
+ if (__getOwnPropSymbols$q)
340
+ for (var prop of __getOwnPropSymbols$q(b)) {
341
+ if (__propIsEnum$q.call(b, prop))
342
+ __defNormalProp$q(a, prop, b[prop]);
339
343
  }
340
344
  return a;
341
345
  };
342
- var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
346
+ var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
343
347
  function adaptDescribable(describable, linkGenerator) {
344
348
  return {
345
349
  description: describableToRenderableContent(describable, linkGenerator)
@@ -391,7 +395,7 @@ function adaptDocumentable(documentable, linkGenerator, subHeadingLevel) {
391
395
  function extractCustomTags(type) {
392
396
  var _a2, _b2;
393
397
  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$q(__spreadValues$r({}, adaptDescribable(currentAnnotation.bodyLines, linkGenerator)), {
398
+ 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)), {
395
399
  name: currentAnnotation.name
396
400
  }))) != null ? _b2 : [];
397
401
  }
@@ -405,7 +409,7 @@ function adaptDocumentable(documentable, linkGenerator, subHeadingLevel) {
405
409
  var _a2, _b2;
406
410
  return (_b2 = (_a2 = type.docComment) == null ? void 0 : _a2.annotations.filter((currentAnnotation) => currentAnnotation.name.toLowerCase() === "see").map((currentAnnotation) => currentAnnotation.body)) != null ? _b2 : [];
407
411
  }
408
- return __spreadProps$q(__spreadValues$r({}, adaptDescribable((_a = documentable.docComment) == null ? void 0 : _a.descriptionLines, linkGenerator)), {
412
+ return __spreadProps$p(__spreadValues$q({}, adaptDescribable((_a = documentable.docComment) == null ? void 0 : _a.descriptionLines, linkGenerator)), {
409
413
  annotations: documentable.annotations.map((annotation) => annotation.type.toUpperCase()),
410
414
  customTags: extractCustomTags(documentable),
411
415
  example: {
@@ -420,25 +424,25 @@ function adaptDocumentable(documentable, linkGenerator, subHeadingLevel) {
420
424
  });
421
425
  }
422
426
 
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) => {
427
+ var __defProp$p = Object.defineProperty;
428
+ var __defProps$o = Object.defineProperties;
429
+ var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
430
+ var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
431
+ var __hasOwnProp$p = Object.prototype.hasOwnProperty;
432
+ var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
433
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
434
+ var __spreadValues$p = (a, b) => {
431
435
  for (var prop in b || (b = {}))
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]);
436
+ if (__hasOwnProp$p.call(b, prop))
437
+ __defNormalProp$p(a, prop, b[prop]);
438
+ if (__getOwnPropSymbols$p)
439
+ for (var prop of __getOwnPropSymbols$p(b)) {
440
+ if (__propIsEnum$p.call(b, prop))
441
+ __defNormalProp$p(a, prop, b[prop]);
438
442
  }
439
443
  return a;
440
444
  };
441
- var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
445
+ var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
442
446
  function adaptMethod(method, linkGenerator, baseHeadingLevel, translations) {
443
447
  var _a, _b, _c;
444
448
  function buildTitle(method2) {
@@ -468,7 +472,7 @@ function adaptMethod(method, linkGenerator, baseHeadingLevel, translations) {
468
472
  returnType: {
469
473
  headingLevel: baseHeadingLevel + 1,
470
474
  heading: translations.markdown.details.returnType,
471
- value: __spreadProps$p(__spreadValues$q({}, adaptDescribable((_b = (_a = method.docComment) == null ? void 0 : _a.returnAnnotation) == null ? void 0 : _b.bodyLines, linkGenerator)), {
475
+ value: __spreadProps$o(__spreadValues$p({}, adaptDescribable((_b = (_a = method.docComment) == null ? void 0 : _a.returnAnnotation) == null ? void 0 : _b.bodyLines, linkGenerator)), {
472
476
  type: linkGenerator(method.typeReference.rawDeclaration)
473
477
  })
474
478
  },
@@ -527,13 +531,13 @@ function mapParameters(documentable, param, linkGenerator) {
527
531
  const paramAnnotation = (_a = documentable.docComment) == null ? void 0 : _a.paramAnnotations.find(
528
532
  (pa) => pa.paramName.toLowerCase() === param.name.toLowerCase()
529
533
  );
530
- return __spreadProps$p(__spreadValues$q({}, adaptDescribable(paramAnnotation == null ? void 0 : paramAnnotation.bodyLines, linkGenerator)), {
534
+ return __spreadProps$o(__spreadValues$p({}, adaptDescribable(paramAnnotation == null ? void 0 : paramAnnotation.bodyLines, linkGenerator)), {
531
535
  name: param.name,
532
536
  type: linkGenerator(param.typeReference.rawDeclaration)
533
537
  });
534
538
  }
535
539
  function mapThrows(thrown, linkGenerator) {
536
- return __spreadProps$p(__spreadValues$q({}, adaptDescribable(thrown.bodyLines, linkGenerator)), {
540
+ return __spreadProps$o(__spreadValues$p({}, adaptDescribable(thrown.bodyLines, linkGenerator)), {
537
541
  type: linkGenerator(thrown.exceptionName)
538
542
  });
539
543
  }
@@ -626,25 +630,25 @@ ${yamlString}---
626
630
  `;
627
631
  }
628
632
 
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) => {
633
+ var __defProp$o = Object.defineProperty;
634
+ var __defProps$n = Object.defineProperties;
635
+ var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
636
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
637
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
638
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
639
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
640
+ var __spreadValues$o = (a, b) => {
637
641
  for (var prop in b || (b = {}))
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]);
642
+ if (__hasOwnProp$o.call(b, prop))
643
+ __defNormalProp$o(a, prop, b[prop]);
644
+ if (__getOwnPropSymbols$o)
645
+ for (var prop of __getOwnPropSymbols$o(b)) {
646
+ if (__propIsEnum$o.call(b, prop))
647
+ __defNormalProp$o(a, prop, b[prop]);
644
648
  }
645
649
  return a;
646
650
  };
647
- var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
651
+ var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
648
652
  function typeToRenderable$1(parsedFile, linkGenerator, config, translations) {
649
653
  function getRenderable() {
650
654
  const { type } = parsedFile;
@@ -663,7 +667,7 @@ function typeToRenderable$1(parsedFile, linkGenerator, config, translations) {
663
667
  return lwcMetadataToRenderable(type, config, translations);
664
668
  }
665
669
  }
666
- return __spreadProps$o(__spreadValues$p({}, getRenderable()), {
670
+ return __spreadProps$n(__spreadValues$o({}, getRenderable()), {
667
671
  filePath: isInSource(parsedFile.source) ? parsedFile.source.filePath : void 0,
668
672
  namespace: config.namespace
669
673
  });
@@ -688,7 +692,7 @@ function baseTypeAdapter(type, linkGenerator, baseHeadingLevel, translations) {
688
692
  };
689
693
  }
690
694
  function enumTypeToEnumSource(enumType, linkGenerator, baseHeadingLevel = 1, translations) {
691
- return __spreadProps$o(__spreadValues$p({
695
+ return __spreadProps$n(__spreadValues$o({
692
696
  type: "enum"
693
697
  }, baseTypeAdapter(enumType, linkGenerator, baseHeadingLevel, translations)), {
694
698
  values: {
@@ -696,7 +700,7 @@ function enumTypeToEnumSource(enumType, linkGenerator, baseHeadingLevel = 1, tra
696
700
  heading: translations.markdown.sections.values,
697
701
  value: enumType.values.map((value) => {
698
702
  var _a;
699
- return __spreadProps$o(__spreadValues$p({}, adaptDescribable((_a = value.docComment) == null ? void 0 : _a.descriptionLines, linkGenerator)), {
703
+ return __spreadProps$n(__spreadValues$o({}, adaptDescribable((_a = value.docComment) == null ? void 0 : _a.descriptionLines, linkGenerator)), {
700
704
  value: value.name
701
705
  });
702
706
  })
@@ -704,7 +708,7 @@ function enumTypeToEnumSource(enumType, linkGenerator, baseHeadingLevel = 1, tra
704
708
  });
705
709
  }
706
710
  function interfaceTypeToInterfaceSource(interfaceType, linkGenerator, baseHeadingLevel = 1, translations) {
707
- return __spreadProps$o(__spreadValues$p({
711
+ return __spreadProps$n(__spreadValues$o({
708
712
  type: "interface"
709
713
  }, baseTypeAdapter(interfaceType, linkGenerator, baseHeadingLevel, translations)), {
710
714
  extends: interfaceType.extended_interfaces.map(linkGenerator),
@@ -718,7 +722,7 @@ function interfaceTypeToInterfaceSource(interfaceType, linkGenerator, baseHeadin
718
722
  });
719
723
  }
720
724
  function classTypeToClassSource(classType, linkGenerator, baseHeadingLevel = 1, translations) {
721
- return __spreadProps$o(__spreadValues$p({
725
+ return __spreadProps$n(__spreadValues$o({
722
726
  type: "class"
723
727
  }, baseTypeAdapter(classType, linkGenerator, baseHeadingLevel, translations)), {
724
728
  classModifier: classType.classModifier,
@@ -762,7 +766,7 @@ function classTypeToClassSource(classType, linkGenerator, baseHeadingLevel = 1,
762
766
  heading: translations.markdown.sections.classes,
763
767
  value: classType.classes.map(
764
768
  (innerClass) => classTypeToClassSource(
765
- __spreadProps$o(__spreadValues$p({}, innerClass), { inheritanceChain: [] }),
769
+ __spreadProps$n(__spreadValues$o({}, innerClass), { inheritanceChain: [] }),
766
770
  linkGenerator,
767
771
  baseHeadingLevel + 2,
768
772
  translations
@@ -1133,25 +1137,6 @@ function toMap(metadata) {
1133
1137
  return map;
1134
1138
  }
1135
1139
 
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
1140
  var __async$6 = (__this, __arguments, generator) => {
1156
1141
  return new Promise((resolve, reject) => {
1157
1142
  var fulfilled = (value) => {
@@ -1172,89 +1157,248 @@ var __async$6 = (__this, __arguments, generator) => {
1172
1157
  step((generator = generator.apply(__this, __arguments)).next());
1173
1158
  });
1174
1159
  };
1175
- function reflectAsync$2(rawSource) {
1176
- return __async$6(this, null, function* () {
1160
+ class WorkerPool {
1161
+ constructor(createWorker, options = {}) {
1162
+ this.nextTaskId = 1;
1163
+ this.terminating = false;
1164
+ this.idleWorkers = [];
1165
+ this.busyWorkers = /* @__PURE__ */ new Set();
1166
+ this.allWorkers = /* @__PURE__ */ new Set();
1167
+ this.queue = [];
1168
+ this.inFlightByWorker = /* @__PURE__ */ new Map();
1169
+ this.createdWorkers = 0;
1170
+ this.completedTasks = 0;
1171
+ this.failedTasks = 0;
1172
+ var _a, _b, _c, _d, _e, _f;
1173
+ this.createWorker = createWorker;
1174
+ const cpuCount = Math.max(1, (_b = (_a = os.cpus()) == null ? void 0 : _a.length) != null ? _b : 1);
1175
+ this.maxWorkers = Math.max(1, (_c = options.maxWorkers) != null ? _c : cpuCount);
1176
+ this.maxQueueSize = (_d = options.maxQueueSize) != null ? _d : Number.POSITIVE_INFINITY;
1177
+ this.drainOnTerminate = (_e = options.drainOnTerminate) != null ? _e : false;
1178
+ this.unrefWorkers = (_f = options.unrefWorkers) != null ? _f : false;
1179
+ }
1180
+ /**
1181
+ * Enqueue a task and resolve with the worker's response `result`.
1182
+ */
1183
+ run(payload) {
1184
+ if (this.terminating) {
1185
+ return Promise.reject(new Error("WorkerPool is terminating; cannot accept new tasks."));
1186
+ }
1187
+ if (this.queue.length >= this.maxQueueSize) {
1188
+ return Promise.reject(
1189
+ new Error(`WorkerPool queue limit exceeded (maxQueueSize=${this.maxQueueSize}).`)
1190
+ );
1191
+ }
1192
+ const id = this.nextTaskId++;
1177
1193
  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
- }
1194
+ this.queue.push({
1195
+ id,
1196
+ payload,
1197
+ resolve,
1198
+ reject
1199
+ });
1200
+ this.pump();
1186
1201
  });
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}`;
1202
+ }
1203
+ /**
1204
+ * Returns current pool stats.
1205
+ */
1206
+ stats() {
1252
1207
  return {
1253
- name: declaration,
1254
- type: declaration,
1255
- rawDeclaration: declaration
1208
+ maxWorkers: this.maxWorkers,
1209
+ activeWorkers: this.allWorkers.size,
1210
+ idleWorkers: this.idleWorkers.length,
1211
+ queuedTasks: this.queue.length,
1212
+ inFlightTasks: this.inFlightByWorker.size,
1213
+ createdWorkers: this.createdWorkers,
1214
+ completedTasks: this.completedTasks,
1215
+ failedTasks: this.failedTasks
1256
1216
  };
1257
- });
1217
+ }
1218
+ /**
1219
+ * Terminates all workers and rejects queued tasks (unless drainOnTerminate=true).
1220
+ *
1221
+ * - If `drainOnTerminate` is false (default), queued tasks are rejected immediately,
1222
+ * and in-flight tasks are rejected when each worker is terminated.
1223
+ * - If `drainOnTerminate` is true, the pool stops accepting new tasks and will attempt
1224
+ * to finish queued + in-flight tasks before terminating workers.
1225
+ */
1226
+ terminate() {
1227
+ return __async$6(this, null, function* () {
1228
+ if (this.terminating) {
1229
+ return;
1230
+ }
1231
+ this.terminating = true;
1232
+ if (!this.drainOnTerminate) {
1233
+ while (this.queue.length) {
1234
+ const task = this.queue.shift();
1235
+ task.reject(new Error("WorkerPool terminated before task could start."));
1236
+ this.failedTasks++;
1237
+ }
1238
+ }
1239
+ if (this.drainOnTerminate) {
1240
+ yield this.waitForDrain();
1241
+ }
1242
+ const terminations = Array.from(this.allWorkers).map((w) => __async$6(this, null, function* () {
1243
+ this.rejectInFlight(w, new Error("WorkerPool terminated with task still in flight."));
1244
+ try {
1245
+ yield w.terminate();
1246
+ } catch (e) {
1247
+ }
1248
+ }));
1249
+ yield Promise.all(terminations);
1250
+ this.idleWorkers.length = 0;
1251
+ this.busyWorkers.clear();
1252
+ this.allWorkers.clear();
1253
+ this.inFlightByWorker.clear();
1254
+ });
1255
+ }
1256
+ /**
1257
+ * Wait until all queued tasks have been processed and no tasks are in flight.
1258
+ * This does NOT terminate workers.
1259
+ */
1260
+ drain() {
1261
+ return __async$6(this, null, function* () {
1262
+ yield this.waitForDrain();
1263
+ });
1264
+ }
1265
+ pump() {
1266
+ if (this.terminating && !this.drainOnTerminate) {
1267
+ return;
1268
+ }
1269
+ while (this.queue.length > 0) {
1270
+ const worker = this.getIdleOrCreateWorker();
1271
+ if (!worker) {
1272
+ return;
1273
+ }
1274
+ const task = this.queue.shift();
1275
+ this.assign(worker, task);
1276
+ }
1277
+ }
1278
+ getIdleOrCreateWorker() {
1279
+ const idle = this.idleWorkers.pop();
1280
+ if (idle) return idle;
1281
+ if (this.allWorkers.size < this.maxWorkers) {
1282
+ const w = this.spawnWorker();
1283
+ return w;
1284
+ }
1285
+ return null;
1286
+ }
1287
+ spawnWorker() {
1288
+ const worker = this.createWorker();
1289
+ this.createdWorkers++;
1290
+ this.allWorkers.add(worker);
1291
+ if (this.unrefWorkers) {
1292
+ worker.unref();
1293
+ }
1294
+ worker.on("message", (msg) => this.onWorkerMessage(worker, msg));
1295
+ worker.on("error", (err) => this.onWorkerError(worker, err));
1296
+ worker.on("exit", (code) => this.onWorkerExit(worker, code));
1297
+ this.idleWorkers.push(worker);
1298
+ return worker;
1299
+ }
1300
+ assign(worker, task) {
1301
+ this.idleWorkersRemove(worker);
1302
+ this.busyWorkers.add(worker);
1303
+ this.inFlightByWorker.set(worker, {
1304
+ id: task.id,
1305
+ resolve: task.resolve,
1306
+ reject: task.reject
1307
+ });
1308
+ try {
1309
+ worker.postMessage({ id: task.id, payload: task.payload });
1310
+ } catch (e) {
1311
+ this.inFlightByWorker.delete(worker);
1312
+ this.busyWorkers.delete(worker);
1313
+ this.idleWorkers.push(worker);
1314
+ task.reject(e);
1315
+ this.failedTasks++;
1316
+ this.pump();
1317
+ }
1318
+ }
1319
+ onWorkerMessage(worker, msg) {
1320
+ var _a;
1321
+ const inFlight = this.inFlightByWorker.get(worker);
1322
+ if (!inFlight) {
1323
+ return;
1324
+ }
1325
+ const m = msg;
1326
+ const sameId = typeof (m == null ? void 0 : m.id) === "number" && m.id === inFlight.id;
1327
+ const okFlag = typeof (m == null ? void 0 : m.ok) === "boolean";
1328
+ if (!sameId || !okFlag) {
1329
+ this.finishTask(worker);
1330
+ inFlight.reject(
1331
+ new Error("WorkerPool received an invalid response message for the in-flight task.")
1332
+ );
1333
+ this.failedTasks++;
1334
+ this.pump();
1335
+ return;
1336
+ }
1337
+ this.finishTask(worker);
1338
+ if (m.ok) {
1339
+ this.completedTasks++;
1340
+ inFlight.resolve(m.result);
1341
+ } else {
1342
+ this.failedTasks++;
1343
+ inFlight.reject((_a = m.error) != null ? _a : new Error("Worker indicated failure without an error payload."));
1344
+ }
1345
+ this.pump();
1346
+ }
1347
+ onWorkerError(worker, err) {
1348
+ this.rejectInFlight(worker, err);
1349
+ this.removeWorker(worker);
1350
+ this.pump();
1351
+ }
1352
+ onWorkerExit(worker, code) {
1353
+ this.rejectInFlight(worker, new Error(`Worker exited unexpectedly (code=${code}).`));
1354
+ this.removeWorker(worker);
1355
+ this.pump();
1356
+ }
1357
+ finishTask(worker) {
1358
+ this.inFlightByWorker.delete(worker);
1359
+ this.busyWorkers.delete(worker);
1360
+ if (!this.terminating || this.drainOnTerminate) {
1361
+ this.idleWorkers.push(worker);
1362
+ }
1363
+ }
1364
+ rejectInFlight(worker, reason) {
1365
+ const inFlight = this.inFlightByWorker.get(worker);
1366
+ if (!inFlight) return;
1367
+ this.inFlightByWorker.delete(worker);
1368
+ this.busyWorkers.delete(worker);
1369
+ inFlight.reject(reason);
1370
+ this.failedTasks++;
1371
+ }
1372
+ removeWorker(worker) {
1373
+ this.inFlightByWorker.delete(worker);
1374
+ this.busyWorkers.delete(worker);
1375
+ this.idleWorkersRemove(worker);
1376
+ this.allWorkers.delete(worker);
1377
+ }
1378
+ idleWorkersRemove(worker) {
1379
+ const idx = this.idleWorkers.indexOf(worker);
1380
+ if (idx !== -1) {
1381
+ this.idleWorkers.splice(idx, 1);
1382
+ }
1383
+ }
1384
+ waitForDrain() {
1385
+ return __async$6(this, null, function* () {
1386
+ if (this.queue.length === 0 && this.inFlightByWorker.size === 0) {
1387
+ return;
1388
+ }
1389
+ yield new Promise((resolve) => {
1390
+ const tick = () => {
1391
+ this.pump();
1392
+ if (this.queue.length === 0 && this.inFlightByWorker.size === 0) {
1393
+ resolve();
1394
+ return;
1395
+ }
1396
+ setTimeout(tick, 10);
1397
+ };
1398
+ tick();
1399
+ });
1400
+ });
1401
+ }
1258
1402
  }
1259
1403
 
1260
1404
  var __defProp$n = Object.defineProperty;
@@ -1310,51 +1454,100 @@ function reflectAsync$1(rawSource) {
1310
1454
  });
1311
1455
  });
1312
1456
  }
1313
- function reflectApexSourceParallel(apexBundles) {
1457
+ function supportsWorkerThreads() {
1458
+ try {
1459
+ return typeof node_worker_threads.Worker === "function";
1460
+ } catch (e) {
1461
+ return false;
1462
+ }
1463
+ }
1464
+ function isWorkerReflectionEnabled(config) {
1465
+ var _a, _b;
1466
+ const env = ((_a = process.env.APEXDOCS_WORKER_REFLECTION) != null ? _a : "").toLowerCase();
1467
+ if (env === "true" || env === "1") return true;
1468
+ if (env === "false" || env === "0") return false;
1469
+ return (_b = config == null ? void 0 : config.parallelReflection) != null ? _b : true;
1470
+ }
1471
+ function getWorkerEntrypointPath() {
1472
+ const candidate1 = path$1.resolve(__dirname, "./apex-reflection.worker.js");
1473
+ if (fs.existsSync(candidate1)) {
1474
+ return candidate1;
1475
+ }
1476
+ let dir = __dirname;
1477
+ for (let i = 0; i < 8; i++) {
1478
+ const maybeDist = path$1.resolve(dir, "../../..");
1479
+ const candidate2 = path$1.resolve(maybeDist, "core", "reflection", "apex", "apex-reflection.worker.js");
1480
+ if (fs.existsSync(candidate2)) {
1481
+ return candidate2;
1482
+ }
1483
+ const parent = path$1.dirname(dir);
1484
+ if (parent === dir) break;
1485
+ dir = parent;
1486
+ }
1487
+ return candidate1;
1488
+ }
1489
+ function reflectAsTaskParallel(apexBundles, config) {
1314
1490
  return TE__namespace.tryCatch(
1315
1491
  () => __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);
1492
+ var _a, _b, _c;
1493
+ const cpu = (_b = (_a = os.cpus()) == null ? void 0 : _a.length) != null ? _b : 1;
1494
+ const defaultMax = Math.max(1, Math.min(cpu, 8));
1495
+ const maxWorkers = Math.max(1, (_c = config == null ? void 0 : config.parallelReflectionMaxWorkers) != null ? _c : defaultMax);
1496
+ const pool = new WorkerPool(() => new node_worker_threads.Worker(getWorkerEntrypointPath()), {
1497
+ maxWorkers
1498
+ // Keep default queue size (Infinity) unless we later decide to bound it via config.
1499
+ });
1500
+ try {
1501
+ const results = yield Promise.all(
1502
+ apexBundles.map((bundle) => __async$5(null, null, function* () {
1503
+ const typeMirror = yield pool.run({ content: bundle.content });
1504
+ return typeMirror;
1505
+ }))
1506
+ );
1507
+ return results;
1508
+ } finally {
1509
+ yield pool.terminate();
1331
1510
  }
1332
- return parsedFiles;
1333
1511
  }),
1334
1512
  (error) => {
1335
- if (error instanceof ReflectionErrors) {
1336
- return error;
1337
- }
1338
- return new ReflectionErrors([new ReflectionError("", error.message)]);
1513
+ const message = error == null ? void 0 : error.message;
1514
+ return new ReflectionErrors([new ReflectionError("", typeof message === "string" ? message : "Worker failure")]);
1339
1515
  }
1340
1516
  );
1341
1517
  }
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
- });
1518
+ function reflectApexSource(apexBundles, config) {
1519
+ const semiGroupReflectionError = {
1520
+ concat: (x, y) => new ReflectionErrors([...x.errors, ...y.errors])
1521
+ };
1522
+ const Ap = TE__namespace.getApplicativeTaskValidation(T__namespace.ApplyPar, semiGroupReflectionError);
1523
+ if (!isWorkerReflectionEnabled(config) || !supportsWorkerThreads()) {
1524
+ return _function.pipe(apexBundles, A__namespace.traverse(Ap)(reflectBundle$2));
1525
+ }
1526
+ return _function.pipe(
1527
+ reflectAsTaskParallel(apexBundles, config),
1528
+ TE__namespace.map((typeMirrors) => typeMirrors.map((t, idx) => ({ t, idx }))),
1529
+ TE__namespace.mapLeft((errs) => errs),
1530
+ TE__namespace.flatMap((pairs) => {
1531
+ const parsedTasks = pairs.map(({ t, idx }) => {
1532
+ const bundle = apexBundles[idx];
1533
+ const convertToParsedFile = apply(toParsedFile$5, bundle.filePath);
1534
+ const withMetadata = apply(addMetadata, bundle.metadataContent);
1535
+ return _function.pipe(TE__namespace.right(t), TE__namespace.map(convertToParsedFile), TE__namespace.flatMap(withMetadata));
1536
+ });
1537
+ return _function.pipe(parsedTasks, A__namespace.sequence(Ap));
1538
+ })
1539
+ );
1540
+ }
1541
+ function reflectBundle$2(apexBundle) {
1542
+ const convertToParsedFile = apply(toParsedFile$5, apexBundle.filePath);
1543
+ const withMetadata = apply(addMetadata, apexBundle.metadataContent);
1544
+ return _function.pipe(apexBundle, reflectAsTask$1, TE__namespace.map(convertToParsedFile), TE__namespace.flatMap(withMetadata));
1545
+ }
1546
+ function reflectAsTask$1(apexBundle) {
1547
+ return TE__namespace.tryCatch(
1548
+ () => reflectAsync$1(apexBundle.content),
1549
+ (error) => new ReflectionErrors([new ReflectionError(apexBundle.filePath, error.message)])
1550
+ );
1358
1551
  }
1359
1552
  function toParsedFile$5(filePath, typeMirror) {
1360
1553
  return {
@@ -1366,17 +1559,17 @@ function toParsedFile$5(filePath, typeMirror) {
1366
1559
  type: typeMirror
1367
1560
  };
1368
1561
  }
1369
- function addMetadataSync(rawMetadataContent, parsedFile) {
1370
- return __async$5(this, null, function* () {
1371
- return _function.pipe(
1562
+ function addMetadata(rawMetadataContent, parsedFile) {
1563
+ return TE__namespace.fromEither(
1564
+ _function.pipe(
1372
1565
  parsedFile.type,
1373
1566
  (type) => addFileMetadataToTypeAnnotation(type, rawMetadataContent),
1374
1567
  E__namespace.map((type) => __spreadProps$m(__spreadValues$n({}, parsedFile), { type })),
1375
1568
  E__namespace.mapLeft(
1376
1569
  (error) => errorToReflectionErrors(error, isInSource(parsedFile.source) ? parsedFile.source.filePath : "")
1377
1570
  )
1378
- );
1379
- });
1571
+ )
1572
+ );
1380
1573
  }
1381
1574
  function errorToReflectionErrors(error, filePath) {
1382
1575
  return new ReflectionErrors([new ReflectionError(filePath, error.message)]);
@@ -2006,7 +2199,10 @@ const markdownDefaults = __spreadProps$j(__spreadValues$k({}, markdownAndChangel
2006
2199
  includeFieldSecurityMetadata: false,
2007
2200
  includeInlineHelpTextMetadata: false,
2008
2201
  experimentalLwcSupport: false,
2009
- useParallelProcessing: true
2202
+ // Performance: parallel reflection via worker threads (enabled by default).
2203
+ parallelReflection: true,
2204
+ // Default is computed at runtime if not provided.
2205
+ parallelReflectionMaxWorkers: void 0
2010
2206
  });
2011
2207
  const openApiDefaults = __spreadProps$j(__spreadValues$k({}, commonDefaults), {
2012
2208
  fileName: "openapi",
@@ -3426,10 +3622,12 @@ function replaceMacros(unparsedBundles, macros) {
3426
3622
  function generateForApex(apexBundles, config) {
3427
3623
  const filterOutOfScope = apply(filterScope, config.scope);
3428
3624
  const removeExcluded = apply(removeExcludedTags, config.excludeTags);
3429
- const reflectFn = config.useParallelProcessing ? reflectApexSourceParallel : reflectApexSource;
3430
3625
  return _function.pipe(
3431
3626
  apexBundles,
3432
- reflectFn,
3627
+ (bundles) => reflectApexSource(bundles, {
3628
+ parallelReflection: config.parallelReflection,
3629
+ parallelReflectionMaxWorkers: config.parallelReflectionMaxWorkers
3630
+ }),
3433
3631
  TE__namespace.map(filterOutOfScope),
3434
3632
  TE__namespace.map(addInheritedMembersToTypes),
3435
3633
  TE__namespace.map(addInheritanceChainToTypes),
@@ -5251,6 +5449,9 @@ var __async$1 = (__this, __arguments, generator) => {
5251
5449
  step((generator = generator.apply(__this, __arguments)).next());
5252
5450
  });
5253
5451
  };
5452
+ const changelogReflectionConfig = {
5453
+ parallelReflection: false
5454
+ };
5254
5455
  function generateChangeLog(oldBundles, newBundles, config) {
5255
5456
  const convertToPageData = apply(toPageData, config.fileName);
5256
5457
  function handleConversion({ changelog, newManifest }) {
@@ -5281,7 +5482,7 @@ function generateChangeLog(oldBundles, newBundles, config) {
5281
5482
  function reflect(bundles, config) {
5282
5483
  const filterOutOfScopeApex = apply(filterScope, config.scope);
5283
5484
  function reflectApexFiles(sourceFiles) {
5284
- return _function.pipe(reflectApexSource(sourceFiles), TE__namespace.map(filterOutOfScopeApex));
5485
+ return _function.pipe(reflectApexSource(sourceFiles, changelogReflectionConfig), TE__namespace.map(filterOutOfScopeApex));
5285
5486
  }
5286
5487
  return _function.pipe(
5287
5488
  // Filter out LWC. These will be implemented at a later date
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cparra/apexdocs",
3
- "version": "3.17.0-beta.1",
3
+ "version": "3.17.0-beta.2",
4
4
  "description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
5
5
  "keywords": [
6
6
  "apex",
@@ -36,7 +36,7 @@
36
36
  "output": []
37
37
  },
38
38
  "build": {
39
- "command": "tsc --noEmit --pretty && pkgroll",
39
+ "command": "tsc --noEmit --pretty && pkgroll --target node18 && node -e \"const fs=require('fs'); const path=require('path'); const src=path.join(__dirname,'src','core','reflection','apex','apex-reflection.worker.ts'); const distRoot=path.join(__dirname,'dist'); const candidates=[]; (function walk(dir){ for (const ent of fs.readdirSync(dir,{withFileTypes:true})) { const p=path.join(dir,ent.name); if (ent.isDirectory()) walk(p); else if (ent.isFile() && ent.name==='generate.js') candidates.push(p); } })(distRoot); if (!candidates.length) throw new Error('Could not locate dist bundle to determine worker output location'); const distEntry=candidates[0]; const destDir=path.join(path.dirname(distEntry),'..','core','reflection','apex'); fs.mkdirSync(destDir,{recursive:true}); const out=path.join(destDir,'apex-reflection.worker.js'); const ts=require('typescript'); const input=fs.readFileSync(src,'utf8'); const res=ts.transpileModule(input,{compilerOptions:{module:ts.ModuleKind.CommonJS,target:ts.ScriptTarget.ES2018,esModuleInterop:true}}); fs.writeFileSync(out,res.outputText,'utf8'); if (!fs.existsSync(out)) throw new Error('Failed to write worker entrypoint');\"",
40
40
  "dependencies": [
41
41
  "lint"
42
42
  ],
@@ -92,7 +92,7 @@
92
92
  ]
93
93
  },
94
94
  "dependencies": {
95
- "@cparra/apex-reflection": "2.22.0-beta.1",
95
+ "@cparra/apex-reflection": "2.21.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",