@cparra/apexdocs 3.17.0-beta.7 → 3.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -33
- package/dist/apex-reflection.worker.js +19 -18
- package/dist/cli/generate.js +1 -1
- package/dist/index.d.ts +0 -30
- package/dist/index.js +1 -1
- package/dist/{logger-H9NRKPFV.js → logger-Cr1iCXZc.js} +9 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,14 +89,6 @@ Here are some live projects using ApexDocs:
|
|
|
89
89
|
* Custom tag support
|
|
90
90
|
* And much, much more!
|
|
91
91
|
|
|
92
|
-
## ⚡ Parallel reflection (performance)
|
|
93
|
-
|
|
94
|
-
ApexDocs can speed up documentation generation by running reflection work in parallel (enabled by default).
|
|
95
|
-
If you run into issues or want deterministic behavior, you can disable it with:
|
|
96
|
-
|
|
97
|
-
- `--parallelReflection false`
|
|
98
|
-
- or via config: `parallelReflection: false`
|
|
99
|
-
|
|
100
92
|
## 💿 Installation
|
|
101
93
|
|
|
102
94
|
```bash
|
|
@@ -166,7 +158,7 @@ apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir f
|
|
|
166
158
|
| `--includeFieldSecurityMetadata` | N/A | Whether to include the compliance category and security classification for fields in the generated files. | `false` | No |
|
|
167
159
|
| `--includeInlineHelpTextMetadata` | N/A | Whether to include the inline help text for fields in the generated files. | `false` | No |
|
|
168
160
|
| `--parallelReflection` | N/A | Parallelize CPU-heavy reflection via worker threads. | `true` | No |
|
|
169
|
-
| `--parallelReflectionMaxWorkers` | N/A | Maximum number of worker threads to use for parallel reflection. Defaults to a reasonable value based on CPU count.
|
|
161
|
+
| `--parallelReflectionMaxWorkers` | N/A | Maximum number of worker threads to use for parallel reflection. Defaults to a reasonable value based on CPU count. | N/A | No |
|
|
170
162
|
|
|
171
163
|
> **Note:** The `*` in the Required column indicates that **one** of the source directory options must be specified:
|
|
172
164
|
> - `--sourceDir` (single directory or array of directories)
|
|
@@ -214,16 +206,16 @@ apexdocs markdown -s force-app -t docs -p global public namespaceaccessible -n M
|
|
|
214
206
|
|
|
215
207
|
#### Flags
|
|
216
208
|
|
|
217
|
-
| Flag
|
|
218
|
-
|
|
219
|
-
| `--sourceDir`
|
|
220
|
-
| `--targetDir`
|
|
221
|
-
| `--fileName`
|
|
222
|
-
| `--namespace`
|
|
223
|
-
| `--title`
|
|
224
|
-
| `--apiVersion`
|
|
225
|
-
| `--parallelReflection`
|
|
226
|
-
| `--parallelReflectionMaxWorkers` | N/A
|
|
209
|
+
| Flag | Alias | Description | Default | Required |
|
|
210
|
+
|----------------------------------|-------|--------------------------------------------------------------------------------------------------|-----------------|----------|
|
|
211
|
+
| `--sourceDir` | `-s` | The directory where the source files are located. | N/A | Yes |
|
|
212
|
+
| `--targetDir` | `-t` | The directory where the generated files will be placed. | `docs` | No |
|
|
213
|
+
| `--fileName` | N/A | The name of the OpenApi file. | `openapi.json` | No |
|
|
214
|
+
| `--namespace` | N/A | The package namespace, if any. This will be added to the API file Server Url. | N/A | No |
|
|
215
|
+
| `--title` | N/A | The title of the OpenApi file. | `Apex REST API` | No |
|
|
216
|
+
| `--apiVersion` | N/A | The version of the API. | `1.0.0` | No |
|
|
217
|
+
| `--parallelReflection` | N/A | Parallelize CPU-heavy reflection via worker threads. | `true` | No |
|
|
218
|
+
| `--parallelReflectionMaxWorkers` | N/A | Maximum number of worker threads to use for parallel reflection. Defaults to a reasonable value. | N/A | No |
|
|
227
219
|
|
|
228
220
|
#### Sample Usage
|
|
229
221
|
|
|
@@ -237,17 +229,17 @@ apexdocs openapi -s force-app -t docs -n MyNamespace --title "My Custom OpenApi
|
|
|
237
229
|
|
|
238
230
|
#### Flags
|
|
239
231
|
|
|
240
|
-
| Flag
|
|
241
|
-
|
|
242
|
-
| `--previousVersionDir`
|
|
243
|
-
| `--currentVersionDir`
|
|
244
|
-
| `--targetDir`
|
|
245
|
-
| `--fileName`
|
|
246
|
-
| `--scope`
|
|
247
|
-
| `--customObjectVisibility`
|
|
248
|
-
| `--skipIfNoChanges`
|
|
249
|
-
| `--parallelReflection`
|
|
250
|
-
| `--parallelReflectionMaxWorkers` | N/A
|
|
232
|
+
| Flag | Alias | Description | Default | Required |
|
|
233
|
+
|----------------------------------|-------|--------------------------------------------------------------------------------------------------|-------------|----------|
|
|
234
|
+
| `--previousVersionDir` | `-p` | The directory location of the previous version of the source code. | N/A | Yes |
|
|
235
|
+
| `--currentVersionDir` | `-t` | The directory location of the current version of the source code. | N/A | Yes |
|
|
236
|
+
| `--targetDir` | `-t` | The directory location where the changelog file will be generated. | `./docs/` | No |
|
|
237
|
+
| `--fileName` | N/A | The name of the changelog file to be generated. | `changelog` | No |
|
|
238
|
+
| `--scope` | N/A | The list of scope to respect when generating the changelog. | ['global'] | No |
|
|
239
|
+
| `--customObjectVisibility` | `-v` | Controls which custom objects are documented. Values should be separated by a space. | ['public'] | No |
|
|
240
|
+
| `--skipIfNoChanges` | N/A | Whether to skip generating the changelog if there are no changes. | `true` | No |
|
|
241
|
+
| `--parallelReflection` | N/A | Parallelize CPU-heavy reflection via worker threads. | `true` | No |
|
|
242
|
+
| `--parallelReflectionMaxWorkers` | N/A | Maximum number of worker threads to use for parallel reflection. Defaults to a reasonable value. | N/A | No |
|
|
251
243
|
|
|
252
244
|
#### Sample Usage
|
|
253
245
|
|
|
@@ -591,12 +583,14 @@ public class MyClass {
|
|
|
591
583
|
|
|
592
584
|
##### **templates**
|
|
593
585
|
|
|
594
|
-
Allows providing custom templates for generating Markdown documentation, giving you control over the output format.
|
|
586
|
+
Allows providing custom templates for generating Markdown documentation, giving you control over the output format.
|
|
595
587
|
You can define templates for each type of metadata
|
|
596
588
|
supported by the `markdown` command (class, interface, enum, trigger, LWC, custom object, and reference guide) .
|
|
597
589
|
|
|
598
|
-
For detailed information about creating custom templates, including examples, available helpers, and configuration
|
|
599
|
-
|
|
590
|
+
For detailed information about creating custom templates, including examples, available helpers, and configuration
|
|
591
|
+
options,
|
|
592
|
+
please refer to the [wiki documentation](https://github.com/cesarParra/apexdocs/wiki/5.-Custom-Templates). You can also
|
|
593
|
+
find a working example in the
|
|
600
594
|
`examples/markdown-custom-templates` directory.
|
|
601
595
|
|
|
602
596
|
#### Changelog Hooks
|
|
@@ -2,23 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const node_worker_threads_1 = require("node:worker_threads");
|
|
4
4
|
const apex_reflection_1 = require("@cparra/apex-reflection");
|
|
5
|
-
function isRequestMessage(
|
|
6
|
-
if (!
|
|
5
|
+
function isRequestMessage(message) {
|
|
6
|
+
if (!message || typeof message !== 'object') {
|
|
7
7
|
return false;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
}
|
|
9
|
+
const candidateMessage = message;
|
|
10
|
+
if (typeof candidateMessage.id !== 'number') {
|
|
10
11
|
return false;
|
|
11
|
-
|
|
12
|
+
}
|
|
13
|
+
if (!candidateMessage.payload || typeof candidateMessage.payload !== 'object') {
|
|
12
14
|
return false;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
}
|
|
16
|
+
const candidatePayload = candidateMessage.payload;
|
|
17
|
+
return typeof candidatePayload.content === 'string';
|
|
15
18
|
}
|
|
16
|
-
function post(
|
|
19
|
+
function post(responseMessage) {
|
|
17
20
|
// `parentPort` should always exist in a worker, but guard anyway.
|
|
18
21
|
if (!node_worker_threads_1.parentPort) {
|
|
19
22
|
return;
|
|
20
23
|
}
|
|
21
|
-
node_worker_threads_1.parentPort.postMessage(
|
|
24
|
+
node_worker_threads_1.parentPort.postMessage(responseMessage);
|
|
22
25
|
}
|
|
23
26
|
function reflectOrThrow(rawSource) {
|
|
24
27
|
const result = (0, apex_reflection_1.reflect)(rawSource);
|
|
@@ -33,25 +36,23 @@ function reflectOrThrow(rawSource) {
|
|
|
33
36
|
if (!node_worker_threads_1.parentPort) {
|
|
34
37
|
throw new Error('apex-reflection.worker started without a parentPort');
|
|
35
38
|
}
|
|
36
|
-
node_worker_threads_1.parentPort.on('message', (
|
|
37
|
-
if (!isRequestMessage(
|
|
39
|
+
node_worker_threads_1.parentPort.on('message', (message) => {
|
|
40
|
+
if (!isRequestMessage(message)) {
|
|
38
41
|
// Can't correlate without a valid id; ignore.
|
|
39
42
|
return;
|
|
40
43
|
}
|
|
41
|
-
const { id, payload } =
|
|
44
|
+
const { id, payload } = message;
|
|
42
45
|
try {
|
|
43
46
|
const typeMirror = reflectOrThrow(payload.content);
|
|
44
47
|
post({ id, ok: true, result: typeMirror });
|
|
45
48
|
}
|
|
46
|
-
catch (
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
? e.message
|
|
50
|
-
: 'Unknown error';
|
|
49
|
+
catch (caughtError) {
|
|
50
|
+
const candidateMessage = caughtError === null || caughtError === void 0 ? void 0 : caughtError.message;
|
|
51
|
+
const errorMessage = typeof candidateMessage === 'string' ? candidateMessage : 'Unknown error';
|
|
51
52
|
post({
|
|
52
53
|
id,
|
|
53
54
|
ok: false,
|
|
54
|
-
error: { message },
|
|
55
|
+
error: { message: errorMessage },
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
});
|
package/dist/cli/generate.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -400,17 +400,7 @@ 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
403
|
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
404
|
parallelReflectionMaxWorkers?: number;
|
|
415
405
|
};
|
|
416
406
|
|
|
@@ -433,17 +423,7 @@ type UserDefinedOpenApiConfig = {
|
|
|
433
423
|
title: string;
|
|
434
424
|
apiVersion: string;
|
|
435
425
|
exclude: string[];
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* Parallelize CPU-heavy reflection via worker threads.
|
|
439
|
-
* Defaults to true.
|
|
440
|
-
*/
|
|
441
426
|
parallelReflection: boolean;
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Maximum number of worker threads to use for parallel reflection.
|
|
445
|
-
* Defaults to a reasonable value based on CPU count.
|
|
446
|
-
*/
|
|
447
427
|
parallelReflectionMaxWorkers?: number;
|
|
448
428
|
};
|
|
449
429
|
|
|
@@ -458,17 +438,7 @@ type UserDefinedChangelogConfig = {
|
|
|
458
438
|
exclude: string[];
|
|
459
439
|
skipIfNoChanges: boolean;
|
|
460
440
|
translations?: UserTranslations['changelog'];
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Parallelize CPU-heavy reflection via worker threads.
|
|
464
|
-
* Defaults to true.
|
|
465
|
-
*/
|
|
466
441
|
parallelReflection: boolean;
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* Maximum number of worker threads to use for parallel reflection.
|
|
470
|
-
* Defaults to a reasonable value based on CPU count.
|
|
471
|
-
*/
|
|
472
442
|
parallelReflectionMaxWorkers?: number;
|
|
473
443
|
} & Partial<ChangelogConfigurableHooks>;
|
|
474
444
|
|
package/dist/index.js
CHANGED
|
@@ -1198,21 +1198,6 @@ class WorkerPool {
|
|
|
1198
1198
|
this.pump();
|
|
1199
1199
|
});
|
|
1200
1200
|
}
|
|
1201
|
-
/**
|
|
1202
|
-
* Returns current pool stats.
|
|
1203
|
-
*/
|
|
1204
|
-
stats() {
|
|
1205
|
-
return {
|
|
1206
|
-
maxWorkers: this.maxWorkers,
|
|
1207
|
-
activeWorkers: this.allWorkers.size,
|
|
1208
|
-
idleWorkers: this.idleWorkers.length,
|
|
1209
|
-
queuedTasks: this.queue.length,
|
|
1210
|
-
inFlightTasks: this.inFlightByWorker.size,
|
|
1211
|
-
createdWorkers: this.createdWorkers,
|
|
1212
|
-
completedTasks: this.completedTasks,
|
|
1213
|
-
failedTasks: this.failedTasks
|
|
1214
|
-
};
|
|
1215
|
-
}
|
|
1216
1201
|
/**
|
|
1217
1202
|
* Terminates all workers and rejects queued tasks (unless drainOnTerminate=true).
|
|
1218
1203
|
*
|
|
@@ -1277,8 +1262,7 @@ class WorkerPool {
|
|
|
1277
1262
|
const idleWorker = this.idleWorkers.pop();
|
|
1278
1263
|
if (idleWorker) return idleWorker;
|
|
1279
1264
|
if (this.allWorkers.size < this.maxWorkers) {
|
|
1280
|
-
|
|
1281
|
-
return spawnedWorker;
|
|
1265
|
+
return this.spawnWorker();
|
|
1282
1266
|
}
|
|
1283
1267
|
return null;
|
|
1284
1268
|
}
|
|
@@ -1460,8 +1444,12 @@ function supportsWorkerThreads() {
|
|
|
1460
1444
|
function isWorkerReflectionEnabled(config) {
|
|
1461
1445
|
var _a, _b;
|
|
1462
1446
|
const env = ((_a = process.env.APEXDOCS_WORKER_REFLECTION) != null ? _a : "").toLowerCase();
|
|
1463
|
-
if (env === "true" || env === "1")
|
|
1464
|
-
|
|
1447
|
+
if (env === "true" || env === "1") {
|
|
1448
|
+
return true;
|
|
1449
|
+
}
|
|
1450
|
+
if (env === "false" || env === "0") {
|
|
1451
|
+
return false;
|
|
1452
|
+
}
|
|
1465
1453
|
return (_b = config == null ? void 0 : config.parallelReflection) != null ? _b : true;
|
|
1466
1454
|
}
|
|
1467
1455
|
function getWorkerEntrypointPath() {
|
|
@@ -1480,16 +1468,13 @@ function reflectAsTaskParallel(apexBundles, config) {
|
|
|
1480
1468
|
const maxWorkers = Math.max(1, (_c = config == null ? void 0 : config.parallelReflectionMaxWorkers) != null ? _c : defaultMax);
|
|
1481
1469
|
const pool = new WorkerPool(() => new node_worker_threads.Worker(getWorkerEntrypointPath()), {
|
|
1482
1470
|
maxWorkers
|
|
1483
|
-
// Keep default queue size (Infinity) unless we later decide to bound it via config.
|
|
1484
1471
|
});
|
|
1485
1472
|
try {
|
|
1486
|
-
|
|
1473
|
+
return yield Promise.all(
|
|
1487
1474
|
apexBundles.map((bundle) => __async$5(null, null, function* () {
|
|
1488
|
-
|
|
1489
|
-
return typeMirror;
|
|
1475
|
+
return yield pool.run({ content: bundle.content });
|
|
1490
1476
|
}))
|
|
1491
1477
|
);
|
|
1492
|
-
return results;
|
|
1493
1478
|
} finally {
|
|
1494
1479
|
yield pool.terminate();
|
|
1495
1480
|
}
|
|
@@ -2184,9 +2169,7 @@ const markdownDefaults = __spreadProps$j(__spreadValues$k({}, markdownAndChangel
|
|
|
2184
2169
|
includeFieldSecurityMetadata: false,
|
|
2185
2170
|
includeInlineHelpTextMetadata: false,
|
|
2186
2171
|
experimentalLwcSupport: false,
|
|
2187
|
-
// Performance: parallel reflection via worker threads (enabled by default).
|
|
2188
2172
|
parallelReflection: true,
|
|
2189
|
-
// Default is computed at runtime if not provided.
|
|
2190
2173
|
parallelReflectionMaxWorkers: void 0
|
|
2191
2174
|
});
|
|
2192
2175
|
const openApiDefaults = __spreadProps$j(__spreadValues$k({}, commonDefaults), {
|
|
@@ -2194,17 +2177,13 @@ const openApiDefaults = __spreadProps$j(__spreadValues$k({}, commonDefaults), {
|
|
|
2194
2177
|
title: "Apex REST API",
|
|
2195
2178
|
apiVersion: "1.0.0",
|
|
2196
2179
|
exclude: [],
|
|
2197
|
-
// Performance: parallel reflection via worker threads (enabled by default).
|
|
2198
2180
|
parallelReflection: true,
|
|
2199
|
-
// Default is computed at runtime if not provided.
|
|
2200
2181
|
parallelReflectionMaxWorkers: void 0
|
|
2201
2182
|
});
|
|
2202
2183
|
const changeLogDefaults = __spreadProps$j(__spreadValues$k({}, markdownAndChangelogDefaults), {
|
|
2203
2184
|
fileName: "changelog",
|
|
2204
2185
|
skipIfNoChanges: true,
|
|
2205
|
-
// Performance: parallel reflection via worker threads (enabled by default).
|
|
2206
2186
|
parallelReflection: true,
|
|
2207
|
-
// Default is computed at runtime if not provided.
|
|
2208
2187
|
parallelReflectionMaxWorkers: void 0
|
|
2209
2188
|
});
|
|
2210
2189
|
|