snyk 1.786.0 → 1.787.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.
@@ -172542,6 +172542,7 @@ function selectDisplayStrategy(options, depGraph, testResult) {
172542
172542
  }
172543
172543
  exports.selectDisplayStrategy = selectDisplayStrategy;
172544
172544
  function displayDependencies(depGraph, fileSignaturesDetails, depsFilePaths = {}) {
172545
+ var _a;
172545
172546
  let result = [];
172546
172547
  const dependencies = depGraph === null || depGraph === void 0 ? void 0 : depGraph.getDepPkgs();
172547
172548
  const hasDependencies = (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) > 0;
@@ -172550,10 +172551,9 @@ function displayDependencies(depGraph, fileSignaturesDetails, depsFilePaths = {}
172550
172551
  }
172551
172552
  result.push(chalk.whiteBright('\nDependencies:\n'));
172552
172553
  for (const { name, version } of dependencies) {
172553
- const dependencyId = `${name}@${version}`;
172554
+ const dependencyId = `${name}@${version}`.toLowerCase();
172554
172555
  result.push(`\n${common_1.leftPad(dependencyId, 2)}`);
172555
- if (fileSignaturesDetails &&
172556
- fileSignaturesDetails[dependencyId].confidence) {
172556
+ if (fileSignaturesDetails && ((_a = fileSignaturesDetails[dependencyId]) === null || _a === void 0 ? void 0 : _a.confidence)) {
172557
172557
  result.push(common_1.leftPad(`confidence: ${fileSignaturesDetails[dependencyId].confidence.toFixed(3)}`, 2));
172558
172558
  }
172559
172559
  if (!object_1.isEmpty(depsFilePaths)) {
@@ -172681,7 +172681,7 @@ exports.display = display;
172681
172681
  "use strict";
172682
172682
 
172683
172683
  Object.defineProperty(exports, "__esModule", ({ value: true }));
172684
- exports.extractFilePaths = exports.find = exports.stat = void 0;
172684
+ exports.find = exports.stat = void 0;
172685
172685
  const fs = __webpack_require__(35747);
172686
172686
  const path_1 = __webpack_require__(85622);
172687
172687
  const util_1 = __webpack_require__(31669);
@@ -172689,42 +172689,34 @@ const common_1 = __webpack_require__(51469);
172689
172689
  const debug_1 = __webpack_require__(36583);
172690
172690
  const readdir = util_1.promisify(fs.readdir);
172691
172691
  exports.stat = util_1.promisify(fs.stat);
172692
- async function find(dir) {
172693
- const dirStat = await exports.stat(dir);
172694
- if (!dirStat.isDirectory()) {
172695
- throw new Error(`${dir} is not a directory`);
172696
- }
172697
- const paths = await readdir(dir);
172698
- const absolutePaths = [];
172699
- for (const relativePath of paths) {
172700
- absolutePaths.push(path_1.join(dir, relativePath));
172701
- }
172702
- return await extractFilePaths(absolutePaths);
172692
+ async function find(src) {
172693
+ const result = [];
172694
+ await traverse(src, (filePath, stats) => {
172695
+ if (!stats.isFile() || stats.size > common_1.MAX_SUPPORTED_FILE_SIZE) {
172696
+ return;
172697
+ }
172698
+ result.push(filePath);
172699
+ });
172700
+ return result;
172703
172701
  }
172704
172702
  exports.find = find;
172705
- async function extractFilePaths(absolutePaths) {
172706
- const result = [];
172707
- for (const absolutePath of absolutePaths) {
172708
- try {
172709
- const fileStats = await exports.stat(absolutePath);
172710
- if (fileStats.isDirectory()) {
172711
- const subFiles = await find(absolutePath);
172712
- result.push(...subFiles);
172713
- }
172714
- else if (fileStats.isFile()) {
172715
- if (fileStats.size > common_1.MAX_SUPPORTED_FILE_SIZE) {
172716
- continue;
172717
- }
172718
- result.push(absolutePath);
172719
- }
172703
+ async function traverse(src, handle) {
172704
+ try {
172705
+ const stats = await exports.stat(src);
172706
+ if (!stats.isDirectory()) {
172707
+ handle(src, stats);
172708
+ return;
172720
172709
  }
172721
- catch (error) {
172722
- debug_1.debug(error.message || `Error reading file ${absolutePath}. ${error}`);
172710
+ const entries = await readdir(src);
172711
+ for (const entry of entries) {
172712
+ const absolute = path_1.join(src, entry);
172713
+ await traverse(absolute, handle);
172723
172714
  }
172724
172715
  }
172725
- return result;
172716
+ catch (error) {
172717
+ debug_1.debug(error.message || `Error reading file ${src}. ${error}`);
172718
+ }
172726
172719
  }
172727
- exports.extractFilePaths = extractFilePaths;
172728
172720
  //# sourceMappingURL=find.js.map
172729
172721
 
172730
172722
  /***/ }),