snyk 1.1067.0 → 1.1068.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.
@@ -1575,9 +1575,13 @@ var CloudConfigFileTypes;
1575
1575
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1576
1576
  exports.parseFileContent = void 0;
1577
1577
  var YAML = __webpack_require__(6792);
1578
- function parseFileContent(fileContent) {
1578
+ function parseFileContent(fileContent, fileType) {
1579
+ if (fileType === void 0) { fileType = 'yaml'; }
1579
1580
  // the YAML library can parse both YAML and JSON content, as well as content with singe/multiple YAMLs
1580
- // by using this library we don't have to disambiguate between these different contents ourselves
1581
+ // but the YAML library uses a lot of memory which could cause the Node heap to run out of memory: https://snyk.zendesk.com/agent/tickets/35401
1582
+ if (fileType === 'json') {
1583
+ return [JSON.parse(fileContent)];
1584
+ }
1581
1585
  return YAML.parseAllDocuments(fileContent).map(function (doc) {
1582
1586
  if (shouldThrowErrorFor(doc)) {
1583
1587
  throw doc.errors[0];