snyk 1.909.0 → 1.910.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.
@@ -5346,20 +5346,24 @@ exports.codePlugin = {
5346
5346
  const meta = output_format_1.getMeta({ ...options, org: newOrg }, path);
5347
5347
  const prefix = output_format_1.getPrefix(path);
5348
5348
  let readableResult = output_format_1.getCodeDisplayedOutput(sarifTypedResult, meta, prefix);
5349
- let sarifResult;
5350
5349
  if (numOfIssues > 0 && options['no-markdown']) {
5351
5350
  (_d = (_c = sarifTypedResult.runs) === null || _c === void 0 ? void 0 : _c[0].results) === null || _d === void 0 ? void 0 : _d.forEach(({ message }) => {
5352
5351
  delete message.markdown;
5353
5352
  });
5354
5353
  }
5354
+ let sarifResult;
5355
5355
  if (options['sarif-file-output']) {
5356
5356
  sarifResult = json_1.jsonStringifyLargeObject(sarifTypedResult);
5357
5357
  }
5358
+ let jsonResult;
5359
+ if (options['json-file-output']) {
5360
+ jsonResult = json_1.jsonStringifyLargeObject(sarifTypedResult);
5361
+ }
5358
5362
  if (options.sarif || options.json) {
5359
5363
  readableResult = json_1.jsonStringifyLargeObject(sarifTypedResult);
5360
5364
  }
5361
5365
  if (numOfIssues > 0) {
5362
- hasIssues(readableResult, sarifResult);
5366
+ throwIssuesError({ readableResult, sarifResult, jsonResult });
5363
5367
  }
5364
5368
  return sarifResult ? { readableResult, sarifResult } : { readableResult };
5365
5369
  }
@@ -5397,11 +5401,14 @@ function isUnauthorizedError(error) {
5397
5401
  error.code === 403 ||
5398
5402
  error.code === 401);
5399
5403
  }
5400
- function hasIssues(readableResult, sarifResult) {
5401
- const err = new Error(readableResult);
5404
+ function throwIssuesError(args) {
5405
+ const err = new Error(args.readableResult);
5402
5406
  err.code = 'VULNS';
5403
- if (sarifResult !== undefined) {
5404
- err.sarifStringifiedResults = sarifResult;
5407
+ if (args.sarifResult !== undefined) {
5408
+ err.sarifStringifiedResults = args.sarifResult;
5409
+ }
5410
+ if (args.jsonResult !== undefined) {
5411
+ err.jsonStringifiedResults = args.jsonResult;
5405
5412
  }
5406
5413
  throw err;
5407
5414
  }