@cparra/apexdocs 3.15.1 → 3.16.0-beta.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 +10 -0
- package/dist/cli/generate.js +1 -1
- package/dist/index.d.ts +266 -2
- package/dist/index.js +2 -1
- package/dist/{logger-BPNUptnX.js → logger-Cq4E5XXO.js} +249 -172
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -575,6 +575,16 @@ public class MyClass {
|
|
|
575
575
|
}
|
|
576
576
|
```
|
|
577
577
|
|
|
578
|
+
##### **templates**
|
|
579
|
+
|
|
580
|
+
Allows providing custom templates for generating Markdown documentation, giving you control over the output format.
|
|
581
|
+
You can define templates for each type of metadata
|
|
582
|
+
supported by the `markdown` command (class, interface, enum, trigger, LWC, custom object, and reference guide) .
|
|
583
|
+
|
|
584
|
+
For detailed information about creating custom templates, including examples, available helpers, and configuration options,
|
|
585
|
+
please refer to the [wiki documentation](https://github.com/cesarParra/apexdocs/wiki/5.-Custom-Templates). You can also find a working example in the
|
|
586
|
+
`examples/markdown-custom-templates` directory.
|
|
587
|
+
|
|
578
588
|
#### Changelog Hooks
|
|
579
589
|
|
|
580
590
|
##### **transformChangeLogPage**
|
package/dist/cli/generate.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -141,6 +141,225 @@ type DeepPartial<T> = {
|
|
|
141
141
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
+
// Apex Reflection-based types
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
// Renderable types
|
|
148
|
+
|
|
149
|
+
type ReferenceGuideReference = {
|
|
150
|
+
reference: DocPageReference;
|
|
151
|
+
title: Link;
|
|
152
|
+
description: RenderableContent[] | null;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
type Link = {
|
|
156
|
+
readonly __type: 'link';
|
|
157
|
+
title: string;
|
|
158
|
+
url: string;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
type EmptyLine = {
|
|
162
|
+
__type: 'empty-line';
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
type StringOrLink = string | Link;
|
|
166
|
+
|
|
167
|
+
type RenderableContent = StringOrLink | EmptyLine | CodeBlock | InlineCode;
|
|
168
|
+
|
|
169
|
+
type EnumValue = {
|
|
170
|
+
value: string;
|
|
171
|
+
description?: RenderableContent[];
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
type CustomTag = {
|
|
175
|
+
name: string;
|
|
176
|
+
description?: RenderableContent[];
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Represents an annotation to a top-level type. For example, @NamespaceAccessible.
|
|
181
|
+
*/
|
|
182
|
+
type Annotation = string;
|
|
183
|
+
|
|
184
|
+
type CodeBlock = {
|
|
185
|
+
readonly __type: 'code-block';
|
|
186
|
+
language: string;
|
|
187
|
+
content: string[];
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
type InlineCode = {
|
|
191
|
+
readonly __type: 'inline-code';
|
|
192
|
+
content: string;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
type RenderableDocumentation = {
|
|
196
|
+
annotations?: Annotation[];
|
|
197
|
+
description?: RenderableContent[];
|
|
198
|
+
customTags?: CustomTag[];
|
|
199
|
+
example?: RenderableSection<RenderableContent[] | undefined>;
|
|
200
|
+
group?: string;
|
|
201
|
+
author?: string;
|
|
202
|
+
date?: string;
|
|
203
|
+
sees?: StringOrLink[];
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
type RenderableType = {
|
|
207
|
+
namespace?: string;
|
|
208
|
+
headingLevel: number;
|
|
209
|
+
heading: string;
|
|
210
|
+
name: string;
|
|
211
|
+
meta: {
|
|
212
|
+
accessModifier: string;
|
|
213
|
+
};
|
|
214
|
+
doc: RenderableDocumentation;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
type RenderableMethodParameter = {
|
|
218
|
+
name: string;
|
|
219
|
+
type: StringOrLink;
|
|
220
|
+
description?: RenderableContent[];
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
type TypeSource = {
|
|
224
|
+
type: StringOrLink;
|
|
225
|
+
description?: RenderableContent[];
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
type RenderableConstructor = {
|
|
229
|
+
headingLevel: number;
|
|
230
|
+
heading: string;
|
|
231
|
+
signature: RenderableSection<CodeBlock>;
|
|
232
|
+
parameters?: RenderableSection<RenderableMethodParameter[] | undefined>;
|
|
233
|
+
throws?: RenderableSection<TypeSource[] | undefined>;
|
|
234
|
+
doc: RenderableDocumentation;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
type RenderableMethod = {
|
|
238
|
+
doc: RenderableDocumentation;
|
|
239
|
+
headingLevel: number;
|
|
240
|
+
heading: string;
|
|
241
|
+
signature: RenderableSection<CodeBlock>;
|
|
242
|
+
parameters: RenderableSection<RenderableMethodParameter[] | undefined>;
|
|
243
|
+
returnType: RenderableSection<TypeSource>;
|
|
244
|
+
throws: RenderableSection<TypeSource[] | undefined>;
|
|
245
|
+
inherited?: boolean;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
type RenderableApexField = {
|
|
249
|
+
headingLevel: number;
|
|
250
|
+
heading: string;
|
|
251
|
+
type: RenderableSection<StringOrLink>;
|
|
252
|
+
accessModifier: string;
|
|
253
|
+
inherited?: boolean;
|
|
254
|
+
signature: RenderableSection<CodeBlock>;
|
|
255
|
+
doc: RenderableDocumentation;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
type RenderableSection<T> = {
|
|
259
|
+
headingLevel: number;
|
|
260
|
+
heading: string;
|
|
261
|
+
value: T;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
type GroupedMember<T> = RenderableSection<T[]> & { groupDescription: string | undefined };
|
|
265
|
+
|
|
266
|
+
type RenderableClass = RenderableType & {
|
|
267
|
+
type: 'class';
|
|
268
|
+
extends?: StringOrLink[];
|
|
269
|
+
implements?: StringOrLink[];
|
|
270
|
+
classModifier?: string;
|
|
271
|
+
sharingModifier?: string;
|
|
272
|
+
constructors: RenderableSection<RenderableConstructor[] | GroupedMember<RenderableConstructor>[]> & {
|
|
273
|
+
isGrouped: boolean;
|
|
274
|
+
};
|
|
275
|
+
methods: RenderableSection<RenderableMethod[] | GroupedMember<RenderableMethod>[]> & { isGrouped: boolean };
|
|
276
|
+
fields: RenderableSection<RenderableApexField[] | GroupedMember<RenderableApexField>[]> & { isGrouped: boolean };
|
|
277
|
+
properties: RenderableSection<RenderableApexField[] | GroupedMember<RenderableApexField>[]> & { isGrouped: boolean };
|
|
278
|
+
innerClasses: RenderableSection<RenderableClass[]>;
|
|
279
|
+
innerEnums: RenderableSection<RenderableEnum[]>;
|
|
280
|
+
innerInterfaces: RenderableSection<RenderableInterface[]>;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
type RenderableInterface = RenderableType & {
|
|
284
|
+
type: 'interface';
|
|
285
|
+
extends?: StringOrLink[];
|
|
286
|
+
methods: RenderableSection<RenderableMethod[]>;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
type RenderableEnum = RenderableType & {
|
|
290
|
+
type: 'enum';
|
|
291
|
+
values: RenderableSection<EnumValue[]>;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
type RenderableTrigger = Omit<RenderableType, 'meta'> & {
|
|
295
|
+
type: 'trigger';
|
|
296
|
+
objectName: string;
|
|
297
|
+
events: string[];
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
type RenderableLwc = Omit<RenderableType, 'meta'> & {
|
|
301
|
+
type: 'lwc';
|
|
302
|
+
exposed: boolean;
|
|
303
|
+
description: string | undefined;
|
|
304
|
+
targets: RenderableSection<string[]>;
|
|
305
|
+
targetConfigs: RenderableSection<TargetConfigRenderable[]>;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
type TargetConfigRenderable = {
|
|
309
|
+
targetName: string;
|
|
310
|
+
properties: {
|
|
311
|
+
type: string;
|
|
312
|
+
required: boolean;
|
|
313
|
+
description: string | undefined;
|
|
314
|
+
label: string;
|
|
315
|
+
name: string;
|
|
316
|
+
}[];
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
type RenderableCustomObject = Omit<RenderableType, 'meta'> & {
|
|
320
|
+
apiName: string;
|
|
321
|
+
type: 'customobject';
|
|
322
|
+
hasFields: boolean;
|
|
323
|
+
hasRecords: boolean;
|
|
324
|
+
fields: RenderableSection<RenderableCustomField[]>;
|
|
325
|
+
metadataRecords: RenderableSection<RenderableCustomMetadata[]>;
|
|
326
|
+
publishBehavior: string | null;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
type RenderableCustomField = {
|
|
330
|
+
headingLevel: number;
|
|
331
|
+
heading: string;
|
|
332
|
+
apiName: string;
|
|
333
|
+
description: RenderableContent[];
|
|
334
|
+
pickListValues?: RenderableSection<string[]>;
|
|
335
|
+
type: 'field';
|
|
336
|
+
fieldType?: string | null;
|
|
337
|
+
required: boolean;
|
|
338
|
+
complianceGroup: string | null;
|
|
339
|
+
securityClassification: string | null;
|
|
340
|
+
inlineHelpText: string | null;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
type RenderableCustomMetadata = {
|
|
344
|
+
headingLevel: number;
|
|
345
|
+
heading: string;
|
|
346
|
+
apiName: string;
|
|
347
|
+
type: 'metadata';
|
|
348
|
+
label: string;
|
|
349
|
+
protected: boolean;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
type Renderable = (
|
|
353
|
+
| RenderableClass
|
|
354
|
+
| RenderableInterface
|
|
355
|
+
| RenderableEnum
|
|
356
|
+
| RenderableCustomObject
|
|
357
|
+
| RenderableTrigger
|
|
358
|
+
| RenderableLwc
|
|
359
|
+
) & {
|
|
360
|
+
filePath: string | undefined;
|
|
361
|
+
};
|
|
362
|
+
|
|
144
363
|
type Generators = 'markdown' | 'openapi' | 'changelog';
|
|
145
364
|
|
|
146
365
|
type LinkingStrategy =
|
|
@@ -317,6 +536,45 @@ type Skip = {
|
|
|
317
536
|
|
|
318
537
|
// CONFIGURABLE HOOKS
|
|
319
538
|
|
|
539
|
+
/**
|
|
540
|
+
* Template configuration for customizing markdown output.
|
|
541
|
+
*/
|
|
542
|
+
type TemplateConfig = {
|
|
543
|
+
class?: string | ((renderable: RenderableClass, helpers: TemplateHelpers) => string);
|
|
544
|
+
interface?: string | ((renderable: RenderableInterface, helpers: TemplateHelpers) => string);
|
|
545
|
+
enum?: string | ((renderable: RenderableEnum, helpers: TemplateHelpers) => string);
|
|
546
|
+
trigger?: string | ((renderable: RenderableTrigger, helpers: TemplateHelpers) => string);
|
|
547
|
+
lwc?: string | ((renderable: RenderableLwc, helpers: TemplateHelpers) => string);
|
|
548
|
+
customObject?: string | ((renderable: RenderableCustomObject, helpers: TemplateHelpers) => string);
|
|
549
|
+
referenceGuide?: string | ((data: ReferenceGuideData, helpers: TemplateHelpers) => string);
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Template helpers for consistent rendering.
|
|
554
|
+
*/
|
|
555
|
+
type TemplateHelpers = {
|
|
556
|
+
link: (source: StringOrLink) => string;
|
|
557
|
+
code: (codeBlock: CodeBlock) => string;
|
|
558
|
+
renderContent: (content?: RenderableContent[]) => string;
|
|
559
|
+
heading: (level: number, text: string) => string;
|
|
560
|
+
inlineCode: (text: string) => string;
|
|
561
|
+
eq: (a: unknown, b: unknown) => boolean;
|
|
562
|
+
add: (a: number, b: number) => number;
|
|
563
|
+
lookup: (array: unknown[], index: number) => unknown;
|
|
564
|
+
parseJSON: (jsonString: string) => unknown | null;
|
|
565
|
+
startsWith: (str: string, prefix: string) => boolean;
|
|
566
|
+
substring: (str: string, start: number, length?: number) => string;
|
|
567
|
+
splitAndCapitalize: (text: string) => string;
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Data structure passed to reference guide template functions.
|
|
572
|
+
*/
|
|
573
|
+
type ReferenceGuideData = {
|
|
574
|
+
referenceGuideTitle: string;
|
|
575
|
+
references: Record<string, ReferenceGuideReference[]>;
|
|
576
|
+
};
|
|
577
|
+
|
|
320
578
|
/**
|
|
321
579
|
* The configurable hooks that can be used to modify the output of the Markdown generator.
|
|
322
580
|
*/
|
|
@@ -326,6 +584,7 @@ type MarkdownConfigurableHooks = {
|
|
|
326
584
|
transformDocs: TransformDocs;
|
|
327
585
|
transformDocPage: TransformDocPage;
|
|
328
586
|
transformReference: TransformReference;
|
|
587
|
+
templates?: TemplateConfig;
|
|
329
588
|
};
|
|
330
589
|
|
|
331
590
|
type ConfigurableDocPageReference = Omit<DocPageReference, 'source'>;
|
|
@@ -373,6 +632,11 @@ type TransformChangelogPage = (
|
|
|
373
632
|
*/
|
|
374
633
|
declare function skip(): Skip;
|
|
375
634
|
|
|
635
|
+
/**
|
|
636
|
+
* Get all template helpers as an object matching TemplateHelpers type.
|
|
637
|
+
*/
|
|
638
|
+
declare const templateHelpers: TemplateHelpers;
|
|
639
|
+
|
|
376
640
|
type CallableConfig = Partial<UserDefinedConfig> & {
|
|
377
641
|
sourceDir: string;
|
|
378
642
|
targetGenerator: Generators;
|
|
@@ -402,5 +666,5 @@ type ConfigurableChangelogConfig = Omit<Partial<UserDefinedChangelogConfig>, 'ta
|
|
|
402
666
|
*/
|
|
403
667
|
declare function defineChangelogConfig(config: ConfigurableChangelogConfig): Partial<UserDefinedChangelogConfig>;
|
|
404
668
|
|
|
405
|
-
export { defineChangelogConfig, defineMarkdownConfig, defineOpenApiConfig, process, skip };
|
|
406
|
-
export type { ChangeLogPageData, ChangelogConfigurableHooks, ConfigurableChangelogConfig, ConfigurableDocPageData, ConfigurableDocPageReference, ConfigurableMarkdownConfig, ConfigurableOpenApiConfig, DocPageData, DocPageReference, MacroFunction, MacroSourceMetadata, MarkdownConfigurableHooks, ReferenceGuidePageData, Skip, SourceChangelog, TransformChangelogPage, TransformDocPage, TransformDocs, TransformReference, TransformReferenceGuide, Translations, UserTranslations };
|
|
669
|
+
export { defineChangelogConfig, defineMarkdownConfig, defineOpenApiConfig, process, skip, templateHelpers };
|
|
670
|
+
export type { ChangeLogPageData, ChangelogConfigurableHooks, CodeBlock, ConfigurableChangelogConfig, ConfigurableDocPageData, ConfigurableDocPageReference, ConfigurableMarkdownConfig, ConfigurableOpenApiConfig, DocPageData, DocPageReference, GroupedMember, Link, MacroFunction, MacroSourceMetadata, MarkdownConfigurableHooks, ReferenceGuideData, ReferenceGuidePageData, ReferenceGuideReference, Renderable, RenderableApexField, RenderableClass, RenderableConstructor, RenderableContent, RenderableCustomObject, RenderableEnum, RenderableInterface, RenderableLwc, RenderableMethod, RenderableMethodParameter, RenderableSection, RenderableTrigger, Skip, SourceChangelog, StringOrLink, TemplateConfig, TemplateHelpers, TransformChangelogPage, TransformDocPage, TransformDocs, TransformReference, TransformReferenceGuide, Translations, TypeSource, UserTranslations };
|
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-
|
|
4
|
+
var logger = require('./logger-Cq4E5XXO.js');
|
|
5
5
|
var E = require('fp-ts/Either');
|
|
6
6
|
require('fp-ts/function');
|
|
7
7
|
require('fp-ts/TaskEither');
|
|
@@ -142,6 +142,7 @@ function defineChangelogConfig(config) {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
exports.skip = logger.skip;
|
|
145
|
+
exports.templateHelpers = logger.templateHelpers;
|
|
145
146
|
exports.defineChangelogConfig = defineChangelogConfig;
|
|
146
147
|
exports.defineMarkdownConfig = defineMarkdownConfig;
|
|
147
148
|
exports.defineOpenApiConfig = defineOpenApiConfig;
|
|
@@ -1674,6 +1674,102 @@ const interfaceMarkdownTemplate = `
|
|
|
1674
1674
|
{{/if}}
|
|
1675
1675
|
`.trim();
|
|
1676
1676
|
|
|
1677
|
+
function link(source) {
|
|
1678
|
+
if (typeof source === "string") {
|
|
1679
|
+
return source;
|
|
1680
|
+
} else {
|
|
1681
|
+
return `[${source.title}](${source.url})`;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
function code(codeBlock) {
|
|
1685
|
+
return `
|
|
1686
|
+
\`\`\`${codeBlock.language}
|
|
1687
|
+
${codeBlock.content.join("\n")}
|
|
1688
|
+
\`\`\`
|
|
1689
|
+
`.trim();
|
|
1690
|
+
}
|
|
1691
|
+
function inlineCodeToString(inlineCode2) {
|
|
1692
|
+
return `\`${inlineCode2.content}\``;
|
|
1693
|
+
}
|
|
1694
|
+
function renderContent(content, escapeFunction) {
|
|
1695
|
+
if (!content || content.length === 0) {
|
|
1696
|
+
return "";
|
|
1697
|
+
}
|
|
1698
|
+
function reduceDescription(acc, curr) {
|
|
1699
|
+
if (isEmptyLine(curr)) {
|
|
1700
|
+
return acc + "\n";
|
|
1701
|
+
}
|
|
1702
|
+
if (isCodeBlock(curr)) {
|
|
1703
|
+
return acc + code(curr) + "\n";
|
|
1704
|
+
}
|
|
1705
|
+
if (isInlineCode(curr)) {
|
|
1706
|
+
return acc + inlineCodeToString(curr) + " ";
|
|
1707
|
+
} else {
|
|
1708
|
+
const linkResult = link(curr);
|
|
1709
|
+
const escapedLink = escapeFunction ? escapeFunction(linkResult) : linkResult;
|
|
1710
|
+
return acc + escapedLink.trim() + " ";
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
return content.reduce(reduceDescription, "").trim();
|
|
1714
|
+
}
|
|
1715
|
+
function heading(level, text) {
|
|
1716
|
+
if (level < 1 || level > 6) {
|
|
1717
|
+
throw new Error(`Heading level must be between 1 and 6, got ${level}`);
|
|
1718
|
+
}
|
|
1719
|
+
return `${"#".repeat(level)} ${text}`;
|
|
1720
|
+
}
|
|
1721
|
+
function inlineCode(text) {
|
|
1722
|
+
return `\`${text}\``;
|
|
1723
|
+
}
|
|
1724
|
+
function eq(a, b) {
|
|
1725
|
+
return a === b;
|
|
1726
|
+
}
|
|
1727
|
+
function add(a, b) {
|
|
1728
|
+
return a + b;
|
|
1729
|
+
}
|
|
1730
|
+
function lookup(array, index) {
|
|
1731
|
+
return array[index];
|
|
1732
|
+
}
|
|
1733
|
+
function parseJSON(jsonString) {
|
|
1734
|
+
try {
|
|
1735
|
+
return JSON.parse(jsonString);
|
|
1736
|
+
} catch (e) {
|
|
1737
|
+
return null;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
function startsWith(str, prefix) {
|
|
1741
|
+
return str.startsWith(prefix);
|
|
1742
|
+
}
|
|
1743
|
+
function substring(str, start, length) {
|
|
1744
|
+
if (length !== void 0) {
|
|
1745
|
+
return str.substring(start, start + length);
|
|
1746
|
+
}
|
|
1747
|
+
return str.substring(start);
|
|
1748
|
+
}
|
|
1749
|
+
function splitAndCapitalize(text) {
|
|
1750
|
+
const words = text.split(/[-_]+/);
|
|
1751
|
+
const capitalizedWords = [];
|
|
1752
|
+
for (const word of words) {
|
|
1753
|
+
capitalizedWords.push(word.charAt(0).toUpperCase() + word.slice(1));
|
|
1754
|
+
}
|
|
1755
|
+
return capitalizedWords.join(" ");
|
|
1756
|
+
}
|
|
1757
|
+
const templateHelpers = {
|
|
1758
|
+
link,
|
|
1759
|
+
code,
|
|
1760
|
+
renderContent: (content) => renderContent(content),
|
|
1761
|
+
// Wrap to match TemplateHelpers signature
|
|
1762
|
+
heading,
|
|
1763
|
+
inlineCode,
|
|
1764
|
+
eq,
|
|
1765
|
+
add,
|
|
1766
|
+
lookup,
|
|
1767
|
+
parseJSON,
|
|
1768
|
+
startsWith,
|
|
1769
|
+
substring,
|
|
1770
|
+
splitAndCapitalize
|
|
1771
|
+
};
|
|
1772
|
+
|
|
1677
1773
|
class Template {
|
|
1678
1774
|
constructor() {
|
|
1679
1775
|
Handlebars.registerPartial("typeDocumentation", typeDocPartial);
|
|
@@ -1685,11 +1781,19 @@ class Template {
|
|
|
1685
1781
|
Handlebars.registerPartial("classTemplate", classMarkdownTemplate);
|
|
1686
1782
|
Handlebars.registerPartial("enumTemplate", enumMarkdownTemplate);
|
|
1687
1783
|
Handlebars.registerPartial("interfaceTemplate", interfaceMarkdownTemplate);
|
|
1688
|
-
Handlebars.registerHelper("link",
|
|
1689
|
-
|
|
1690
|
-
|
|
1784
|
+
Handlebars.registerHelper("link", (source) => {
|
|
1785
|
+
return new Handlebars.SafeString(link(source));
|
|
1786
|
+
});
|
|
1787
|
+
Handlebars.registerHelper("code", (codeBlock) => {
|
|
1788
|
+
return new Handlebars.SafeString(code(codeBlock));
|
|
1789
|
+
});
|
|
1790
|
+
Handlebars.registerHelper("renderContent", (content) => {
|
|
1791
|
+
return renderContent(content, Handlebars.escapeExpression);
|
|
1792
|
+
});
|
|
1691
1793
|
Handlebars.registerHelper("heading", heading);
|
|
1692
|
-
Handlebars.registerHelper("inlineCode",
|
|
1794
|
+
Handlebars.registerHelper("inlineCode", (text) => {
|
|
1795
|
+
return new Handlebars.SafeString(inlineCode(text));
|
|
1796
|
+
});
|
|
1693
1797
|
Handlebars.registerHelper("splitAndCapitalize", splitAndCapitalize);
|
|
1694
1798
|
Handlebars.registerHelper("eq", eq);
|
|
1695
1799
|
Handlebars.registerHelper("add", add);
|
|
@@ -1709,80 +1813,6 @@ class Template {
|
|
|
1709
1813
|
return compiled(request.source).trim().replace(/\n{3,}/g, "\n\n");
|
|
1710
1814
|
}
|
|
1711
1815
|
}
|
|
1712
|
-
const splitAndCapitalize = (text) => {
|
|
1713
|
-
const words = text.split(/[-_]+/);
|
|
1714
|
-
const capitalizedWords = [];
|
|
1715
|
-
for (const word of words) {
|
|
1716
|
-
capitalizedWords.push(word.charAt(0).toUpperCase() + word.slice(1));
|
|
1717
|
-
}
|
|
1718
|
-
return capitalizedWords.join(" ");
|
|
1719
|
-
};
|
|
1720
|
-
const heading = (level, text) => {
|
|
1721
|
-
return `${"#".repeat(level)} ${text}`;
|
|
1722
|
-
};
|
|
1723
|
-
const inlineCode = (text) => {
|
|
1724
|
-
return new Handlebars.SafeString(`\`${text}\``);
|
|
1725
|
-
};
|
|
1726
|
-
const eq = (a, b) => {
|
|
1727
|
-
return a === b;
|
|
1728
|
-
};
|
|
1729
|
-
const add = (a, b) => {
|
|
1730
|
-
return a + b;
|
|
1731
|
-
};
|
|
1732
|
-
const lookup = (array, index) => {
|
|
1733
|
-
return array[index];
|
|
1734
|
-
};
|
|
1735
|
-
const parseJSON = (jsonString) => {
|
|
1736
|
-
try {
|
|
1737
|
-
return JSON.parse(jsonString);
|
|
1738
|
-
} catch (e) {
|
|
1739
|
-
return null;
|
|
1740
|
-
}
|
|
1741
|
-
};
|
|
1742
|
-
const startsWith = (str, prefix) => {
|
|
1743
|
-
return str.startsWith(prefix);
|
|
1744
|
-
};
|
|
1745
|
-
const substring = (str, start, length) => {
|
|
1746
|
-
if (length !== void 0) {
|
|
1747
|
-
return str.substring(start, start + length);
|
|
1748
|
-
}
|
|
1749
|
-
return str.substring(start);
|
|
1750
|
-
};
|
|
1751
|
-
const convertCodeBlock = (codeBlock) => {
|
|
1752
|
-
return new Handlebars.SafeString(
|
|
1753
|
-
`
|
|
1754
|
-
\`\`\`${codeBlock.language}
|
|
1755
|
-
${codeBlock.content.join("\n")}
|
|
1756
|
-
\`\`\`
|
|
1757
|
-
`.trim()
|
|
1758
|
-
);
|
|
1759
|
-
};
|
|
1760
|
-
const resolveRenderableContent = (description) => {
|
|
1761
|
-
if (!description) {
|
|
1762
|
-
return "";
|
|
1763
|
-
}
|
|
1764
|
-
function reduceDescription(acc, curr) {
|
|
1765
|
-
if (isEmptyLine(curr)) {
|
|
1766
|
-
return acc + "\n";
|
|
1767
|
-
}
|
|
1768
|
-
if (isCodeBlock(curr)) {
|
|
1769
|
-
return acc + convertCodeBlock(curr) + "\n";
|
|
1770
|
-
}
|
|
1771
|
-
if (isInlineCode(curr)) {
|
|
1772
|
-
return acc + inlineCode(curr.content).toString() + " ";
|
|
1773
|
-
} else {
|
|
1774
|
-
return acc + Handlebars.escapeExpression(link(curr)).trim() + " ";
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
return description.reduce(reduceDescription, "").trim();
|
|
1778
|
-
};
|
|
1779
|
-
const link = (source) => {
|
|
1780
|
-
if (typeof source === "string") {
|
|
1781
|
-
return source;
|
|
1782
|
-
} else {
|
|
1783
|
-
return `[${source.title}](${source.url})`;
|
|
1784
|
-
}
|
|
1785
|
-
};
|
|
1786
1816
|
|
|
1787
1817
|
var __defProp$k = Object.defineProperty;
|
|
1788
1818
|
var __defProps$j = Object.defineProperties;
|
|
@@ -1992,23 +2022,43 @@ var __spreadValues$j = (a, b) => {
|
|
|
1992
2022
|
return a;
|
|
1993
2023
|
};
|
|
1994
2024
|
var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
|
|
1995
|
-
const convertToDocumentationBundle = (referenceGuideTitle, referenceGuideTemplate, translations, { referencesByGroup, renderables }) => ({
|
|
2025
|
+
const convertToDocumentationBundle = (referenceGuideTitle, referenceGuideTemplate, translations, { referencesByGroup, renderables }, templates) => ({
|
|
1996
2026
|
referenceGuide: {
|
|
1997
2027
|
frontmatter: null,
|
|
1998
|
-
content: referencesToReferenceGuideContent(
|
|
2028
|
+
content: referencesToReferenceGuideContent(
|
|
2029
|
+
referenceGuideTitle,
|
|
2030
|
+
referencesByGroup,
|
|
2031
|
+
referenceGuideTemplate,
|
|
2032
|
+
templates
|
|
2033
|
+
),
|
|
1999
2034
|
outputDocPath: "index.md"
|
|
2000
2035
|
},
|
|
2001
2036
|
docs: renderables.map(
|
|
2002
|
-
(renderable) => renderableToPageData(Object.values(referencesByGroup).flat(), renderable, translations)
|
|
2037
|
+
(renderable) => renderableToPageData(Object.values(referencesByGroup).flat(), renderable, translations, templates)
|
|
2003
2038
|
)
|
|
2004
2039
|
});
|
|
2005
|
-
function referencesToReferenceGuideContent(referenceGuideTitle, references, template) {
|
|
2040
|
+
function referencesToReferenceGuideContent(referenceGuideTitle, references, template, templates) {
|
|
2006
2041
|
function alphabetizeReferences(references2) {
|
|
2007
2042
|
return Object.keys(references2).sort((a, b) => a.localeCompare(b)).reduce((acc, key) => {
|
|
2008
2043
|
acc[key] = references2[key].sort((a, b) => a.title.toString().localeCompare(b.title.toString()));
|
|
2009
2044
|
return acc;
|
|
2010
2045
|
}, {});
|
|
2011
2046
|
}
|
|
2047
|
+
const referenceGuideTemplateConfig = templates == null ? void 0 : templates.referenceGuide;
|
|
2048
|
+
if (referenceGuideTemplateConfig) {
|
|
2049
|
+
const alphabetizedReferences = alphabetizeReferences(references);
|
|
2050
|
+
const referenceGuideData = {
|
|
2051
|
+
referenceGuideTitle,
|
|
2052
|
+
references: alphabetizedReferences
|
|
2053
|
+
};
|
|
2054
|
+
const templateRequest = handleTemplateConfig(referenceGuideTemplateConfig, referenceGuideData, templateHelpers);
|
|
2055
|
+
if ("template" in templateRequest) {
|
|
2056
|
+
return compile$1({
|
|
2057
|
+
template: templateRequest.template,
|
|
2058
|
+
source: templateRequest.source
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2012
2062
|
return _function.pipe(
|
|
2013
2063
|
references,
|
|
2014
2064
|
alphabetizeReferences,
|
|
@@ -2018,7 +2068,7 @@ function referencesToReferenceGuideContent(referenceGuideTitle, references, temp
|
|
|
2018
2068
|
})
|
|
2019
2069
|
);
|
|
2020
2070
|
}
|
|
2021
|
-
function renderableToPageData(referenceGuideReference, renderable, translations) {
|
|
2071
|
+
function renderableToPageData(referenceGuideReference, renderable, translations, templates) {
|
|
2022
2072
|
function buildDocOutput(renderable2, docContents) {
|
|
2023
2073
|
var _a;
|
|
2024
2074
|
const reference = referenceGuideReference.find(
|
|
@@ -2039,12 +2089,16 @@ function renderableToPageData(referenceGuideReference, renderable, translations)
|
|
|
2039
2089
|
}
|
|
2040
2090
|
return _function.pipe(
|
|
2041
2091
|
renderable,
|
|
2042
|
-
(r) => resolveTemplate(r, translations),
|
|
2043
|
-
|
|
2092
|
+
(r) => resolveTemplate(r, translations, templates),
|
|
2093
|
+
(templateOrRequest) => compileTemplate(templateOrRequest),
|
|
2044
2094
|
(docContents) => buildDocOutput(renderable, docContents)
|
|
2045
2095
|
);
|
|
2046
2096
|
}
|
|
2047
|
-
function resolveTemplate(renderable, translations) {
|
|
2097
|
+
function resolveTemplate(renderable, translations, templates) {
|
|
2098
|
+
const customTemplate = getCustomTemplate(renderable, templates);
|
|
2099
|
+
if (customTemplate) {
|
|
2100
|
+
return customTemplate;
|
|
2101
|
+
}
|
|
2048
2102
|
function getTemplate(renderable2) {
|
|
2049
2103
|
switch (renderable2.type) {
|
|
2050
2104
|
case "enum":
|
|
@@ -2068,9 +2122,67 @@ function resolveTemplate(renderable, translations) {
|
|
|
2068
2122
|
})
|
|
2069
2123
|
};
|
|
2070
2124
|
}
|
|
2125
|
+
function getCustomTemplate(renderable, templates) {
|
|
2126
|
+
if (!templates) {
|
|
2127
|
+
return null;
|
|
2128
|
+
}
|
|
2129
|
+
switch (renderable.type) {
|
|
2130
|
+
case "enum":
|
|
2131
|
+
if (templates.enum) {
|
|
2132
|
+
return handleTemplateConfig(templates.enum, renderable, templateHelpers);
|
|
2133
|
+
}
|
|
2134
|
+
break;
|
|
2135
|
+
case "interface":
|
|
2136
|
+
if (templates.interface) {
|
|
2137
|
+
return handleTemplateConfig(templates.interface, renderable, templateHelpers);
|
|
2138
|
+
}
|
|
2139
|
+
break;
|
|
2140
|
+
case "class":
|
|
2141
|
+
if (templates.class) {
|
|
2142
|
+
return handleTemplateConfig(templates.class, renderable, templateHelpers);
|
|
2143
|
+
}
|
|
2144
|
+
break;
|
|
2145
|
+
case "customobject":
|
|
2146
|
+
if (templates.customObject) {
|
|
2147
|
+
return handleTemplateConfig(templates.customObject, renderable, templateHelpers);
|
|
2148
|
+
}
|
|
2149
|
+
break;
|
|
2150
|
+
case "trigger":
|
|
2151
|
+
if (templates.trigger) {
|
|
2152
|
+
return handleTemplateConfig(templates.trigger, renderable, templateHelpers);
|
|
2153
|
+
}
|
|
2154
|
+
break;
|
|
2155
|
+
case "lwc":
|
|
2156
|
+
if (templates.lwc) {
|
|
2157
|
+
return handleTemplateConfig(templates.lwc, renderable, templateHelpers);
|
|
2158
|
+
}
|
|
2159
|
+
break;
|
|
2160
|
+
}
|
|
2161
|
+
return null;
|
|
2162
|
+
}
|
|
2163
|
+
function handleTemplateConfig(templateConfig, renderable, helpers) {
|
|
2164
|
+
if (typeof templateConfig === "string") {
|
|
2165
|
+
return {
|
|
2166
|
+
template: templateConfig,
|
|
2167
|
+
source: renderable
|
|
2168
|
+
};
|
|
2169
|
+
} else {
|
|
2170
|
+
const result = templateConfig(renderable, helpers);
|
|
2171
|
+
return {
|
|
2172
|
+
template: "{{{content}}}",
|
|
2173
|
+
source: { content: result }
|
|
2174
|
+
};
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2071
2177
|
function compile$1(request) {
|
|
2072
2178
|
return Template.getInstance().compile(request);
|
|
2073
2179
|
}
|
|
2180
|
+
function compileTemplate(templateOrRequest) {
|
|
2181
|
+
if ("template" in templateOrRequest) {
|
|
2182
|
+
return Template.getInstance().compile(templateOrRequest);
|
|
2183
|
+
}
|
|
2184
|
+
throw new Error("Invalid template request");
|
|
2185
|
+
}
|
|
2074
2186
|
|
|
2075
2187
|
var __defProp$i = Object.defineProperty;
|
|
2076
2188
|
var __defProps$h = Object.defineProperties;
|
|
@@ -3080,11 +3192,12 @@ function generateDocs(unparsedBundles, config) {
|
|
|
3080
3192
|
const translations = mergeTranslations({ markdown: config.translations });
|
|
3081
3193
|
const convertToReferences = apply(parsedFilesToReferenceGuide, config);
|
|
3082
3194
|
const convertToRenderableBundle = apply(parsedFilesToRenderableBundle, config);
|
|
3083
|
-
const convertToDocumentationBundleForTemplate =
|
|
3084
|
-
convertToDocumentationBundle,
|
|
3195
|
+
const convertToDocumentationBundleForTemplate = (bundle, templates) => convertToDocumentationBundle(
|
|
3085
3196
|
config.referenceGuideTitle,
|
|
3086
3197
|
config.referenceGuideTemplate,
|
|
3087
|
-
translations
|
|
3198
|
+
translations,
|
|
3199
|
+
bundle,
|
|
3200
|
+
templates
|
|
3088
3201
|
);
|
|
3089
3202
|
const sort = apply(sortTypesAndMembers, config.sortAlphabetically);
|
|
3090
3203
|
function filterOutCustomFieldsAndMetadata(parsedFiles) {
|
|
@@ -3133,7 +3246,7 @@ function generateDocs(unparsedBundles, config) {
|
|
|
3133
3246
|
TE__namespace.map(
|
|
3134
3247
|
({ parsedFiles, references }) => convertToRenderableBundle(filterOutCustomFieldsAndMetadata(parsedFiles), references, translations)
|
|
3135
3248
|
),
|
|
3136
|
-
TE__namespace.map(convertToDocumentationBundleForTemplate),
|
|
3249
|
+
TE__namespace.map((bundle) => convertToDocumentationBundleForTemplate(bundle, config.templates)),
|
|
3137
3250
|
TE__namespace.flatMap(transformDocumentationBundleHook(config)),
|
|
3138
3251
|
TE__namespace.map(postHookCompile$1)
|
|
3139
3252
|
);
|
|
@@ -5167,19 +5280,18 @@ function getLightningComponentBundleSourceComponents(sourceComponents) {
|
|
|
5167
5280
|
}
|
|
5168
5281
|
function toUnparsedApexBundle(fileSystem, apexSourceComponents) {
|
|
5169
5282
|
return apexSourceComponents.map((component) => {
|
|
5170
|
-
const
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
const metadataContent = component.xmlPath ? fileSystem.readFile(component.xmlPath) : null;
|
|
5283
|
+
const apexComponentTuple = [
|
|
5284
|
+
fileSystem.readFile(component.contentPath),
|
|
5285
|
+
component.xmlPath ? fileSystem.readFile(component.xmlPath) : null
|
|
5286
|
+
];
|
|
5175
5287
|
return {
|
|
5176
5288
|
type: "apex",
|
|
5177
5289
|
name: component.name,
|
|
5178
5290
|
filePath: component.contentPath,
|
|
5179
|
-
content,
|
|
5180
|
-
metadataContent
|
|
5291
|
+
content: apexComponentTuple[0],
|
|
5292
|
+
metadataContent: apexComponentTuple[1]
|
|
5181
5293
|
};
|
|
5182
|
-
})
|
|
5294
|
+
});
|
|
5183
5295
|
}
|
|
5184
5296
|
function getTriggerSourceComponents(sourceComponents) {
|
|
5185
5297
|
return sourceComponents.filter((component) => component.type.name === "ApexTrigger").map((component) => ({
|
|
@@ -5189,18 +5301,12 @@ function getTriggerSourceComponents(sourceComponents) {
|
|
|
5189
5301
|
}));
|
|
5190
5302
|
}
|
|
5191
5303
|
function toUnparsedTriggerBundle(fileSystem, triggerSourceComponents) {
|
|
5192
|
-
return triggerSourceComponents.map((component) => {
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
type: "trigger",
|
|
5199
|
-
name: component.name,
|
|
5200
|
-
filePath: component.contentPath,
|
|
5201
|
-
content
|
|
5202
|
-
};
|
|
5203
|
-
}).filter((bundle) => bundle !== null);
|
|
5304
|
+
return triggerSourceComponents.map((component) => ({
|
|
5305
|
+
type: "trigger",
|
|
5306
|
+
name: component.name,
|
|
5307
|
+
filePath: component.contentPath,
|
|
5308
|
+
content: fileSystem.readFile(component.contentPath)
|
|
5309
|
+
}));
|
|
5204
5310
|
}
|
|
5205
5311
|
function getCustomObjectSourceComponents(sourceComponents) {
|
|
5206
5312
|
return sourceComponents.filter((component) => component.type.name === "CustomObject").map((component) => ({
|
|
@@ -5211,17 +5317,13 @@ function getCustomObjectSourceComponents(sourceComponents) {
|
|
|
5211
5317
|
}
|
|
5212
5318
|
function toUnparsedSObjectBundle(fileSystem, customObjectSourceComponents) {
|
|
5213
5319
|
return customObjectSourceComponents.map((component) => {
|
|
5214
|
-
const content = fileSystem.readFile(component.contentPath);
|
|
5215
|
-
if (content === null) {
|
|
5216
|
-
return null;
|
|
5217
|
-
}
|
|
5218
5320
|
return {
|
|
5219
5321
|
type: "customobject",
|
|
5220
5322
|
name: component.name,
|
|
5221
5323
|
filePath: component.contentPath,
|
|
5222
|
-
content
|
|
5324
|
+
content: fileSystem.readFile(component.contentPath)
|
|
5223
5325
|
};
|
|
5224
|
-
})
|
|
5326
|
+
});
|
|
5225
5327
|
}
|
|
5226
5328
|
function getCustomFieldSourceComponents(sourceComponents) {
|
|
5227
5329
|
return sourceComponents.filter((component) => component.type.name === "CustomField").map((component) => ({
|
|
@@ -5232,19 +5334,13 @@ function getCustomFieldSourceComponents(sourceComponents) {
|
|
|
5232
5334
|
}));
|
|
5233
5335
|
}
|
|
5234
5336
|
function toUnparsedCustomFieldBundle(fileSystem, customFieldSourceComponents) {
|
|
5235
|
-
return customFieldSourceComponents.map((component) => {
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
name: component.name,
|
|
5243
|
-
filePath: component.contentPath,
|
|
5244
|
-
content,
|
|
5245
|
-
parentName: component.parentName
|
|
5246
|
-
};
|
|
5247
|
-
}).filter((bundle) => bundle !== null);
|
|
5337
|
+
return customFieldSourceComponents.map((component) => ({
|
|
5338
|
+
type: "customfield",
|
|
5339
|
+
name: component.name,
|
|
5340
|
+
filePath: component.contentPath,
|
|
5341
|
+
content: fileSystem.readFile(component.contentPath),
|
|
5342
|
+
parentName: component.parentName
|
|
5343
|
+
}));
|
|
5248
5344
|
}
|
|
5249
5345
|
function getCustomMetadataSourceComponents(sourceComponents) {
|
|
5250
5346
|
function getParentAndNamePair(component) {
|
|
@@ -5260,38 +5356,25 @@ function getCustomMetadataSourceComponents(sourceComponents) {
|
|
|
5260
5356
|
}));
|
|
5261
5357
|
}
|
|
5262
5358
|
function toUnparsedCustomMetadataBundle(fileSystem, customMetadataSourceComponents) {
|
|
5263
|
-
return customMetadataSourceComponents.map((component) => {
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
name: component.name,
|
|
5272
|
-
filePath: component.contentPath,
|
|
5273
|
-
content,
|
|
5274
|
-
parentName: component.parentName
|
|
5275
|
-
};
|
|
5276
|
-
}).filter((bundle) => bundle !== null);
|
|
5359
|
+
return customMetadataSourceComponents.map((component) => ({
|
|
5360
|
+
apiName: component.apiName,
|
|
5361
|
+
type: "custommetadata",
|
|
5362
|
+
name: component.name,
|
|
5363
|
+
filePath: component.contentPath,
|
|
5364
|
+
content: fileSystem.readFile(component.contentPath),
|
|
5365
|
+
parentName: component.parentName
|
|
5366
|
+
}));
|
|
5277
5367
|
}
|
|
5278
5368
|
function toUnparsedLWCBundle(fileSystem, lwcSourceComponents) {
|
|
5279
|
-
return lwcSourceComponents.map((component) => {
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
type: "lwc",
|
|
5287
|
-
name: component.name,
|
|
5288
|
-
filePath: component.contentPath,
|
|
5289
|
-
content,
|
|
5290
|
-
metadataContent
|
|
5291
|
-
};
|
|
5292
|
-
}).filter((bundle) => bundle !== null);
|
|
5369
|
+
return lwcSourceComponents.map((component) => ({
|
|
5370
|
+
type: "lwc",
|
|
5371
|
+
name: component.name,
|
|
5372
|
+
filePath: component.contentPath,
|
|
5373
|
+
content: fileSystem.readFile(component.contentPath),
|
|
5374
|
+
metadataContent: fileSystem.readFile(component.xmlPath)
|
|
5375
|
+
}));
|
|
5293
5376
|
}
|
|
5294
|
-
function processFiles(fileSystem
|
|
5377
|
+
function processFiles(fileSystem) {
|
|
5295
5378
|
return (componentTypesToRetrieve, options = { includeMetadata: false }) => {
|
|
5296
5379
|
const converters = {
|
|
5297
5380
|
ApexClass: _function.flow(
|
|
@@ -5315,7 +5398,7 @@ function processFiles(fileSystem, config) {
|
|
|
5315
5398
|
(triggerSourceComponents) => toUnparsedTriggerBundle(fileSystem, triggerSourceComponents)
|
|
5316
5399
|
),
|
|
5317
5400
|
LightningComponentBundle: _function.flow(
|
|
5318
|
-
|
|
5401
|
+
getLightningComponentBundleSourceComponents,
|
|
5319
5402
|
(lwcSourceComponents) => toUnparsedLWCBundle(fileSystem, lwcSourceComponents)
|
|
5320
5403
|
)
|
|
5321
5404
|
};
|
|
@@ -5366,11 +5449,7 @@ class DefaultFileSystem {
|
|
|
5366
5449
|
return [...components, ...fieldComponents];
|
|
5367
5450
|
}
|
|
5368
5451
|
readFile(pathToRead) {
|
|
5369
|
-
|
|
5370
|
-
return fs__namespace.readFileSync(pathToRead, "utf8");
|
|
5371
|
-
} catch (error) {
|
|
5372
|
-
return null;
|
|
5373
|
-
}
|
|
5452
|
+
return fs__namespace.readFileSync(pathToRead, "utf8");
|
|
5374
5453
|
}
|
|
5375
5454
|
}
|
|
5376
5455
|
|
|
@@ -5543,7 +5622,7 @@ class Apexdocs {
|
|
|
5543
5622
|
});
|
|
5544
5623
|
}
|
|
5545
5624
|
}
|
|
5546
|
-
const readFiles =
|
|
5625
|
+
const readFiles = processFiles(new DefaultFileSystem());
|
|
5547
5626
|
function processMarkdown(config) {
|
|
5548
5627
|
return __async(this, null, function* () {
|
|
5549
5628
|
return _function.pipe(
|
|
@@ -5551,7 +5630,7 @@ function processMarkdown(config) {
|
|
|
5551
5630
|
E__namespace.mapLeft((error) => new FileReadingError(`Failed to resolve source directories: ${error.message}`, error)),
|
|
5552
5631
|
E__namespace.flatMap(
|
|
5553
5632
|
(sourceDirs) => E__namespace.tryCatch(
|
|
5554
|
-
() => readFiles(
|
|
5633
|
+
() => readFiles(allComponentTypes, {
|
|
5555
5634
|
includeMetadata: config.includeMetadata
|
|
5556
5635
|
})(sourceDirs, config.exclude),
|
|
5557
5636
|
(e) => new FileReadingError("An error occurred while reading files.", e)
|
|
@@ -5573,10 +5652,7 @@ function processOpenApi(config, logger) {
|
|
|
5573
5652
|
TE__namespace.flatMap(
|
|
5574
5653
|
(sourceDirs) => TE__namespace.tryCatch(
|
|
5575
5654
|
() => {
|
|
5576
|
-
const fileBodies = readFiles(
|
|
5577
|
-
sourceDirs,
|
|
5578
|
-
config.exclude
|
|
5579
|
-
);
|
|
5655
|
+
const fileBodies = readFiles(["ApexClass"])(sourceDirs, config.exclude);
|
|
5580
5656
|
return openApi(logger, fileBodies, config);
|
|
5581
5657
|
},
|
|
5582
5658
|
(e) => new FileReadingError("An error occurred while generating OpenAPI documentation.", e)
|
|
@@ -5615,8 +5691,8 @@ function processChangeLog(config) {
|
|
|
5615
5691
|
)
|
|
5616
5692
|
),
|
|
5617
5693
|
E__namespace.map(({ previousVersionDirs, currentVersionDirs }) => [
|
|
5618
|
-
readFiles(
|
|
5619
|
-
readFiles(
|
|
5694
|
+
readFiles(allComponentTypes)(previousVersionDirs, config.exclude),
|
|
5695
|
+
readFiles(allComponentTypes)(currentVersionDirs, config.exclude)
|
|
5620
5696
|
])
|
|
5621
5697
|
);
|
|
5622
5698
|
}
|
|
@@ -5697,4 +5773,5 @@ exports.changeLogDefaults = changeLogDefaults;
|
|
|
5697
5773
|
exports.markdownDefaults = markdownDefaults;
|
|
5698
5774
|
exports.openApiDefaults = openApiDefaults;
|
|
5699
5775
|
exports.skip = skip;
|
|
5776
|
+
exports.templateHelpers = templateHelpers;
|
|
5700
5777
|
exports.validateSourceDirectoryConfig = validateSourceDirectoryConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cparra/apexdocs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0-beta.0",
|
|
4
4
|
"description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apex",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"fast-xml-parser": "^4.4.0",
|
|
103
103
|
"fp-ts": "^2.16.8",
|
|
104
104
|
"handlebars": "^4.7.8",
|
|
105
|
-
"js-yaml": "4.1.
|
|
105
|
+
"js-yaml": "^4.1.0",
|
|
106
106
|
"minimatch": "^10.0.1",
|
|
107
107
|
"yargs": "^17.7.2"
|
|
108
108
|
},
|