@cparra/apexdocs 3.16.0 → 3.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var logger$1 = require('../logger-Cq4E5XXO.js');
4
+ var logger$1 = require('../logger-Cej7LT-j.js');
5
5
  var cosmiconfig = require('cosmiconfig');
6
6
  var yargs = require('yargs');
7
7
  var E = require('fp-ts/Either');
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-Cq4E5XXO.js');
4
+ var logger = require('./logger-Cej7LT-j.js');
5
5
  var E = require('fp-ts/Either');
6
6
  require('fp-ts/function');
7
7
  require('fp-ts/TaskEither');
@@ -5280,18 +5280,19 @@ function getLightningComponentBundleSourceComponents(sourceComponents) {
5280
5280
  }
5281
5281
  function toUnparsedApexBundle(fileSystem, apexSourceComponents) {
5282
5282
  return apexSourceComponents.map((component) => {
5283
- const apexComponentTuple = [
5284
- fileSystem.readFile(component.contentPath),
5285
- component.xmlPath ? fileSystem.readFile(component.xmlPath) : null
5286
- ];
5283
+ const content = fileSystem.readFile(component.contentPath);
5284
+ if (content === null) {
5285
+ return null;
5286
+ }
5287
+ const metadataContent = component.xmlPath ? fileSystem.readFile(component.xmlPath) : null;
5287
5288
  return {
5288
5289
  type: "apex",
5289
5290
  name: component.name,
5290
5291
  filePath: component.contentPath,
5291
- content: apexComponentTuple[0],
5292
- metadataContent: apexComponentTuple[1]
5292
+ content,
5293
+ metadataContent
5293
5294
  };
5294
- });
5295
+ }).filter((bundle) => bundle !== null);
5295
5296
  }
5296
5297
  function getTriggerSourceComponents(sourceComponents) {
5297
5298
  return sourceComponents.filter((component) => component.type.name === "ApexTrigger").map((component) => ({
@@ -5301,12 +5302,18 @@ function getTriggerSourceComponents(sourceComponents) {
5301
5302
  }));
5302
5303
  }
5303
5304
  function toUnparsedTriggerBundle(fileSystem, triggerSourceComponents) {
5304
- return triggerSourceComponents.map((component) => ({
5305
- type: "trigger",
5306
- name: component.name,
5307
- filePath: component.contentPath,
5308
- content: fileSystem.readFile(component.contentPath)
5309
- }));
5305
+ return triggerSourceComponents.map((component) => {
5306
+ const content = fileSystem.readFile(component.contentPath);
5307
+ if (content === null) {
5308
+ return null;
5309
+ }
5310
+ return {
5311
+ type: "trigger",
5312
+ name: component.name,
5313
+ filePath: component.contentPath,
5314
+ content
5315
+ };
5316
+ }).filter((bundle) => bundle !== null);
5310
5317
  }
5311
5318
  function getCustomObjectSourceComponents(sourceComponents) {
5312
5319
  return sourceComponents.filter((component) => component.type.name === "CustomObject").map((component) => ({
@@ -5317,13 +5324,17 @@ function getCustomObjectSourceComponents(sourceComponents) {
5317
5324
  }
5318
5325
  function toUnparsedSObjectBundle(fileSystem, customObjectSourceComponents) {
5319
5326
  return customObjectSourceComponents.map((component) => {
5327
+ const content = fileSystem.readFile(component.contentPath);
5328
+ if (content === null) {
5329
+ return null;
5330
+ }
5320
5331
  return {
5321
5332
  type: "customobject",
5322
5333
  name: component.name,
5323
5334
  filePath: component.contentPath,
5324
- content: fileSystem.readFile(component.contentPath)
5335
+ content
5325
5336
  };
5326
- });
5337
+ }).filter((bundle) => bundle !== null);
5327
5338
  }
5328
5339
  function getCustomFieldSourceComponents(sourceComponents) {
5329
5340
  return sourceComponents.filter((component) => component.type.name === "CustomField").map((component) => ({
@@ -5334,13 +5345,19 @@ function getCustomFieldSourceComponents(sourceComponents) {
5334
5345
  }));
5335
5346
  }
5336
5347
  function toUnparsedCustomFieldBundle(fileSystem, customFieldSourceComponents) {
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
- }));
5348
+ return customFieldSourceComponents.map((component) => {
5349
+ const content = fileSystem.readFile(component.contentPath);
5350
+ if (content === null) {
5351
+ return null;
5352
+ }
5353
+ return {
5354
+ type: "customfield",
5355
+ name: component.name,
5356
+ filePath: component.contentPath,
5357
+ content,
5358
+ parentName: component.parentName
5359
+ };
5360
+ }).filter((bundle) => bundle !== null);
5344
5361
  }
5345
5362
  function getCustomMetadataSourceComponents(sourceComponents) {
5346
5363
  function getParentAndNamePair(component) {
@@ -5356,25 +5373,38 @@ function getCustomMetadataSourceComponents(sourceComponents) {
5356
5373
  }));
5357
5374
  }
5358
5375
  function toUnparsedCustomMetadataBundle(fileSystem, customMetadataSourceComponents) {
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
- }));
5376
+ return customMetadataSourceComponents.map((component) => {
5377
+ const content = fileSystem.readFile(component.contentPath);
5378
+ if (content === null) {
5379
+ return null;
5380
+ }
5381
+ return {
5382
+ apiName: component.apiName,
5383
+ type: "custommetadata",
5384
+ name: component.name,
5385
+ filePath: component.contentPath,
5386
+ content,
5387
+ parentName: component.parentName
5388
+ };
5389
+ }).filter((bundle) => bundle !== null);
5367
5390
  }
5368
5391
  function toUnparsedLWCBundle(fileSystem, lwcSourceComponents) {
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
- }));
5392
+ return lwcSourceComponents.map((component) => {
5393
+ const content = fileSystem.readFile(component.contentPath);
5394
+ const metadataContent = fileSystem.readFile(component.xmlPath);
5395
+ if (content === null || metadataContent === null) {
5396
+ return null;
5397
+ }
5398
+ return {
5399
+ type: "lwc",
5400
+ name: component.name,
5401
+ filePath: component.contentPath,
5402
+ content,
5403
+ metadataContent
5404
+ };
5405
+ }).filter((bundle) => bundle !== null);
5376
5406
  }
5377
- function processFiles(fileSystem) {
5407
+ function processFiles(fileSystem, config) {
5378
5408
  return (componentTypesToRetrieve, options = { includeMetadata: false }) => {
5379
5409
  const converters = {
5380
5410
  ApexClass: _function.flow(
@@ -5398,7 +5428,7 @@ function processFiles(fileSystem) {
5398
5428
  (triggerSourceComponents) => toUnparsedTriggerBundle(fileSystem, triggerSourceComponents)
5399
5429
  ),
5400
5430
  LightningComponentBundle: _function.flow(
5401
- getLightningComponentBundleSourceComponents,
5431
+ config.experimentalLwcSupport ? getLightningComponentBundleSourceComponents : () => [],
5402
5432
  (lwcSourceComponents) => toUnparsedLWCBundle(fileSystem, lwcSourceComponents)
5403
5433
  )
5404
5434
  };
@@ -5449,7 +5479,11 @@ class DefaultFileSystem {
5449
5479
  return [...components, ...fieldComponents];
5450
5480
  }
5451
5481
  readFile(pathToRead) {
5452
- return fs__namespace.readFileSync(pathToRead, "utf8");
5482
+ try {
5483
+ return fs__namespace.readFileSync(pathToRead, "utf8");
5484
+ } catch (error) {
5485
+ return null;
5486
+ }
5453
5487
  }
5454
5488
  }
5455
5489
 
@@ -5622,7 +5656,7 @@ class Apexdocs {
5622
5656
  });
5623
5657
  }
5624
5658
  }
5625
- const readFiles = processFiles(new DefaultFileSystem());
5659
+ const readFiles = apply(processFiles, new DefaultFileSystem());
5626
5660
  function processMarkdown(config) {
5627
5661
  return __async(this, null, function* () {
5628
5662
  return _function.pipe(
@@ -5630,7 +5664,7 @@ function processMarkdown(config) {
5630
5664
  E__namespace.mapLeft((error) => new FileReadingError(`Failed to resolve source directories: ${error.message}`, error)),
5631
5665
  E__namespace.flatMap(
5632
5666
  (sourceDirs) => E__namespace.tryCatch(
5633
- () => readFiles(allComponentTypes, {
5667
+ () => readFiles({ experimentalLwcSupport: config.experimentalLwcSupport })(allComponentTypes, {
5634
5668
  includeMetadata: config.includeMetadata
5635
5669
  })(sourceDirs, config.exclude),
5636
5670
  (e) => new FileReadingError("An error occurred while reading files.", e)
@@ -5652,7 +5686,10 @@ function processOpenApi(config, logger) {
5652
5686
  TE__namespace.flatMap(
5653
5687
  (sourceDirs) => TE__namespace.tryCatch(
5654
5688
  () => {
5655
- const fileBodies = readFiles(["ApexClass"])(sourceDirs, config.exclude);
5689
+ const fileBodies = readFiles({ experimentalLwcSupport: false })(["ApexClass"])(
5690
+ sourceDirs,
5691
+ config.exclude
5692
+ );
5656
5693
  return openApi(logger, fileBodies, config);
5657
5694
  },
5658
5695
  (e) => new FileReadingError("An error occurred while generating OpenAPI documentation.", e)
@@ -5691,8 +5728,8 @@ function processChangeLog(config) {
5691
5728
  )
5692
5729
  ),
5693
5730
  E__namespace.map(({ previousVersionDirs, currentVersionDirs }) => [
5694
- readFiles(allComponentTypes)(previousVersionDirs, config.exclude),
5695
- readFiles(allComponentTypes)(currentVersionDirs, config.exclude)
5731
+ readFiles({ experimentalLwcSupport: false })(allComponentTypes)(previousVersionDirs, config.exclude),
5732
+ readFiles({ experimentalLwcSupport: false })(allComponentTypes)(currentVersionDirs, config.exclude)
5696
5733
  ])
5697
5734
  );
5698
5735
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cparra/apexdocs",
3
- "version": "3.16.0",
3
+ "version": "3.16.1",
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.0",
105
+ "js-yaml": "4.1.1",
106
106
  "minimatch": "^10.0.1",
107
107
  "yargs": "^17.7.2"
108
108
  },