snyk 1.843.0 → 1.844.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.
@@ -155043,7 +155043,7 @@ function findDependencyLines(depGraph, options, depsFilePaths, fileSignaturesDet
155043
155043
  else if (displayDeps) {
155044
155044
  return displayDependencies(depGraph, fileSignaturesDetails);
155045
155045
  }
155046
- return [''];
155046
+ return [];
155047
155047
  }
155048
155048
  function selectDisplayStrategy(options, depGraph, testResult) {
155049
155049
  const { depsFilePaths, issues, issuesData, fileSignaturesDetails, } = testResult;
@@ -155121,11 +155121,9 @@ function displayIssues(depGraph, issues, issuesData, supportUnmanagedVulnDB = fa
155121
155121
  ? chalk.redBright(issuesCount)
155122
155122
  : chalk.greenBright(issuesCount);
155123
155123
  const identifiedUnmanagedDeps = `Tested ${dependenciesCountMsg} for known issues, found ${issuesFound}.\n`;
155124
- const failedToIdentifyUnmanagedDeps = `Could not identify unmanaged dependencies to be tested.`;
155125
- const endlineMsg = (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) > 0
155126
- ? identifiedUnmanagedDeps
155127
- : failedToIdentifyUnmanagedDeps;
155128
- result.push(endlineMsg);
155124
+ if ((dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) > 0) {
155125
+ result.push(identifiedUnmanagedDeps);
155126
+ }
155129
155127
  return result;
155130
155128
  }
155131
155129
  exports.displayIssues = displayIssues;
@@ -155158,9 +155156,15 @@ const chalk = __webpack_require__(97502);
155158
155156
  const debug_1 = __webpack_require__(36583);
155159
155157
  const dep_graph_1 = __webpack_require__(71479);
155160
155158
  const display_1 = __webpack_require__(97934);
155159
+ const error_1 = __webpack_require__(68268);
155161
155160
  async function display(scanResults, testResults, errors, options) {
155161
+ if (errors.length > 0) {
155162
+ error_1.exitWith(error_1.ExitCode.Error, display_1.displayErrors(errors).join('\n'));
155163
+ }
155164
+ const result = [];
155165
+ let hasDependencies = false;
155166
+ let hasVulnerabilities = false;
155162
155167
  try {
155163
- const result = [];
155164
155168
  if (options === null || options === void 0 ? void 0 : options.path) {
155165
155169
  const prefix = chalk.bold.white(`\nTesting ${options.path}...\n`);
155166
155170
  result.push(prefix);
@@ -155172,16 +155176,27 @@ async function display(scanResults, testResults, errors, options) {
155172
155176
  for (const testResult of testResults) {
155173
155177
  const depGraph = dep_graph_1.createFromJSON(testResult.depGraphData);
155174
155178
  const [dependencySection, issuesSection] = display_1.selectDisplayStrategy(options, depGraph, testResult);
155179
+ if (testResult.depGraphData.pkgs.length > 1) {
155180
+ hasDependencies = true;
155181
+ }
155182
+ if (testResult.issues.length > 0) {
155183
+ hasVulnerabilities = true;
155184
+ }
155175
155185
  result.push(...dependencySection, ...issuesSection);
155176
155186
  }
155177
- const errorLines = display_1.displayErrors(errors);
155178
- result.push(...errorLines);
155179
- return result.join('\n');
155180
155187
  }
155181
155188
  catch (error) {
155182
- debug_1.debug(error.message || 'Error displaying results. ' + error);
155183
- return 'Error displaying results.';
155189
+ debug_1.debug(error.message || `Error displaying the results: ${error}`);
155190
+ error_1.exitWith(error_1.ExitCode.Error, 'Error displaying results.');
155191
+ }
155192
+ if (hasVulnerabilities) {
155193
+ error_1.exitWith(error_1.ExitCode.VulnerabilitiesFound, result.join('\n'));
155194
+ }
155195
+ if (!hasDependencies) {
155196
+ result.push(`Could not detect supported target files in ${options === null || options === void 0 ? void 0 : options.path}`);
155197
+ error_1.exitWith(error_1.ExitCode.NoSupportedFiles, result.join('\n'));
155184
155198
  }
155199
+ return result.join('\n');
155185
155200
  }
155186
155201
  exports.display = display;
155187
155202
  //# sourceMappingURL=index.js.map
@@ -155456,6 +155471,30 @@ exports.isBinary = isBinary;
155456
155471
 
155457
155472
  /***/ }),
155458
155473
 
155474
+ /***/ 68268:
155475
+ /***/ ((__unused_webpack_module, exports) => {
155476
+
155477
+ "use strict";
155478
+
155479
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
155480
+ exports.exitWith = exports.ExitCode = void 0;
155481
+ var ExitCode;
155482
+ (function (ExitCode) {
155483
+ ExitCode["VulnerabilitiesFound"] = "VULNS";
155484
+ ExitCode[ExitCode["Error"] = 2] = "Error";
155485
+ ExitCode[ExitCode["NoSupportedFiles"] = 3] = "NoSupportedFiles";
155486
+ })(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
155487
+ function exitWith(exitCode, message) {
155488
+ const err = new Error();
155489
+ err.message = message;
155490
+ err.code = exitCode.valueOf();
155491
+ throw err;
155492
+ }
155493
+ exports.exitWith = exitWith;
155494
+ //# sourceMappingURL=error.js.map
155495
+
155496
+ /***/ }),
155497
+
155459
155498
  /***/ 72600:
155460
155499
  /***/ ((__unused_webpack_module, exports) => {
155461
155500