@cparra/apexdocs 3.17.0-beta.0 → 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-Cej7LT-j.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');
@@ -151,6 +155,16 @@ const markdownOptions = {
151
155
  type: "boolean",
152
156
  describe: "Enable experimental support for documenting Lightning Web Components (LWC).",
153
157
  default: logger$1.markdownDefaults.experimentalLwcSupport
158
+ },
159
+ parallelReflection: {
160
+ type: "boolean",
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
154
168
  }
155
169
  };
156
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,6 +400,18 @@ type CliConfigurableMarkdownConfig = {
400
400
  includeFieldSecurityMetadata: boolean;
401
401
  includeInlineHelpTextMetadata: boolean;
402
402
  experimentalLwcSupport: 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;
403
415
  };
404
416
 
405
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-Cej7LT-j.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) {
@@ -1133,6 +1137,270 @@ function toMap(metadata) {
1133
1137
  return map;
1134
1138
  }
1135
1139
 
1140
+ var __async$6 = (__this, __arguments, generator) => {
1141
+ return new Promise((resolve, reject) => {
1142
+ var fulfilled = (value) => {
1143
+ try {
1144
+ step(generator.next(value));
1145
+ } catch (e) {
1146
+ reject(e);
1147
+ }
1148
+ };
1149
+ var rejected = (value) => {
1150
+ try {
1151
+ step(generator.throw(value));
1152
+ } catch (e) {
1153
+ reject(e);
1154
+ }
1155
+ };
1156
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
1157
+ step((generator = generator.apply(__this, __arguments)).next());
1158
+ });
1159
+ };
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++;
1193
+ return new Promise((resolve, reject) => {
1194
+ this.queue.push({
1195
+ id,
1196
+ payload,
1197
+ resolve,
1198
+ reject
1199
+ });
1200
+ this.pump();
1201
+ });
1202
+ }
1203
+ /**
1204
+ * Returns current pool stats.
1205
+ */
1206
+ stats() {
1207
+ return {
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
1216
+ };
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
+ }
1402
+ }
1403
+
1136
1404
  var __defProp$n = Object.defineProperty;
1137
1405
  var __defProps$m = Object.defineProperties;
1138
1406
  var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
@@ -1186,12 +1454,89 @@ function reflectAsync$1(rawSource) {
1186
1454
  });
1187
1455
  });
1188
1456
  }
1189
- function reflectApexSource(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) {
1490
+ return TE__namespace.tryCatch(
1491
+ () => __async$5(null, null, function* () {
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();
1510
+ }
1511
+ }),
1512
+ (error) => {
1513
+ const message = error == null ? void 0 : error.message;
1514
+ return new ReflectionErrors([new ReflectionError("", typeof message === "string" ? message : "Worker failure")]);
1515
+ }
1516
+ );
1517
+ }
1518
+ function reflectApexSource(apexBundles, config) {
1190
1519
  const semiGroupReflectionError = {
1191
1520
  concat: (x, y) => new ReflectionErrors([...x.errors, ...y.errors])
1192
1521
  };
1193
1522
  const Ap = TE__namespace.getApplicativeTaskValidation(T__namespace.ApplyPar, semiGroupReflectionError);
1194
- return _function.pipe(apexBundles, A__namespace.traverse(Ap)(reflectBundle$2));
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
+ );
1195
1540
  }
1196
1541
  function reflectBundle$2(apexBundle) {
1197
1542
  const convertToParsedFile = apply(toParsedFile$5, apexBundle.filePath);
@@ -1853,7 +2198,11 @@ const markdownDefaults = __spreadProps$j(__spreadValues$k({}, markdownAndChangel
1853
2198
  excludeTags: [],
1854
2199
  includeFieldSecurityMetadata: false,
1855
2200
  includeInlineHelpTextMetadata: false,
1856
- experimentalLwcSupport: false
2201
+ experimentalLwcSupport: false,
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
1857
2206
  });
1858
2207
  const openApiDefaults = __spreadProps$j(__spreadValues$k({}, commonDefaults), {
1859
2208
  fileName: "openapi",
@@ -3275,7 +3624,10 @@ function generateForApex(apexBundles, config) {
3275
3624
  const removeExcluded = apply(removeExcludedTags, config.excludeTags);
3276
3625
  return _function.pipe(
3277
3626
  apexBundles,
3278
- reflectApexSource,
3627
+ (bundles) => reflectApexSource(bundles, {
3628
+ parallelReflection: config.parallelReflection,
3629
+ parallelReflectionMaxWorkers: config.parallelReflectionMaxWorkers
3630
+ }),
3279
3631
  TE__namespace.map(filterOutOfScope),
3280
3632
  TE__namespace.map(addInheritedMembersToTypes),
3281
3633
  TE__namespace.map(addInheritanceChainToTypes),
@@ -5097,6 +5449,9 @@ var __async$1 = (__this, __arguments, generator) => {
5097
5449
  step((generator = generator.apply(__this, __arguments)).next());
5098
5450
  });
5099
5451
  };
5452
+ const changelogReflectionConfig = {
5453
+ parallelReflection: false
5454
+ };
5100
5455
  function generateChangeLog(oldBundles, newBundles, config) {
5101
5456
  const convertToPageData = apply(toPageData, config.fileName);
5102
5457
  function handleConversion({ changelog, newManifest }) {
@@ -5127,7 +5482,7 @@ function generateChangeLog(oldBundles, newBundles, config) {
5127
5482
  function reflect(bundles, config) {
5128
5483
  const filterOutOfScopeApex = apply(filterScope, config.scope);
5129
5484
  function reflectApexFiles(sourceFiles) {
5130
- return _function.pipe(reflectApexSource(sourceFiles), TE__namespace.map(filterOutOfScopeApex));
5485
+ return _function.pipe(reflectApexSource(sourceFiles, changelogReflectionConfig), TE__namespace.map(filterOutOfScopeApex));
5131
5486
  }
5132
5487
  return _function.pipe(
5133
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.0",
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.0",
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",