@cparra/apexdocs 3.15.0 → 3.15.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-Cqxjp5OT.js');
4
+ var logger$1 = require('../logger-BPNUptnX.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-Cqxjp5OT.js');
4
+ var logger = require('./logger-BPNUptnX.js');
5
5
  var E = require('fp-ts/Either');
6
6
  require('fp-ts/function');
7
7
  require('fp-ts/TaskEither');
@@ -5167,18 +5167,19 @@ function getLightningComponentBundleSourceComponents(sourceComponents) {
5167
5167
  }
5168
5168
  function toUnparsedApexBundle(fileSystem, apexSourceComponents) {
5169
5169
  return apexSourceComponents.map((component) => {
5170
- const apexComponentTuple = [
5171
- fileSystem.readFile(component.contentPath),
5172
- component.xmlPath ? fileSystem.readFile(component.xmlPath) : null
5173
- ];
5170
+ const content = fileSystem.readFile(component.contentPath);
5171
+ if (content === null) {
5172
+ return null;
5173
+ }
5174
+ const metadataContent = component.xmlPath ? fileSystem.readFile(component.xmlPath) : null;
5174
5175
  return {
5175
5176
  type: "apex",
5176
5177
  name: component.name,
5177
5178
  filePath: component.contentPath,
5178
- content: apexComponentTuple[0],
5179
- metadataContent: apexComponentTuple[1]
5179
+ content,
5180
+ metadataContent
5180
5181
  };
5181
- });
5182
+ }).filter((bundle) => bundle !== null);
5182
5183
  }
5183
5184
  function getTriggerSourceComponents(sourceComponents) {
5184
5185
  return sourceComponents.filter((component) => component.type.name === "ApexTrigger").map((component) => ({
@@ -5188,12 +5189,18 @@ function getTriggerSourceComponents(sourceComponents) {
5188
5189
  }));
5189
5190
  }
5190
5191
  function toUnparsedTriggerBundle(fileSystem, triggerSourceComponents) {
5191
- return triggerSourceComponents.map((component) => ({
5192
- type: "trigger",
5193
- name: component.name,
5194
- filePath: component.contentPath,
5195
- content: fileSystem.readFile(component.contentPath)
5196
- }));
5192
+ return triggerSourceComponents.map((component) => {
5193
+ const content = fileSystem.readFile(component.contentPath);
5194
+ if (content === null) {
5195
+ return null;
5196
+ }
5197
+ return {
5198
+ type: "trigger",
5199
+ name: component.name,
5200
+ filePath: component.contentPath,
5201
+ content
5202
+ };
5203
+ }).filter((bundle) => bundle !== null);
5197
5204
  }
5198
5205
  function getCustomObjectSourceComponents(sourceComponents) {
5199
5206
  return sourceComponents.filter((component) => component.type.name === "CustomObject").map((component) => ({
@@ -5204,13 +5211,17 @@ function getCustomObjectSourceComponents(sourceComponents) {
5204
5211
  }
5205
5212
  function toUnparsedSObjectBundle(fileSystem, customObjectSourceComponents) {
5206
5213
  return customObjectSourceComponents.map((component) => {
5214
+ const content = fileSystem.readFile(component.contentPath);
5215
+ if (content === null) {
5216
+ return null;
5217
+ }
5207
5218
  return {
5208
5219
  type: "customobject",
5209
5220
  name: component.name,
5210
5221
  filePath: component.contentPath,
5211
- content: fileSystem.readFile(component.contentPath)
5222
+ content
5212
5223
  };
5213
- });
5224
+ }).filter((bundle) => bundle !== null);
5214
5225
  }
5215
5226
  function getCustomFieldSourceComponents(sourceComponents) {
5216
5227
  return sourceComponents.filter((component) => component.type.name === "CustomField").map((component) => ({
@@ -5221,13 +5232,19 @@ function getCustomFieldSourceComponents(sourceComponents) {
5221
5232
  }));
5222
5233
  }
5223
5234
  function toUnparsedCustomFieldBundle(fileSystem, customFieldSourceComponents) {
5224
- return customFieldSourceComponents.map((component) => ({
5225
- type: "customfield",
5226
- name: component.name,
5227
- filePath: component.contentPath,
5228
- content: fileSystem.readFile(component.contentPath),
5229
- parentName: component.parentName
5230
- }));
5235
+ return customFieldSourceComponents.map((component) => {
5236
+ const content = fileSystem.readFile(component.contentPath);
5237
+ if (content === null) {
5238
+ return null;
5239
+ }
5240
+ return {
5241
+ type: "customfield",
5242
+ name: component.name,
5243
+ filePath: component.contentPath,
5244
+ content,
5245
+ parentName: component.parentName
5246
+ };
5247
+ }).filter((bundle) => bundle !== null);
5231
5248
  }
5232
5249
  function getCustomMetadataSourceComponents(sourceComponents) {
5233
5250
  function getParentAndNamePair(component) {
@@ -5243,25 +5260,38 @@ function getCustomMetadataSourceComponents(sourceComponents) {
5243
5260
  }));
5244
5261
  }
5245
5262
  function toUnparsedCustomMetadataBundle(fileSystem, customMetadataSourceComponents) {
5246
- return customMetadataSourceComponents.map((component) => ({
5247
- apiName: component.apiName,
5248
- type: "custommetadata",
5249
- name: component.name,
5250
- filePath: component.contentPath,
5251
- content: fileSystem.readFile(component.contentPath),
5252
- parentName: component.parentName
5253
- }));
5263
+ return customMetadataSourceComponents.map((component) => {
5264
+ const content = fileSystem.readFile(component.contentPath);
5265
+ if (content === null) {
5266
+ return null;
5267
+ }
5268
+ return {
5269
+ apiName: component.apiName,
5270
+ type: "custommetadata",
5271
+ name: component.name,
5272
+ filePath: component.contentPath,
5273
+ content,
5274
+ parentName: component.parentName
5275
+ };
5276
+ }).filter((bundle) => bundle !== null);
5254
5277
  }
5255
5278
  function toUnparsedLWCBundle(fileSystem, lwcSourceComponents) {
5256
- return lwcSourceComponents.map((component) => ({
5257
- type: "lwc",
5258
- name: component.name,
5259
- filePath: component.contentPath,
5260
- content: fileSystem.readFile(component.contentPath),
5261
- metadataContent: fileSystem.readFile(component.xmlPath)
5262
- }));
5279
+ return lwcSourceComponents.map((component) => {
5280
+ const content = fileSystem.readFile(component.contentPath);
5281
+ const metadataContent = fileSystem.readFile(component.xmlPath);
5282
+ if (content === null || metadataContent === null) {
5283
+ return null;
5284
+ }
5285
+ return {
5286
+ type: "lwc",
5287
+ name: component.name,
5288
+ filePath: component.contentPath,
5289
+ content,
5290
+ metadataContent
5291
+ };
5292
+ }).filter((bundle) => bundle !== null);
5263
5293
  }
5264
- function processFiles(fileSystem) {
5294
+ function processFiles(fileSystem, config) {
5265
5295
  return (componentTypesToRetrieve, options = { includeMetadata: false }) => {
5266
5296
  const converters = {
5267
5297
  ApexClass: _function.flow(
@@ -5285,7 +5315,7 @@ function processFiles(fileSystem) {
5285
5315
  (triggerSourceComponents) => toUnparsedTriggerBundle(fileSystem, triggerSourceComponents)
5286
5316
  ),
5287
5317
  LightningComponentBundle: _function.flow(
5288
- getLightningComponentBundleSourceComponents,
5318
+ config.experimentalLwcSupport ? getLightningComponentBundleSourceComponents : () => [],
5289
5319
  (lwcSourceComponents) => toUnparsedLWCBundle(fileSystem, lwcSourceComponents)
5290
5320
  )
5291
5321
  };
@@ -5336,7 +5366,11 @@ class DefaultFileSystem {
5336
5366
  return [...components, ...fieldComponents];
5337
5367
  }
5338
5368
  readFile(pathToRead) {
5339
- return fs__namespace.readFileSync(pathToRead, "utf8");
5369
+ try {
5370
+ return fs__namespace.readFileSync(pathToRead, "utf8");
5371
+ } catch (error) {
5372
+ return null;
5373
+ }
5340
5374
  }
5341
5375
  }
5342
5376
 
@@ -5509,7 +5543,7 @@ class Apexdocs {
5509
5543
  });
5510
5544
  }
5511
5545
  }
5512
- const readFiles = processFiles(new DefaultFileSystem());
5546
+ const readFiles = apply(processFiles, new DefaultFileSystem());
5513
5547
  function processMarkdown(config) {
5514
5548
  return __async(this, null, function* () {
5515
5549
  return _function.pipe(
@@ -5517,7 +5551,7 @@ function processMarkdown(config) {
5517
5551
  E__namespace.mapLeft((error) => new FileReadingError(`Failed to resolve source directories: ${error.message}`, error)),
5518
5552
  E__namespace.flatMap(
5519
5553
  (sourceDirs) => E__namespace.tryCatch(
5520
- () => readFiles(allComponentTypes, {
5554
+ () => readFiles({ experimentalLwcSupport: config.experimentalLwcSupport })(allComponentTypes, {
5521
5555
  includeMetadata: config.includeMetadata
5522
5556
  })(sourceDirs, config.exclude),
5523
5557
  (e) => new FileReadingError("An error occurred while reading files.", e)
@@ -5539,7 +5573,10 @@ function processOpenApi(config, logger) {
5539
5573
  TE__namespace.flatMap(
5540
5574
  (sourceDirs) => TE__namespace.tryCatch(
5541
5575
  () => {
5542
- const fileBodies = readFiles(["ApexClass"])(sourceDirs, config.exclude);
5576
+ const fileBodies = readFiles({ experimentalLwcSupport: false })(["ApexClass"])(
5577
+ sourceDirs,
5578
+ config.exclude
5579
+ );
5543
5580
  return openApi(logger, fileBodies, config);
5544
5581
  },
5545
5582
  (e) => new FileReadingError("An error occurred while generating OpenAPI documentation.", e)
@@ -5578,8 +5615,8 @@ function processChangeLog(config) {
5578
5615
  )
5579
5616
  ),
5580
5617
  E__namespace.map(({ previousVersionDirs, currentVersionDirs }) => [
5581
- readFiles(allComponentTypes)(previousVersionDirs, config.exclude),
5582
- readFiles(allComponentTypes)(currentVersionDirs, config.exclude)
5618
+ readFiles({ experimentalLwcSupport: false })(allComponentTypes)(previousVersionDirs, config.exclude),
5619
+ readFiles({ experimentalLwcSupport: false })(allComponentTypes)(currentVersionDirs, config.exclude)
5583
5620
  ])
5584
5621
  );
5585
5622
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cparra/apexdocs",
3
- "version": "3.15.0",
3
+ "version": "3.15.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
  },