@cparra/apexdocs 3.19.9-beta.4 → 3.19.9-beta.5
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/dist/cli/generate.js +69 -79
- package/dist/{logger-Bm8lUpMI.js → error-collector-8w5-IHGX.js} +212 -93
- package/dist/index.js +23 -12
- package/package.json +1 -1
package/dist/cli/generate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var errorCollector = require('../error-collector-8w5-IHGX.js');
|
|
5
5
|
var cosmiconfig = require('cosmiconfig');
|
|
6
6
|
var yargs = require('yargs');
|
|
7
7
|
var E = require('fp-ts/Either');
|
|
@@ -79,42 +79,42 @@ const markdownOptions = {
|
|
|
79
79
|
targetDir: {
|
|
80
80
|
type: "string",
|
|
81
81
|
alias: "t",
|
|
82
|
-
default:
|
|
82
|
+
default: errorCollector.markdownDefaults.targetDir,
|
|
83
83
|
describe: "The directory location where documentation will be generated to."
|
|
84
84
|
},
|
|
85
85
|
scope: {
|
|
86
86
|
type: "string",
|
|
87
87
|
array: true,
|
|
88
88
|
alias: "p",
|
|
89
|
-
default:
|
|
89
|
+
default: errorCollector.markdownDefaults.scope,
|
|
90
90
|
describe: "A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. Annotations are supported and should be passed lowercased and without the @ symbol, e.g. namespaceaccessible auraenabled."
|
|
91
91
|
},
|
|
92
92
|
customObjectVisibility: {
|
|
93
93
|
type: "string",
|
|
94
94
|
array: true,
|
|
95
95
|
alias: "v",
|
|
96
|
-
default:
|
|
96
|
+
default: errorCollector.markdownDefaults.customObjectVisibility,
|
|
97
97
|
choices: ["public", "protected", "packageprotected"],
|
|
98
98
|
describe: "Controls which custom objects are documented. Values should be separated by a space."
|
|
99
99
|
},
|
|
100
100
|
defaultGroupName: {
|
|
101
101
|
type: "string",
|
|
102
|
-
default:
|
|
102
|
+
default: errorCollector.markdownDefaults.defaultGroupName,
|
|
103
103
|
describe: "Defines the @group name to be used when a file does not specify it."
|
|
104
104
|
},
|
|
105
105
|
customObjectsGroupName: {
|
|
106
106
|
type: "string",
|
|
107
|
-
default:
|
|
107
|
+
default: errorCollector.markdownDefaults.customObjectsGroupName,
|
|
108
108
|
describe: "The name under which custom objects will be grouped in the Reference Guide"
|
|
109
109
|
},
|
|
110
110
|
triggersGroupName: {
|
|
111
111
|
type: "string",
|
|
112
|
-
default:
|
|
112
|
+
default: errorCollector.markdownDefaults.triggersGroupName,
|
|
113
113
|
describe: "The name under which triggers will be grouped in the Reference Guide"
|
|
114
114
|
},
|
|
115
115
|
lwcGroupName: {
|
|
116
116
|
type: "string",
|
|
117
|
-
default:
|
|
117
|
+
default: errorCollector.markdownDefaults.lwcGroupName,
|
|
118
118
|
describe: "The name under which Lightning Web Components will be grouped in the Reference Guide"
|
|
119
119
|
},
|
|
120
120
|
namespace: {
|
|
@@ -124,28 +124,28 @@ const markdownOptions = {
|
|
|
124
124
|
sortAlphabetically: {
|
|
125
125
|
type: "boolean",
|
|
126
126
|
describe: "Whether to sort files and members alphabetically.",
|
|
127
|
-
default:
|
|
127
|
+
default: errorCollector.markdownDefaults.sortAlphabetically
|
|
128
128
|
},
|
|
129
129
|
includeMetadata: {
|
|
130
130
|
type: "boolean",
|
|
131
131
|
describe: "Whether to include the file's meta.xml information: Whether it is active and and the API version",
|
|
132
|
-
default:
|
|
132
|
+
default: errorCollector.markdownDefaults.includeMetadata
|
|
133
133
|
},
|
|
134
134
|
linkingStrategy: {
|
|
135
135
|
type: "string",
|
|
136
136
|
describe: "The strategy to use when linking to other documentation pages.",
|
|
137
137
|
choices: ["relative", "no-link", "none"],
|
|
138
|
-
default:
|
|
138
|
+
default: errorCollector.markdownDefaults.linkingStrategy
|
|
139
139
|
},
|
|
140
140
|
referenceGuideTitle: {
|
|
141
141
|
type: "string",
|
|
142
142
|
describe: "The title of the reference guide.",
|
|
143
|
-
default:
|
|
143
|
+
default: errorCollector.markdownDefaults.referenceGuideTitle
|
|
144
144
|
},
|
|
145
145
|
includeFieldSecurityMetadata: {
|
|
146
146
|
type: "boolean",
|
|
147
147
|
describe: "Whether to include the compliance category and security classification for fields in the generated files.",
|
|
148
|
-
default:
|
|
148
|
+
default: errorCollector.markdownDefaults.includeFieldSecurityMetadata
|
|
149
149
|
},
|
|
150
150
|
includeInlineHelpTextMetadata: {
|
|
151
151
|
type: "boolean",
|
|
@@ -154,17 +154,17 @@ const markdownOptions = {
|
|
|
154
154
|
experimentalLwcSupport: {
|
|
155
155
|
type: "boolean",
|
|
156
156
|
describe: "Enable experimental support for documenting Lightning Web Components (LWC).",
|
|
157
|
-
default:
|
|
157
|
+
default: errorCollector.markdownDefaults.experimentalLwcSupport
|
|
158
158
|
},
|
|
159
159
|
parallelReflection: {
|
|
160
160
|
type: "boolean",
|
|
161
161
|
describe: "Parallelize CPU-heavy reflection via worker threads.",
|
|
162
|
-
default:
|
|
162
|
+
default: errorCollector.markdownDefaults.parallelReflection
|
|
163
163
|
},
|
|
164
164
|
parallelReflectionMaxWorkers: {
|
|
165
165
|
type: "number",
|
|
166
166
|
describe: "Maximum number of worker threads to use for parallel reflection. Defaults to a reasonable value based on CPU count.",
|
|
167
|
-
default:
|
|
167
|
+
default: errorCollector.markdownDefaults.parallelReflectionMaxWorkers
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
170
|
|
|
@@ -200,12 +200,12 @@ const openApiOptions = {
|
|
|
200
200
|
targetDir: {
|
|
201
201
|
type: "string",
|
|
202
202
|
alias: "t",
|
|
203
|
-
default:
|
|
203
|
+
default: errorCollector.openApiDefaults.targetDir,
|
|
204
204
|
describe: "The directory location where the OpenApi file will be generated."
|
|
205
205
|
},
|
|
206
206
|
fileName: {
|
|
207
207
|
type: "string",
|
|
208
|
-
default:
|
|
208
|
+
default: errorCollector.openApiDefaults.fileName,
|
|
209
209
|
describe: "The name of the OpenApi file to be generated."
|
|
210
210
|
},
|
|
211
211
|
namespace: {
|
|
@@ -214,23 +214,23 @@ const openApiOptions = {
|
|
|
214
214
|
},
|
|
215
215
|
title: {
|
|
216
216
|
type: "string",
|
|
217
|
-
default:
|
|
217
|
+
default: errorCollector.openApiDefaults.title,
|
|
218
218
|
describe: "The title of the OpenApi file."
|
|
219
219
|
},
|
|
220
220
|
apiVersion: {
|
|
221
221
|
type: "string",
|
|
222
|
-
default:
|
|
222
|
+
default: errorCollector.openApiDefaults.apiVersion,
|
|
223
223
|
describe: "The version of the OpenApi file."
|
|
224
224
|
},
|
|
225
225
|
parallelReflection: {
|
|
226
226
|
type: "boolean",
|
|
227
227
|
describe: "Parallelize CPU-heavy reflection via worker threads.",
|
|
228
|
-
default:
|
|
228
|
+
default: errorCollector.openApiDefaults.parallelReflection
|
|
229
229
|
},
|
|
230
230
|
parallelReflectionMaxWorkers: {
|
|
231
231
|
type: "number",
|
|
232
232
|
describe: "Maximum number of worker threads to use for parallel reflection. Defaults to a reasonable value based on CPU count.",
|
|
233
|
-
default:
|
|
233
|
+
default: errorCollector.openApiDefaults.parallelReflectionMaxWorkers
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
236
|
|
|
@@ -249,12 +249,12 @@ const changeLogOptions = {
|
|
|
249
249
|
parallelReflection: {
|
|
250
250
|
type: "boolean",
|
|
251
251
|
describe: "Parallelize CPU-heavy reflection via worker threads.",
|
|
252
|
-
default:
|
|
252
|
+
default: errorCollector.markdownDefaults.parallelReflection
|
|
253
253
|
},
|
|
254
254
|
parallelReflectionMaxWorkers: {
|
|
255
255
|
type: "number",
|
|
256
256
|
describe: "Maximum number of worker threads to use for parallel reflection. Defaults to a reasonable value based on CPU count.",
|
|
257
|
-
default:
|
|
257
|
+
default: errorCollector.markdownDefaults.parallelReflectionMaxWorkers
|
|
258
258
|
},
|
|
259
259
|
previousVersionDir: {
|
|
260
260
|
type: "string",
|
|
@@ -273,32 +273,32 @@ const changeLogOptions = {
|
|
|
273
273
|
targetDir: {
|
|
274
274
|
type: "string",
|
|
275
275
|
alias: "t",
|
|
276
|
-
default:
|
|
276
|
+
default: errorCollector.changeLogDefaults.targetDir,
|
|
277
277
|
describe: "The directory location where the changelog file will be generated."
|
|
278
278
|
},
|
|
279
279
|
fileName: {
|
|
280
280
|
type: "string",
|
|
281
|
-
default:
|
|
281
|
+
default: errorCollector.changeLogDefaults.fileName,
|
|
282
282
|
describe: "The name of the changelog file to be generated."
|
|
283
283
|
},
|
|
284
284
|
scope: {
|
|
285
285
|
type: "string",
|
|
286
286
|
array: true,
|
|
287
287
|
alias: "s",
|
|
288
|
-
default:
|
|
288
|
+
default: errorCollector.changeLogDefaults.scope,
|
|
289
289
|
describe: "The list of scope to respect when generating the changelog. Values should be separated by a space, e.g --scope global public namespaceaccessible. Annotations are supported and should be passed lowercased and without the @ symbol, e.g. namespaceaccessible auraenabled."
|
|
290
290
|
},
|
|
291
291
|
customObjectVisibility: {
|
|
292
292
|
type: "string",
|
|
293
293
|
array: true,
|
|
294
294
|
alias: "v",
|
|
295
|
-
default:
|
|
295
|
+
default: errorCollector.changeLogDefaults.customObjectVisibility,
|
|
296
296
|
choices: ["public", "protected", "packageprotected"],
|
|
297
297
|
describe: "Controls which custom objects are documented. Values should be separated by a space."
|
|
298
298
|
},
|
|
299
299
|
skipIfNoChanges: {
|
|
300
300
|
type: "boolean",
|
|
301
|
-
default:
|
|
301
|
+
default: errorCollector.changeLogDefaults.skipIfNoChanges,
|
|
302
302
|
describe: "Skip the changelog generation if there are no changes between the previous and current version."
|
|
303
303
|
}
|
|
304
304
|
};
|
|
@@ -406,13 +406,13 @@ function extractArgsForCommandProvidedThroughCli(extractFromProcessFn, config) {
|
|
|
406
406
|
switch (mergedConfig.targetGenerator) {
|
|
407
407
|
case "markdown":
|
|
408
408
|
return _function.pipe(
|
|
409
|
-
|
|
409
|
+
errorCollector.validateSourceDirectoryConfig(extractSourceDirectoryConfig(mergedConfig)),
|
|
410
410
|
E__namespace.mapLeft((error) => new Error(`Invalid markdown configuration: ${error.message}`)),
|
|
411
411
|
E__namespace.map(() => __spreadValues(__spreadValues({}, configOnlyMarkdownDefaults), mergedConfig))
|
|
412
412
|
);
|
|
413
413
|
case "openapi":
|
|
414
414
|
return _function.pipe(
|
|
415
|
-
|
|
415
|
+
errorCollector.validateSourceDirectoryConfig(extractSourceDirectoryConfig(mergedConfig)),
|
|
416
416
|
E__namespace.mapLeft((error) => new Error(`Invalid openapi configuration: ${error.message}`)),
|
|
417
417
|
E__namespace.map(() => __spreadValues(__spreadValues({}, configOnlyOpenApiDefaults), mergedConfig))
|
|
418
418
|
);
|
|
@@ -440,7 +440,7 @@ function extractArgsForCommandsProvidedInConfig(extractFromProcessFn, config) {
|
|
|
440
440
|
E__namespace.flatMap((cliArgs) => {
|
|
441
441
|
const mergedConfig = __spreadValues(__spreadValues(__spreadValues({}, configOnlyMarkdownDefaults), generatorConfig), cliArgs);
|
|
442
442
|
return _function.pipe(
|
|
443
|
-
|
|
443
|
+
errorCollector.validateSourceDirectoryConfig(extractSourceDirectoryConfig(mergedConfig)),
|
|
444
444
|
E__namespace.mapLeft((error) => new Error(`Invalid markdown configuration: ${error.message}`)),
|
|
445
445
|
E__namespace.map(() => mergedConfig)
|
|
446
446
|
);
|
|
@@ -452,7 +452,7 @@ function extractArgsForCommandsProvidedInConfig(extractFromProcessFn, config) {
|
|
|
452
452
|
E__namespace.flatMap((cliArgs) => {
|
|
453
453
|
const mergedConfig = __spreadValues(__spreadValues(__spreadValues({}, configOnlyOpenApiDefaults), generatorConfig), cliArgs);
|
|
454
454
|
return _function.pipe(
|
|
455
|
-
|
|
455
|
+
errorCollector.validateSourceDirectoryConfig(extractSourceDirectoryConfig(mergedConfig)),
|
|
456
456
|
E__namespace.mapLeft((error) => new Error(`Invalid openapi configuration: ${error.message}`)),
|
|
457
457
|
E__namespace.map(() => mergedConfig)
|
|
458
458
|
);
|
|
@@ -557,8 +557,8 @@ function validateChangelogConfig(config) {
|
|
|
557
557
|
};
|
|
558
558
|
return _function.pipe(
|
|
559
559
|
E__namespace.Do,
|
|
560
|
-
E__namespace.bind("previousValid", () =>
|
|
561
|
-
E__namespace.bind("currentValid", () =>
|
|
560
|
+
E__namespace.bind("previousValid", () => errorCollector.validateSourceDirectoryConfig(previousVersionConfig)),
|
|
561
|
+
E__namespace.bind("currentValid", () => errorCollector.validateSourceDirectoryConfig(currentVersionConfig)),
|
|
562
562
|
E__namespace.map(() => config)
|
|
563
563
|
);
|
|
564
564
|
}
|
|
@@ -586,77 +586,67 @@ var __async = (__this, __arguments, generator) => {
|
|
|
586
586
|
function isDebugEnabledFromProcessArgs() {
|
|
587
587
|
return process.argv.includes("--debug");
|
|
588
588
|
}
|
|
589
|
-
const logger = new
|
|
589
|
+
const logger = new errorCollector.StdOutLogger();
|
|
590
590
|
logger.setDebug(isDebugEnabledFromProcessArgs());
|
|
591
|
-
const reflectionDebugLogger = logger$1.createReflectionDebugLogger(logger);
|
|
592
591
|
function main() {
|
|
593
|
-
const aggregatedFailures = [];
|
|
594
|
-
let aggregatedFailureCount = 0;
|
|
595
592
|
let commandsRun = 0;
|
|
596
|
-
function
|
|
597
|
-
if (!
|
|
593
|
+
function printFailuresAtEnd(collector, config) {
|
|
594
|
+
if (!collector.hasErrors()) {
|
|
598
595
|
return;
|
|
599
596
|
}
|
|
600
|
-
|
|
601
|
-
logger.
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
if (Array.isArray(failure)) {
|
|
609
|
-
return failure;
|
|
597
|
+
const count = collector.count();
|
|
598
|
+
logger.logSingle(
|
|
599
|
+
`\u26A0\uFE0F ${config.targetGenerator}: ${count} error item(s) occurred. Please review the following:`,
|
|
600
|
+
"red"
|
|
601
|
+
);
|
|
602
|
+
for (const item of collector.all()) {
|
|
603
|
+
logger.error(errorCollector.ErrorCollector.format(item));
|
|
610
604
|
}
|
|
611
|
-
return [failure];
|
|
612
605
|
}
|
|
613
|
-
function
|
|
614
|
-
if (
|
|
606
|
+
function printDebugSummary(collector) {
|
|
607
|
+
if (!logger.isDebugEnabled()) {
|
|
615
608
|
return;
|
|
616
609
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
logger.logSingle(`\u26A0\uFE0F ${count} error item(s) occurred. Please review the following issues:`, "red");
|
|
620
|
-
for (const item of flattened) {
|
|
621
|
-
logger.error(item);
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
function parseResult(result, config) {
|
|
625
|
-
E__namespace.match(
|
|
626
|
-
(failure) => {
|
|
627
|
-
logger.logSingle(`${config.targetGenerator}: completed with errors`, "red");
|
|
628
|
-
aggregatedFailures.push(failure);
|
|
629
|
-
aggregatedFailureCount += failureToErrorItems(failure).length;
|
|
630
|
-
},
|
|
631
|
-
(successMessage) => {
|
|
632
|
-
logger.logSingle(successMessage);
|
|
633
|
-
}
|
|
634
|
-
)(result);
|
|
610
|
+
logger.debug(`commandsRun=${commandsRun}`);
|
|
611
|
+
logger.debug(`aggregatedFailures=${collector.count()}`);
|
|
635
612
|
}
|
|
636
613
|
function catchUnexpectedError(error) {
|
|
637
614
|
logger.error(`\u274C An error occurred while processing the request: ${error}`);
|
|
638
615
|
process.exit(1);
|
|
639
616
|
}
|
|
617
|
+
function printResultMessage(result) {
|
|
618
|
+
if (E__namespace.isRight(result)) {
|
|
619
|
+
logger.logSingle("Documentation generated successfully");
|
|
620
|
+
}
|
|
621
|
+
}
|
|
640
622
|
extractArgs().then((maybeConfigs) => __async(null, null, function* () {
|
|
641
623
|
E__namespace.match(catchUnexpectedError, (configs) => __async(null, null, function* () {
|
|
642
624
|
for (const config of configs) {
|
|
643
625
|
commandsRun++;
|
|
626
|
+
const errorCollector$1 = new errorCollector.ErrorCollector(config.targetGenerator);
|
|
627
|
+
const reflectionDebugLogger = errorCollector.createReflectionDebugLogger(logger, (filePath, errorMessage) => {
|
|
628
|
+
errorCollector$1.addFailure("other", filePath, errorMessage);
|
|
629
|
+
});
|
|
644
630
|
if (logger.isDebugEnabled()) {
|
|
645
631
|
logger.debug(`Currently processing generator: ${config.targetGenerator}`);
|
|
646
632
|
}
|
|
647
|
-
const result = yield
|
|
633
|
+
const result = yield errorCollector.Apexdocs.generate(config, {
|
|
634
|
+
logger,
|
|
635
|
+
reflectionDebugLogger,
|
|
636
|
+
errorCollector: errorCollector$1
|
|
637
|
+
});
|
|
638
|
+
printResultMessage(result);
|
|
648
639
|
if (logger.isDebugEnabled()) {
|
|
649
640
|
logger.logSingle(
|
|
650
641
|
`${config.targetGenerator}: ${E__namespace.isRight(result) ? "success" : "failure"}`,
|
|
651
642
|
E__namespace.isRight(result) ? "green" : "red"
|
|
652
643
|
);
|
|
653
644
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
process.exitCode = 1;
|
|
645
|
+
printFailuresAtEnd(errorCollector$1, config);
|
|
646
|
+
printDebugSummary(errorCollector$1);
|
|
647
|
+
if (errorCollector$1.hasErrors()) {
|
|
648
|
+
process.exitCode = 1;
|
|
649
|
+
}
|
|
660
650
|
}
|
|
661
651
|
}))(maybeConfigs);
|
|
662
652
|
})).catch(catchUnexpectedError);
|
|
@@ -3671,7 +3671,7 @@ function generateDocs(unparsedBundles, config, debugLogger) {
|
|
|
3671
3671
|
const allParsed = [...apex.parsed, ...objects, ...triggers, ...lwcs];
|
|
3672
3672
|
const sorted = sort(filterOutCustomFieldsAndMetadata(allParsed));
|
|
3673
3673
|
if (apex.reflectionErrors.errors.length > 0) {
|
|
3674
|
-
return TE__namespace.left(
|
|
3674
|
+
return TE__namespace.left(new ReflectionErrors([]));
|
|
3675
3675
|
}
|
|
3676
3676
|
return TE__namespace.right(sorted);
|
|
3677
3677
|
}),
|
|
@@ -4854,40 +4854,31 @@ class OpenApiDocsProcessor {
|
|
|
4854
4854
|
}
|
|
4855
4855
|
}
|
|
4856
4856
|
|
|
4857
|
-
function createReflectionDebugLogger(logger) {
|
|
4858
|
-
if (!logger.isDebugEnabled()) {
|
|
4857
|
+
function createReflectionDebugLogger(logger, recordFailure) {
|
|
4858
|
+
if (!logger.isDebugEnabled() && !recordFailure) {
|
|
4859
4859
|
return noopReflectionDebugLogger;
|
|
4860
4860
|
}
|
|
4861
4861
|
return {
|
|
4862
4862
|
onStart: (filePath) => {
|
|
4863
|
-
logger.
|
|
4863
|
+
if (logger.isDebugEnabled()) {
|
|
4864
|
+
logger.debug(`Parsing: ${filePath}...`);
|
|
4865
|
+
}
|
|
4864
4866
|
},
|
|
4865
4867
|
onSuccess: (filePath) => {
|
|
4866
|
-
logger.
|
|
4868
|
+
if (logger.isDebugEnabled()) {
|
|
4869
|
+
logger.debug(`Parsing: ${filePath} OK`);
|
|
4870
|
+
}
|
|
4867
4871
|
},
|
|
4868
4872
|
onFailure: (filePath, errorMessage) => {
|
|
4869
|
-
logger.
|
|
4870
|
-
|
|
4873
|
+
if (logger.isDebugEnabled()) {
|
|
4874
|
+
logger.debug(`Parsing: ${filePath} FAILED`);
|
|
4875
|
+
logger.debug(`Parsing error: ${filePath} - ${errorMessage}`);
|
|
4876
|
+
}
|
|
4877
|
+
recordFailure == null ? void 0 : recordFailure(filePath, errorMessage);
|
|
4871
4878
|
}
|
|
4872
4879
|
};
|
|
4873
4880
|
}
|
|
4874
4881
|
|
|
4875
|
-
var __defProp$2 = Object.defineProperty;
|
|
4876
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
4877
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
4878
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
4879
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4880
|
-
var __spreadValues$2 = (a, b) => {
|
|
4881
|
-
for (var prop in b || (b = {}))
|
|
4882
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
4883
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
4884
|
-
if (__getOwnPropSymbols$2)
|
|
4885
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
4886
|
-
if (__propIsEnum$2.call(b, prop))
|
|
4887
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
4888
|
-
}
|
|
4889
|
-
return a;
|
|
4890
|
-
};
|
|
4891
4882
|
var __async$2 = (__this, __arguments, generator) => {
|
|
4892
4883
|
return new Promise((resolve, reject) => {
|
|
4893
4884
|
var fulfilled = (value) => {
|
|
@@ -4908,7 +4899,7 @@ var __async$2 = (__this, __arguments, generator) => {
|
|
|
4908
4899
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
4909
4900
|
});
|
|
4910
4901
|
};
|
|
4911
|
-
function openApi(logger, fileBodies, config) {
|
|
4902
|
+
function openApi(logger, fileBodies, config, errorCollector) {
|
|
4912
4903
|
return __async$2(this, null, function* () {
|
|
4913
4904
|
const sourceDirectory = (Array.isArray(config.sourceDir) ? config.sourceDir[0] : config.sourceDir) || (fileBodies.length > 0 ? fileBodies[0].filePath.split("/").slice(0, -1).join("/") : process.cwd());
|
|
4914
4905
|
OpenApiSettings.build({
|
|
@@ -4919,7 +4910,9 @@ function openApi(logger, fileBodies, config) {
|
|
|
4919
4910
|
namespace: config.namespace,
|
|
4920
4911
|
version: config.apiVersion
|
|
4921
4912
|
});
|
|
4922
|
-
const debugLogger = createReflectionDebugLogger(logger)
|
|
4913
|
+
const debugLogger = createReflectionDebugLogger(logger, (filePath, errorMessage) => {
|
|
4914
|
+
errorCollector.addFailure("apex", filePath, errorMessage);
|
|
4915
|
+
});
|
|
4923
4916
|
const reflectedEither = yield reflectApexSourceBestEffort(
|
|
4924
4917
|
fileBodies,
|
|
4925
4918
|
{
|
|
@@ -4937,11 +4930,6 @@ function openApi(logger, fileBodies, config) {
|
|
|
4937
4930
|
`\u26A0\uFE0F ${recoverableErrors.errors.length} file(s) failed to parse/reflect. Continuing with successfully reflected files.`,
|
|
4938
4931
|
"red"
|
|
4939
4932
|
);
|
|
4940
|
-
logger.error(
|
|
4941
|
-
new ReflectionErrors(
|
|
4942
|
-
recoverableErrors.errors.map((e) => __spreadValues$2({}, e))
|
|
4943
|
-
)
|
|
4944
|
-
);
|
|
4945
4933
|
}
|
|
4946
4934
|
const reflectionByPath = /* @__PURE__ */ new Map();
|
|
4947
4935
|
for (const parsed of parsedFiles) {
|
|
@@ -4975,11 +4963,12 @@ function openApi(logger, fileBodies, config) {
|
|
|
4975
4963
|
}
|
|
4976
4964
|
ErrorLogger.logErrors(logger, filteredTypes);
|
|
4977
4965
|
if (recoverableErrors.errors.length > 0) {
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4966
|
+
errorCollector.addGlobalFailure(
|
|
4967
|
+
"other",
|
|
4968
|
+
`OpenAPI generation completed with ${recoverableErrors.errors.length} reflection error item(s).`,
|
|
4969
|
+
recoverableErrors
|
|
4982
4970
|
);
|
|
4971
|
+
return E__namespace.left(new ReflectionErrors([]));
|
|
4983
4972
|
}
|
|
4984
4973
|
return E__namespace.right(void 0);
|
|
4985
4974
|
});
|
|
@@ -5598,21 +5587,21 @@ function changelogToSourceChangelog(changelog) {
|
|
|
5598
5587
|
};
|
|
5599
5588
|
}
|
|
5600
5589
|
|
|
5601
|
-
var __defProp$
|
|
5590
|
+
var __defProp$2 = Object.defineProperty;
|
|
5602
5591
|
var __defProps$1 = Object.defineProperties;
|
|
5603
5592
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
5604
|
-
var __getOwnPropSymbols$
|
|
5605
|
-
var __hasOwnProp$
|
|
5606
|
-
var __propIsEnum$
|
|
5607
|
-
var __defNormalProp$
|
|
5608
|
-
var __spreadValues$
|
|
5593
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
5594
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
5595
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
5596
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5597
|
+
var __spreadValues$2 = (a, b) => {
|
|
5609
5598
|
for (var prop in b || (b = {}))
|
|
5610
|
-
if (__hasOwnProp$
|
|
5611
|
-
__defNormalProp$
|
|
5612
|
-
if (__getOwnPropSymbols$
|
|
5613
|
-
for (var prop of __getOwnPropSymbols$
|
|
5614
|
-
if (__propIsEnum$
|
|
5615
|
-
__defNormalProp$
|
|
5599
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
5600
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
5601
|
+
if (__getOwnPropSymbols$2)
|
|
5602
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
5603
|
+
if (__propIsEnum$2.call(b, prop))
|
|
5604
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
5616
5605
|
}
|
|
5617
5606
|
return a;
|
|
5618
5607
|
};
|
|
@@ -5743,11 +5732,14 @@ function generateChangeLog(oldBundles, newBundles, config, debugLogger) {
|
|
|
5743
5732
|
page: postHookCompile(page),
|
|
5744
5733
|
combinedReflectionErrors
|
|
5745
5734
|
})),
|
|
5746
|
-
// Fail at the very end if we had any recoverable
|
|
5747
|
-
// so the CLI can
|
|
5735
|
+
// Fail at the very end if we had any recoverable reflection errors,
|
|
5736
|
+
// so the CLI can set an exit code after completing the work.
|
|
5737
|
+
//
|
|
5738
|
+
// We intentionally do NOT propagate individual error item details here.
|
|
5739
|
+
// Those are recorded via the per-generator ErrorCollector as they happen.
|
|
5748
5740
|
TE__namespace.flatMap(({ page, combinedReflectionErrors }) => {
|
|
5749
5741
|
if (combinedReflectionErrors.errors.length > 0) {
|
|
5750
|
-
return TE__namespace.left(
|
|
5742
|
+
return TE__namespace.left(new ReflectionErrors([]));
|
|
5751
5743
|
}
|
|
5752
5744
|
return TE__namespace.right(page);
|
|
5753
5745
|
})
|
|
@@ -5773,7 +5765,7 @@ function compile(translations) {
|
|
|
5773
5765
|
return (renderable) => {
|
|
5774
5766
|
const compilationRequest = {
|
|
5775
5767
|
template: changelogTemplate,
|
|
5776
|
-
source: __spreadProps$1(__spreadValues$
|
|
5768
|
+
source: __spreadProps$1(__spreadValues$2({}, renderable), {
|
|
5777
5769
|
title: translations.changelog.title
|
|
5778
5770
|
})
|
|
5779
5771
|
};
|
|
@@ -5799,14 +5791,14 @@ function transformChangelogPage(_0) {
|
|
|
5799
5791
|
if (isSkip(page)) {
|
|
5800
5792
|
return page;
|
|
5801
5793
|
}
|
|
5802
|
-
return __spreadValues$
|
|
5794
|
+
return __spreadValues$2(__spreadValues$2({}, page), yield hook(page));
|
|
5803
5795
|
});
|
|
5804
5796
|
}
|
|
5805
5797
|
function postHookCompile(page) {
|
|
5806
5798
|
if (isSkip(page)) {
|
|
5807
5799
|
return page;
|
|
5808
5800
|
}
|
|
5809
|
-
return __spreadProps$1(__spreadValues$
|
|
5801
|
+
return __spreadProps$1(__spreadValues$2({}, page), {
|
|
5810
5802
|
content: Template.getInstance().compile({
|
|
5811
5803
|
source: {
|
|
5812
5804
|
frontmatter: toFrontmatterString(page.frontmatter),
|
|
@@ -5837,21 +5829,21 @@ function writeFilesToSystem(pageData, outputDir) {
|
|
|
5837
5829
|
);
|
|
5838
5830
|
}
|
|
5839
5831
|
|
|
5840
|
-
var __defProp = Object.defineProperty;
|
|
5832
|
+
var __defProp$1 = Object.defineProperty;
|
|
5841
5833
|
var __defProps = Object.defineProperties;
|
|
5842
5834
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5843
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5844
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5845
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5846
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5847
|
-
var __spreadValues = (a, b) => {
|
|
5835
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
5836
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
5837
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
5838
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5839
|
+
var __spreadValues$1 = (a, b) => {
|
|
5848
5840
|
for (var prop in b || (b = {}))
|
|
5849
|
-
if (__hasOwnProp.call(b, prop))
|
|
5850
|
-
__defNormalProp(a, prop, b[prop]);
|
|
5851
|
-
if (__getOwnPropSymbols)
|
|
5852
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
5853
|
-
if (__propIsEnum.call(b, prop))
|
|
5854
|
-
__defNormalProp(a, prop, b[prop]);
|
|
5841
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
5842
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
5843
|
+
if (__getOwnPropSymbols$1)
|
|
5844
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
5845
|
+
if (__propIsEnum$1.call(b, prop))
|
|
5846
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
5855
5847
|
}
|
|
5856
5848
|
return a;
|
|
5857
5849
|
};
|
|
@@ -6045,7 +6037,7 @@ function processFiles(fileSystem, config) {
|
|
|
6045
6037
|
(components) => {
|
|
6046
6038
|
return components.map((component) => {
|
|
6047
6039
|
const pathLocation = component.type.name === "ApexClass" ? component.content : component.xml;
|
|
6048
|
-
return __spreadProps(__spreadValues({}, component), {
|
|
6040
|
+
return __spreadProps(__spreadValues$1({}, component), {
|
|
6049
6041
|
filePath: pathLocation
|
|
6050
6042
|
});
|
|
6051
6043
|
});
|
|
@@ -6243,15 +6235,15 @@ class Apexdocs {
|
|
|
6243
6235
|
*/
|
|
6244
6236
|
static generate(config, deps) {
|
|
6245
6237
|
return __async(this, null, function* () {
|
|
6246
|
-
const { logger, reflectionDebugLogger } = deps;
|
|
6238
|
+
const { logger, reflectionDebugLogger, errorCollector } = deps;
|
|
6247
6239
|
logger.logSingle(`Generating ${config.targetGenerator} documentation...`);
|
|
6248
6240
|
try {
|
|
6249
6241
|
switch (config.targetGenerator) {
|
|
6250
6242
|
case "markdown": {
|
|
6251
|
-
return (yield processMarkdown(config, logger, reflectionDebugLogger))();
|
|
6243
|
+
return (yield processMarkdown(config, logger, reflectionDebugLogger, errorCollector))();
|
|
6252
6244
|
}
|
|
6253
6245
|
case "openapi": {
|
|
6254
|
-
const task = yield processOpenApi(config, logger);
|
|
6246
|
+
const task = yield processOpenApi(config, logger, errorCollector);
|
|
6255
6247
|
const openApiResult = yield task();
|
|
6256
6248
|
if (E__namespace.isLeft(openApiResult)) {
|
|
6257
6249
|
return E__namespace.left([openApiResult.left]);
|
|
@@ -6259,48 +6251,58 @@ class Apexdocs {
|
|
|
6259
6251
|
return E__namespace.right("\u2714\uFE0F Documentation generated successfully!");
|
|
6260
6252
|
}
|
|
6261
6253
|
case "changelog": {
|
|
6262
|
-
return (yield processChangeLog(config, logger, reflectionDebugLogger))();
|
|
6254
|
+
return (yield processChangeLog(config, logger, reflectionDebugLogger, errorCollector))();
|
|
6263
6255
|
}
|
|
6264
6256
|
}
|
|
6265
6257
|
} catch (error) {
|
|
6258
|
+
errorCollector.addGlobalFailure("other", String(error), error);
|
|
6266
6259
|
return E__namespace.left([error]);
|
|
6267
6260
|
}
|
|
6268
6261
|
});
|
|
6269
6262
|
}
|
|
6270
6263
|
}
|
|
6271
6264
|
const readFiles = apply(processFiles, new DefaultFileSystem());
|
|
6272
|
-
function processMarkdown(config, logger, reflectionDebugLogger) {
|
|
6265
|
+
function processMarkdown(config, logger, reflectionDebugLogger, errorCollector) {
|
|
6273
6266
|
return __async(this, null, function* () {
|
|
6274
6267
|
const debugLogger = reflectionDebugLogger;
|
|
6275
6268
|
return _function.pipe(
|
|
6276
6269
|
resolveAndValidateSourceDirectories(config),
|
|
6277
|
-
E__namespace.mapLeft((error) =>
|
|
6270
|
+
E__namespace.mapLeft((error) => {
|
|
6271
|
+
errorCollector.addGlobalFailure("read", `Failed to resolve source directories: ${error.message}`, error);
|
|
6272
|
+
return new FileReadingError(`Failed to resolve source directories: ${error.message}`, error);
|
|
6273
|
+
}),
|
|
6278
6274
|
E__namespace.flatMap(
|
|
6279
6275
|
(sourceDirs) => E__namespace.tryCatch(
|
|
6280
6276
|
() => readFiles({ experimentalLwcSupport: config.experimentalLwcSupport })(allComponentTypes, {
|
|
6281
6277
|
includeMetadata: config.includeMetadata
|
|
6282
6278
|
})(sourceDirs, config.exclude),
|
|
6283
|
-
(e) =>
|
|
6279
|
+
(e) => {
|
|
6280
|
+
errorCollector.addGlobalFailure("read", "An error occurred while reading files.", e);
|
|
6281
|
+
return new FileReadingError("An error occurred while reading files.", e);
|
|
6282
|
+
}
|
|
6284
6283
|
)
|
|
6285
6284
|
),
|
|
6286
6285
|
TE__namespace.fromEither,
|
|
6287
6286
|
TE__namespace.flatMap((fileBodies) => generate$1(fileBodies, config, debugLogger)),
|
|
6288
6287
|
TE__namespace.map(() => "\u2714\uFE0F Documentation generated successfully!"),
|
|
6289
6288
|
TE__namespace.mapLeft((err) => {
|
|
6290
|
-
|
|
6289
|
+
errorCollector.addGlobalFailure("other", "Markdown generation completed with errors.", err);
|
|
6291
6290
|
if (logger.isDebugEnabled()) {
|
|
6292
|
-
logger.debug(`markdown generator finished with
|
|
6291
|
+
logger.debug(`markdown generator finished with errors (see collector for details)`);
|
|
6293
6292
|
}
|
|
6294
|
-
return
|
|
6293
|
+
return toErrors(err);
|
|
6295
6294
|
})
|
|
6296
6295
|
);
|
|
6297
6296
|
});
|
|
6298
6297
|
}
|
|
6299
|
-
function processOpenApi(config, logger) {
|
|
6298
|
+
function processOpenApi(config, logger, errorCollector) {
|
|
6300
6299
|
return __async(this, null, function* () {
|
|
6301
6300
|
return _function.pipe(
|
|
6302
6301
|
resolveAndValidateSourceDirectories(config),
|
|
6303
|
-
E__namespace.mapLeft((error) =>
|
|
6302
|
+
E__namespace.mapLeft((error) => {
|
|
6303
|
+
errorCollector.addGlobalFailure("read", `Failed to resolve source directories: ${error.message}`, error);
|
|
6304
|
+
return new FileReadingError(`Failed to resolve source directories: ${error.message}`, error);
|
|
6305
|
+
}),
|
|
6304
6306
|
TE__namespace.fromEither,
|
|
6305
6307
|
TE__namespace.flatMap(
|
|
6306
6308
|
(sourceDirs) => TE__namespace.tryCatch(
|
|
@@ -6309,15 +6311,18 @@ function processOpenApi(config, logger) {
|
|
|
6309
6311
|
sourceDirs,
|
|
6310
6312
|
config.exclude
|
|
6311
6313
|
);
|
|
6312
|
-
return openApi(logger, fileBodies, config);
|
|
6314
|
+
return openApi(logger, fileBodies, config, errorCollector);
|
|
6313
6315
|
},
|
|
6314
|
-
(e) =>
|
|
6316
|
+
(e) => {
|
|
6317
|
+
errorCollector.addGlobalFailure("other", "An error occurred while generating OpenAPI documentation.", e);
|
|
6318
|
+
return new FileReadingError("An error occurred while generating OpenAPI documentation.", e);
|
|
6319
|
+
}
|
|
6315
6320
|
)
|
|
6316
6321
|
)
|
|
6317
6322
|
);
|
|
6318
6323
|
});
|
|
6319
6324
|
}
|
|
6320
|
-
function processChangeLog(config, logger, reflectionDebugLogger) {
|
|
6325
|
+
function processChangeLog(config, logger, reflectionDebugLogger, errorCollector) {
|
|
6321
6326
|
return __async(this, null, function* () {
|
|
6322
6327
|
function loadFiles() {
|
|
6323
6328
|
const previousVersionConfig = {
|
|
@@ -6332,24 +6337,47 @@ function processChangeLog(config, logger, reflectionDebugLogger) {
|
|
|
6332
6337
|
"previousVersionDirs",
|
|
6333
6338
|
() => _function.pipe(
|
|
6334
6339
|
resolveAndValidateSourceDirectories(previousVersionConfig),
|
|
6335
|
-
E__namespace.mapLeft(
|
|
6336
|
-
(
|
|
6337
|
-
|
|
6340
|
+
E__namespace.mapLeft((error) => {
|
|
6341
|
+
errorCollector.addGlobalFailure(
|
|
6342
|
+
"read",
|
|
6343
|
+
`Failed to resolve previous version source directories: ${error.message}`,
|
|
6344
|
+
error
|
|
6345
|
+
);
|
|
6346
|
+
return new FileReadingError(
|
|
6347
|
+
`Failed to resolve previous version source directories: ${error.message}`,
|
|
6348
|
+
error
|
|
6349
|
+
);
|
|
6350
|
+
})
|
|
6338
6351
|
)
|
|
6339
6352
|
),
|
|
6340
6353
|
E__namespace.bind(
|
|
6341
6354
|
"currentVersionDirs",
|
|
6342
6355
|
() => _function.pipe(
|
|
6343
6356
|
resolveAndValidateSourceDirectories(currentVersionConfig),
|
|
6344
|
-
E__namespace.mapLeft(
|
|
6345
|
-
(
|
|
6346
|
-
|
|
6357
|
+
E__namespace.mapLeft((error) => {
|
|
6358
|
+
errorCollector.addGlobalFailure(
|
|
6359
|
+
"read",
|
|
6360
|
+
`Failed to resolve current version source directories: ${error.message}`,
|
|
6361
|
+
error
|
|
6362
|
+
);
|
|
6363
|
+
return new FileReadingError(
|
|
6364
|
+
`Failed to resolve current version source directories: ${error.message}`,
|
|
6365
|
+
error
|
|
6366
|
+
);
|
|
6367
|
+
})
|
|
6347
6368
|
)
|
|
6348
6369
|
),
|
|
6349
|
-
E__namespace.map(({ previousVersionDirs, currentVersionDirs }) =>
|
|
6350
|
-
readFiles({ experimentalLwcSupport: false })(allComponentTypes)(
|
|
6351
|
-
|
|
6352
|
-
|
|
6370
|
+
E__namespace.map(({ previousVersionDirs, currentVersionDirs }) => {
|
|
6371
|
+
const previous = readFiles({ experimentalLwcSupport: false })(allComponentTypes)(
|
|
6372
|
+
previousVersionDirs,
|
|
6373
|
+
config.exclude
|
|
6374
|
+
);
|
|
6375
|
+
const current = readFiles({ experimentalLwcSupport: false })(allComponentTypes)(
|
|
6376
|
+
currentVersionDirs,
|
|
6377
|
+
config.exclude
|
|
6378
|
+
);
|
|
6379
|
+
return [previous, current];
|
|
6380
|
+
})
|
|
6353
6381
|
);
|
|
6354
6382
|
}
|
|
6355
6383
|
return _function.pipe(
|
|
@@ -6357,11 +6385,11 @@ function processChangeLog(config, logger, reflectionDebugLogger) {
|
|
|
6357
6385
|
TE__namespace.fromEither,
|
|
6358
6386
|
TE__namespace.flatMap(([previous, current]) => generate(previous, current, config, reflectionDebugLogger)),
|
|
6359
6387
|
TE__namespace.mapLeft((err) => {
|
|
6360
|
-
|
|
6388
|
+
errorCollector.addGlobalFailure("other", "Changelog generation completed with errors.", err);
|
|
6361
6389
|
if (logger.isDebugEnabled()) {
|
|
6362
|
-
logger.debug(`changelog generator finished with
|
|
6390
|
+
logger.debug(`changelog generator finished with errors (see collector for details)`);
|
|
6363
6391
|
}
|
|
6364
|
-
return
|
|
6392
|
+
return toErrors(err);
|
|
6365
6393
|
})
|
|
6366
6394
|
);
|
|
6367
6395
|
});
|
|
@@ -6452,7 +6480,98 @@ class NoLogger {
|
|
|
6452
6480
|
}
|
|
6453
6481
|
}
|
|
6454
6482
|
|
|
6483
|
+
var __defProp = Object.defineProperty;
|
|
6484
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6485
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6486
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6487
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6488
|
+
var __spreadValues = (a, b) => {
|
|
6489
|
+
for (var prop in b || (b = {}))
|
|
6490
|
+
if (__hasOwnProp.call(b, prop))
|
|
6491
|
+
__defNormalProp(a, prop, b[prop]);
|
|
6492
|
+
if (__getOwnPropSymbols)
|
|
6493
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
6494
|
+
if (__propIsEnum.call(b, prop))
|
|
6495
|
+
__defNormalProp(a, prop, b[prop]);
|
|
6496
|
+
}
|
|
6497
|
+
return a;
|
|
6498
|
+
};
|
|
6499
|
+
class ErrorCollector {
|
|
6500
|
+
constructor(generator) {
|
|
6501
|
+
this.items = [];
|
|
6502
|
+
// Basic de-dupe to avoid double-recording the same failure if the same layer reports it twice.
|
|
6503
|
+
// Keyed by generator|stage|filePath|message.
|
|
6504
|
+
this.seen = /* @__PURE__ */ new Set();
|
|
6505
|
+
this.generator = generator;
|
|
6506
|
+
}
|
|
6507
|
+
add(item) {
|
|
6508
|
+
var _a, _b, _c;
|
|
6509
|
+
const fullItem = __spreadValues({
|
|
6510
|
+
generator: this.generator,
|
|
6511
|
+
at: (_a = item.at) != null ? _a : (/* @__PURE__ */ new Date()).toISOString()
|
|
6512
|
+
}, item);
|
|
6513
|
+
const key = [
|
|
6514
|
+
fullItem.generator,
|
|
6515
|
+
fullItem.stage,
|
|
6516
|
+
(_b = fullItem.filePath) != null ? _b : "",
|
|
6517
|
+
// Normalize whitespace a bit so trivial formatting differences don't explode the log.
|
|
6518
|
+
((_c = fullItem.message) != null ? _c : "").trim().replace(/\s+/g, " ")
|
|
6519
|
+
].join("|");
|
|
6520
|
+
if (this.seen.has(key)) {
|
|
6521
|
+
return;
|
|
6522
|
+
}
|
|
6523
|
+
this.seen.add(key);
|
|
6524
|
+
this.items.push(fullItem);
|
|
6525
|
+
}
|
|
6526
|
+
addFailure(stage, filePath, message, raw) {
|
|
6527
|
+
this.add({
|
|
6528
|
+
stage,
|
|
6529
|
+
filePath,
|
|
6530
|
+
message,
|
|
6531
|
+
raw
|
|
6532
|
+
});
|
|
6533
|
+
}
|
|
6534
|
+
addGlobalFailure(stage, message, raw) {
|
|
6535
|
+
this.add({
|
|
6536
|
+
stage,
|
|
6537
|
+
message,
|
|
6538
|
+
raw
|
|
6539
|
+
});
|
|
6540
|
+
}
|
|
6541
|
+
hasErrors() {
|
|
6542
|
+
return this.items.length > 0;
|
|
6543
|
+
}
|
|
6544
|
+
/** Count of collected error items (post de-duplication). */
|
|
6545
|
+
count() {
|
|
6546
|
+
return this.items.length;
|
|
6547
|
+
}
|
|
6548
|
+
all() {
|
|
6549
|
+
return this.items;
|
|
6550
|
+
}
|
|
6551
|
+
/**
|
|
6552
|
+
* Groups error items by file path. Items with no file path are grouped under `__global__`.
|
|
6553
|
+
*/
|
|
6554
|
+
groupByFilePath() {
|
|
6555
|
+
return this.items.reduce((acc, item) => {
|
|
6556
|
+
var _a, _b;
|
|
6557
|
+
const key = (_a = item.filePath) != null ? _a : "__global__";
|
|
6558
|
+
acc[key] = (_b = acc[key]) != null ? _b : [];
|
|
6559
|
+
acc[key].push(item);
|
|
6560
|
+
return acc;
|
|
6561
|
+
}, {});
|
|
6562
|
+
}
|
|
6563
|
+
/**
|
|
6564
|
+
* A compact human-readable representation of the error item.
|
|
6565
|
+
* Useful for CLI output.
|
|
6566
|
+
*/
|
|
6567
|
+
static format(item) {
|
|
6568
|
+
const location = item.filePath ? `${item.filePath}` : "(no file)";
|
|
6569
|
+
return `[${item.generator}/${item.stage}] ${location}: ${item.message}`;
|
|
6570
|
+
}
|
|
6571
|
+
}
|
|
6572
|
+
|
|
6455
6573
|
exports.Apexdocs = Apexdocs;
|
|
6574
|
+
exports.ErrorCollector = ErrorCollector;
|
|
6456
6575
|
exports.NoLogger = NoLogger;
|
|
6457
6576
|
exports.StdOutLogger = StdOutLogger;
|
|
6458
6577
|
exports.changeLogDefaults = changeLogDefaults;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var errorCollector = require('./error-collector-8w5-IHGX.js');
|
|
5
5
|
var E = require('fp-ts/Either');
|
|
6
6
|
require('fp-ts/function');
|
|
7
7
|
require('fp-ts/TaskEither');
|
|
@@ -82,15 +82,26 @@ var __async = (__this, __arguments, generator) => {
|
|
|
82
82
|
};
|
|
83
83
|
function process(config) {
|
|
84
84
|
return __async(this, null, function* () {
|
|
85
|
-
const logger
|
|
86
|
-
const reflectionDebugLogger = logger.createReflectionDebugLogger(logger$1);
|
|
85
|
+
const logger = new errorCollector.NoLogger();
|
|
87
86
|
const configWithDefaults = __spreadValues$1(__spreadValues$1({}, getDefault(config)), config);
|
|
88
87
|
if (!configWithDefaults.sourceDir) {
|
|
89
88
|
throw new Error("sourceDir is required");
|
|
90
89
|
}
|
|
91
|
-
const
|
|
90
|
+
const errorCollector$1 = new errorCollector.ErrorCollector(configWithDefaults.targetGenerator);
|
|
91
|
+
const reflectionDebugLogger = errorCollector.createReflectionDebugLogger(logger, (filePath, errorMessage) => {
|
|
92
|
+
errorCollector$1.addFailure("other", filePath, errorMessage);
|
|
93
|
+
});
|
|
94
|
+
const result = yield errorCollector.Apexdocs.generate(configWithDefaults, {
|
|
95
|
+
logger,
|
|
96
|
+
reflectionDebugLogger,
|
|
97
|
+
errorCollector: errorCollector$1
|
|
98
|
+
});
|
|
92
99
|
E__namespace.match(
|
|
93
100
|
(errors) => {
|
|
101
|
+
if (errorCollector$1.hasErrors()) {
|
|
102
|
+
const details = errorCollector$1.all().map(errorCollector.ErrorCollector.format).join("\n");
|
|
103
|
+
throw new Error(details);
|
|
104
|
+
}
|
|
94
105
|
throw errors;
|
|
95
106
|
},
|
|
96
107
|
() => {
|
|
@@ -101,11 +112,11 @@ function process(config) {
|
|
|
101
112
|
function getDefault(config) {
|
|
102
113
|
switch (config.targetGenerator) {
|
|
103
114
|
case "markdown":
|
|
104
|
-
return
|
|
115
|
+
return errorCollector.markdownDefaults;
|
|
105
116
|
case "openapi":
|
|
106
|
-
return
|
|
117
|
+
return errorCollector.openApiDefaults;
|
|
107
118
|
case "changelog":
|
|
108
|
-
return
|
|
119
|
+
return errorCollector.changeLogDefaults;
|
|
109
120
|
default:
|
|
110
121
|
throw new Error("Unknown target generator");
|
|
111
122
|
}
|
|
@@ -131,23 +142,23 @@ var __spreadValues = (a, b) => {
|
|
|
131
142
|
};
|
|
132
143
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
133
144
|
function defineMarkdownConfig(config) {
|
|
134
|
-
return __spreadProps(__spreadValues(__spreadValues({},
|
|
145
|
+
return __spreadProps(__spreadValues(__spreadValues({}, errorCollector.markdownDefaults), config), {
|
|
135
146
|
targetGenerator: "markdown"
|
|
136
147
|
});
|
|
137
148
|
}
|
|
138
149
|
function defineOpenApiConfig(config) {
|
|
139
|
-
return __spreadProps(__spreadValues(__spreadValues({},
|
|
150
|
+
return __spreadProps(__spreadValues(__spreadValues({}, errorCollector.openApiDefaults), config), {
|
|
140
151
|
targetGenerator: "openapi"
|
|
141
152
|
});
|
|
142
153
|
}
|
|
143
154
|
function defineChangelogConfig(config) {
|
|
144
|
-
return __spreadProps(__spreadValues(__spreadValues({},
|
|
155
|
+
return __spreadProps(__spreadValues(__spreadValues({}, errorCollector.changeLogDefaults), config), {
|
|
145
156
|
targetGenerator: "changelog"
|
|
146
157
|
});
|
|
147
158
|
}
|
|
148
159
|
|
|
149
|
-
exports.skip =
|
|
150
|
-
exports.templateHelpers =
|
|
160
|
+
exports.skip = errorCollector.skip;
|
|
161
|
+
exports.templateHelpers = errorCollector.templateHelpers;
|
|
151
162
|
exports.defineChangelogConfig = defineChangelogConfig;
|
|
152
163
|
exports.defineMarkdownConfig = defineMarkdownConfig;
|
|
153
164
|
exports.defineOpenApiConfig = defineOpenApiConfig;
|