snyk 1.1014.0 → 1.1016.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.
@@ -177747,12 +177747,14 @@ Object.defineProperty(exports, "MissingSubProjectError", ({ enumerable: true, ge
177747
177747
  Object.defineProperty(exports, "__esModule", ({ value: true }));
177748
177748
  exports.MissingSubProjectError = void 0;
177749
177749
  class MissingSubProjectError extends Error {
177750
- constructor(subProject, allProjects) {
177751
- super(`Specified sub-project not found: "${subProject}". ` +
177752
- `Found these projects: ${allProjects.join(', ')}`);
177750
+ constructor(subProject, allSubProjectNames) {
177751
+ const msg = !allSubProjectNames.length
177752
+ ? 'No projects found.'
177753
+ : `Found these projects: ${allSubProjectNames}`;
177754
+ super(`Specified sub-project not found: "${subProject}". ` + msg);
177753
177755
  this.name = 'MissingSubProjectError';
177754
177756
  this.subProject = subProject;
177755
- this.allProjects = allProjects;
177757
+ this.allProjects = allSubProjectNames;
177756
177758
  Error.captureStackTrace(this, MissingSubProjectError);
177757
177759
  }
177758
177760
  }
@@ -178029,28 +178031,19 @@ function extractJsonFromScriptOutput(stdoutText) {
178029
178031
  async function getAllDepsOneProject(root, targetFile, options, snykHttpClient, subProject) {
178030
178032
  const allProjectDeps = await getAllDeps(root, targetFile, options, snykHttpClient);
178031
178033
  const allSubProjectNames = allProjectDeps.allSubProjectNames;
178032
- return subProject
178033
- ? getSubProject(subProject, allProjectDeps, allSubProjectNames)
178034
- : getRootProject(allProjectDeps, allSubProjectNames);
178034
+ return getTargetProject(subProject, allProjectDeps, allSubProjectNames);
178035
178035
  }
178036
- function getSubProject(subProject, allProjectDeps, allSubProjectNames) {
178037
- if (!allProjectDeps.projects || !allProjectDeps.projects[subProject]) {
178038
- throw new errors_1.MissingSubProjectError(subProject, Object.keys(allProjectDeps));
178039
- }
178040
- const { depGraph } = allProjectDeps.projects[subProject];
178041
- const { versionBuildInfo } = allProjectDeps;
178042
- const gradleProjectName = `${allProjectDeps.defaultProject}/${subProject}`;
178043
- return {
178044
- depGraph,
178045
- allSubProjectNames,
178046
- gradleProjectName,
178047
- versionBuildInfo,
178048
- };
178049
- }
178050
- function getRootProject(allProjectDeps, allSubProjectNames) {
178036
+ function getTargetProject(subProject, allProjectDeps, allSubProjectNames) {
178051
178037
  const { projects, defaultProject, versionBuildInfo } = allProjectDeps;
178052
- const { depGraph } = projects[defaultProject];
178053
- const gradleProjectName = defaultProject;
178038
+ const targetProject = subProject || defaultProject;
178039
+ let gradleProjectName = defaultProject;
178040
+ if (subProject) {
178041
+ if (!allProjectDeps.projects || !allProjectDeps.projects[subProject]) {
178042
+ throw new errors_1.MissingSubProjectError(subProject, allSubProjectNames);
178043
+ }
178044
+ gradleProjectName = `${allProjectDeps.defaultProject}/${subProject}`;
178045
+ }
178046
+ const { depGraph } = projects[targetProject];
178054
178047
  return {
178055
178048
  depGraph,
178056
178049
  allSubProjectNames,
@@ -181822,8 +181815,15 @@ function getMavenPackageInfo(sha1, targetPath) {
181822
181815
  if (err) {
181823
181816
  reject(err);
181824
181817
  }
181825
- if (!res || !res.response || res.response.docs.length === 0) {
181826
- reject(new Error(`No package found querying '${MAVEN_SEARCH_URL}' for sha1 hash '${sha1}'.`));
181818
+ if (!res || !res.response) {
181819
+ reject(new Error(`Unexpected result querying '${MAVEN_SEARCH_URL}' for sha1 hash '${sha1}'.`));
181820
+ }
181821
+ if (res.response.docs.length === 0) {
181822
+ resolve({
181823
+ g: 'unknown',
181824
+ a: `${targetPath}:${sha1}`,
181825
+ v: 'unknown',
181826
+ });
181827
181827
  }
181828
181828
  if (res.response.docs.length > 1) {
181829
181829
  const sha1Target = path.parse(targetPath).base;