@coana-tech/cli 14.12.203 → 14.12.204

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.
package/cli.mjs CHANGED
@@ -251508,7 +251508,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
251508
251508
  }
251509
251509
 
251510
251510
  // dist/version.js
251511
- var version3 = "14.12.203";
251511
+ var version3 = "14.12.204";
251512
251512
 
251513
251513
  // dist/cli-core.js
251514
251514
  var { mapValues, omit, partition, pickBy: pickBy2 } = import_lodash15.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.203",
3
+ "version": "14.12.204",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -79680,12 +79680,12 @@ esm_default(axiosClient2, {
79680
79680
  logger.error(`Failed to fetch data after ${retryCount} attempts. Error: ${error.message}`);
79681
79681
  }
79682
79682
  });
79683
- async function getVulnerabilityMetadata(data2, apiKey3, timeout) {
79683
+ async function getVulnerabilityMetadata(data2, apiKey4, timeout) {
79684
79684
  try {
79685
- const url2 = apiKey3.type === "present" ? ApiUrls.post.getVulnerabilityMetadata : ApiUrls.post.getVulnerabilityMetadataPublic;
79685
+ const url2 = apiKey4.type === "present" ? ApiUrls.post.getVulnerabilityMetadata : ApiUrls.post.getVulnerabilityMetadataPublic;
79686
79686
  const headers = {
79687
79687
  "Content-Type": "application/json",
79688
- ...apiKey3.type === "present" ? { authorization: `api-key ${apiKey3.value}` } : {}
79688
+ ...apiKey4.type === "present" ? { authorization: `api-key ${apiKey4.value}` } : {}
79689
79689
  };
79690
79690
  const response = await axiosClient2.post(url2, { packages: data2.packages }, { headers, timeout: timeout ?? 2e4 });
79691
79691
  return response.data;
@@ -79837,10 +79837,10 @@ var coanaAPIUrls = {
79837
79837
  SUBMIT_REPORT_WARNING: `${coanaAPI}/cli/warn`,
79838
79838
  SUBMIT_REPORT_ERROR: `${coanaAPI}/cli/error`
79839
79839
  };
79840
- async function createCoanaReport(repoUrl, projectName, cliVersion2, commitSha, branchName, cliOptions, apiKey3, cliRunEnv) {
79841
- if (apiKey3.type === "missing") throw new Error("Don't call createReport with a missing apiKey");
79840
+ async function createCoanaReport(repoUrl, projectName, cliVersion2, commitSha, branchName, cliOptions, apiKey4, cliRunEnv) {
79841
+ if (apiKey4.type === "missing") throw new Error("Don't call createReport with a missing apiKey");
79842
79842
  try {
79843
- return (await sendPostRequest(coanaAPIUrls.CREATE_REPORT, apiKey3.value, { repoUrl, projectName }, {
79843
+ return (await sendPostRequest(coanaAPIUrls.CREATE_REPORT, apiKey4.value, { repoUrl, projectName }, {
79844
79844
  reportType: "v6",
79845
79845
  cliVersion: cliVersion2,
79846
79846
  commitSha,
@@ -79853,26 +79853,26 @@ async function createCoanaReport(repoUrl, projectName, cliVersion2, commitSha, b
79853
79853
  throw new Error("we should never reach this point");
79854
79854
  }
79855
79855
  }
79856
- async function registerSubprojectsCoana(subprojects, reportId, apiKey3) {
79857
- if (!reportId || apiKey3.type === "missing") return;
79856
+ async function registerSubprojectsCoana(subprojects, reportId, apiKey4) {
79857
+ if (!reportId || apiKey4.type === "missing") return;
79858
79858
  try {
79859
79859
  await sendPostRequest(
79860
79860
  `${coanaAPIUrls.REPORT_SUBPROJECTS.replace(":reportId", reportId)}`,
79861
- apiKey3.value,
79861
+ apiKey4.value,
79862
79862
  {},
79863
79863
  subprojects
79864
79864
  );
79865
79865
  } catch (e) {
79866
- sendWarningToDashboard("Unable to submit subprojects", { reportId }, subprojects, reportId, apiKey3);
79866
+ sendWarningToDashboard("Unable to submit subprojects", { reportId }, subprojects, reportId, apiKey4);
79867
79867
  logger.warn("Unable to submit subprojects:", e.message);
79868
79868
  }
79869
79869
  }
79870
- async function registerAnalysisMetadataCoana(subprojectPath, workspacePath, ecosystem, analysisMetadata, reportId, apiKey3) {
79871
- if (!reportId || apiKey3.type === "missing") return;
79870
+ async function registerAnalysisMetadataCoana(subprojectPath, workspacePath, ecosystem, analysisMetadata, reportId, apiKey4) {
79871
+ if (!reportId || apiKey4.type === "missing") return;
79872
79872
  try {
79873
79873
  await sendPostRequest(
79874
79874
  coanaAPIUrls.CREATE_ANALYSIS_METADATA.replace(":reportId", reportId),
79875
- apiKey3.value,
79875
+ apiKey4.value,
79876
79876
  {},
79877
79877
  { subprojectPath, workspacePath, ecosystem, ...analysisMetadata }
79878
79878
  );
@@ -79880,13 +79880,13 @@ async function registerAnalysisMetadataCoana(subprojectPath, workspacePath, ecos
79880
79880
  handleError(e, "Unable to create analysis metadata");
79881
79881
  }
79882
79882
  }
79883
- async function getBucketsForLastReport(subprojectPath, workspacePath, ecosystem, newReportId, apiKey3) {
79884
- if (!newReportId || apiKey3.type === "missing") return;
79883
+ async function getBucketsForLastReport(subprojectPath, workspacePath, ecosystem, newReportId, apiKey4) {
79884
+ if (!newReportId || apiKey4.type === "missing") return;
79885
79885
  try {
79886
79886
  return (await axios_default.get(coanaAPIUrls.GET_LATEST_BUCKETS, {
79887
79887
  headers: {
79888
79888
  "Content-Type": "application/json",
79889
- apiKey: apiKey3.value
79889
+ apiKey: apiKey4.value
79890
79890
  },
79891
79891
  params: { newReportId, subprojectPath, workspacePath, ecosystem }
79892
79892
  })).data;
@@ -79897,18 +79897,18 @@ async function getBucketsForLastReport(subprojectPath, workspacePath, ecosystem,
79897
79897
  { subprojectPath, workspacePath, newReportId },
79898
79898
  void 0,
79899
79899
  newReportId,
79900
- apiKey3
79900
+ apiKey4
79901
79901
  );
79902
79902
  logger.warn("Unable to get latest buckets:", e.message);
79903
79903
  }
79904
79904
  }
79905
- async function getPreviousAnalysisResults(subprojectPath, workspacePath, newReportId, apiKey3) {
79906
- if (!newReportId || apiKey3.type === "missing") return;
79905
+ async function getPreviousAnalysisResults(subprojectPath, workspacePath, newReportId, apiKey4) {
79906
+ if (!newReportId || apiKey4.type === "missing") return;
79907
79907
  try {
79908
79908
  return (await axios_default.get(coanaAPIUrls.GET_LATEST_RESULTS, {
79909
79909
  headers: {
79910
79910
  "Content-Type": "application/json",
79911
- apiKey: apiKey3.value
79911
+ apiKey: apiKey4.value
79912
79912
  },
79913
79913
  params: { newReportId, subprojectPath, workspacePath }
79914
79914
  })).data;
@@ -79918,7 +79918,7 @@ async function getPreviousAnalysisResults(subprojectPath, workspacePath, newRepo
79918
79918
  { subprojectPath, workspacePath, newReportId },
79919
79919
  void 0,
79920
79920
  newReportId,
79921
- apiKey3
79921
+ apiKey4
79922
79922
  );
79923
79923
  logger.warn(
79924
79924
  "Unable to fetch cached configurations from previous runs - Analysis will continue without cache:",
@@ -79926,12 +79926,12 @@ async function getPreviousAnalysisResults(subprojectPath, workspacePath, newRepo
79926
79926
  );
79927
79927
  }
79928
79928
  }
79929
- async function sendRegressionsToDashboard(regressions, subprojectPath, workspacePath, reportId, apiKey3) {
79930
- if (!reportId || apiKey3.type === "missing") return;
79929
+ async function sendRegressionsToDashboard(regressions, subprojectPath, workspacePath, reportId, apiKey4) {
79930
+ if (!reportId || apiKey4.type === "missing") return;
79931
79931
  try {
79932
79932
  await sendPostRequest(
79933
79933
  coanaAPIUrls.CREATE_REGRESSIONS.replace(":reportId", reportId),
79934
- apiKey3.value,
79934
+ apiKey4.value,
79935
79935
  { subprojectPath, workspacePath },
79936
79936
  regressions
79937
79937
  );
@@ -79941,7 +79941,7 @@ async function sendRegressionsToDashboard(regressions, subprojectPath, workspace
79941
79941
  { subprojectPath, workspacePath, reportId },
79942
79942
  void 0,
79943
79943
  reportId,
79944
- apiKey3
79944
+ apiKey4
79945
79945
  );
79946
79946
  logger.warn(
79947
79947
  "Unable to send regressions from experimental runs to Coana - The analysis will continue with non-experimental scans:",
@@ -79949,13 +79949,13 @@ async function sendRegressionsToDashboard(regressions, subprojectPath, workspace
79949
79949
  );
79950
79950
  }
79951
79951
  }
79952
- async function getExperimentName(subprojectPath, workspacePath, ecosystem, reportId, apiKey3) {
79953
- if (!reportId || apiKey3.type === "missing") return;
79952
+ async function getExperimentName(subprojectPath, workspacePath, ecosystem, reportId, apiKey4) {
79953
+ if (!reportId || apiKey4.type === "missing") return;
79954
79954
  try {
79955
79955
  return (await axios_default.get(coanaAPIUrls.GET_EXPERIMENT_NAME, {
79956
79956
  headers: {
79957
79957
  "Content-Type": "application/json",
79958
- apiKey: apiKey3.value
79958
+ apiKey: apiKey4.value
79959
79959
  },
79960
79960
  params: { subprojectPath, workspacePath, ecosystem, reportId }
79961
79961
  })).data;
@@ -79965,16 +79965,16 @@ async function getExperimentName(subprojectPath, workspacePath, ecosystem, repor
79965
79965
  { subprojectPath, workspacePath, ecosystem, reportId },
79966
79966
  void 0,
79967
79967
  reportId,
79968
- apiKey3
79968
+ apiKey4
79969
79969
  );
79970
79970
  }
79971
79971
  }
79972
- async function registerCLIProgressCoana(cliProgressEvent, isStartEvent, reportId, apiKey3) {
79973
- if (!reportId || apiKey3.type === "missing") return;
79972
+ async function registerCLIProgressCoana(cliProgressEvent, isStartEvent, reportId, apiKey4) {
79973
+ if (!reportId || apiKey4.type === "missing") return;
79974
79974
  try {
79975
79975
  await sendPostRequest(
79976
79976
  coanaAPIUrls.REPORT_CLI_PROGRESS.replace(":reportId", reportId),
79977
- apiKey3.value,
79977
+ apiKey4.value,
79978
79978
  { isStartEvent, time: (/* @__PURE__ */ new Date()).toISOString() },
79979
79979
  cliProgressEvent
79980
79980
  );
@@ -79982,12 +79982,12 @@ async function registerCLIProgressCoana(cliProgressEvent, isStartEvent, reportId
79982
79982
  handleError(error, "Error sending CLI progress to dashboard", false);
79983
79983
  }
79984
79984
  }
79985
- async function sendWarningToDashboard(message, data2, additionalData, reportId, apiKey3) {
79986
- if (!reportId || apiKey3.type === "missing") return;
79985
+ async function sendWarningToDashboard(message, data2, additionalData, reportId, apiKey4) {
79986
+ if (!reportId || apiKey4.type === "missing") return;
79987
79987
  try {
79988
79988
  await sendPostRequest(
79989
79989
  coanaAPIUrls.SUBMIT_REPORT_WARNING,
79990
- apiKey3.value,
79990
+ apiKey4.value,
79991
79991
  { reportId },
79992
79992
  { message, data: data2, additionalData }
79993
79993
  );
@@ -79995,8 +79995,8 @@ async function sendWarningToDashboard(message, data2, additionalData, reportId,
79995
79995
  handleError(error, "Error sending warning to dashboard", false);
79996
79996
  }
79997
79997
  }
79998
- async function sendErrorReportToCoanaDashboard(apiKey3, stackTrace, shouldLogSharing, reportId, repoUrl, projectName, logContent) {
79999
- if (apiKey3.type === "missing") return;
79998
+ async function sendErrorReportToCoanaDashboard(apiKey4, stackTrace, shouldLogSharing, reportId, repoUrl, projectName, logContent) {
79999
+ if (apiKey4.type === "missing") return;
80000
80000
  if (shouldLogSharing) {
80001
80001
  console.log("Sending crash report to Coana");
80002
80002
  console.log("The report will help team Coana debug the crash");
@@ -80007,7 +80007,7 @@ async function sendErrorReportToCoanaDashboard(apiKey3, stackTrace, shouldLogSha
80007
80007
  stackTrace,
80008
80008
  logContent
80009
80009
  };
80010
- await sendPostRequest(coanaAPIUrls.SUBMIT_REPORT_ERROR, apiKey3.value, { repoUrl, projectName, reportId }, report);
80010
+ await sendPostRequest(coanaAPIUrls.SUBMIT_REPORT_ERROR, apiKey4.value, { repoUrl, projectName, reportId }, report);
80011
80011
  if (shouldLogSharing) {
80012
80012
  console.log("Crash report submitted to dashboard successfully");
80013
80013
  }
@@ -80015,11 +80015,11 @@ async function sendErrorReportToCoanaDashboard(apiKey3, stackTrace, shouldLogSha
80015
80015
  handleError(e, "Error submitting crash report to dashboard", false);
80016
80016
  }
80017
80017
  }
80018
- async function sendPostRequest(url2, apiKey3, params, data2) {
80018
+ async function sendPostRequest(url2, apiKey4, params, data2) {
80019
80019
  const axiosConfig = {
80020
80020
  headers: {
80021
80021
  "Content-Type": "application/json",
80022
- apiKey: apiKey3
80022
+ apiKey: apiKey4
80023
80023
  },
80024
80024
  params
80025
80025
  };
@@ -80543,7 +80543,7 @@ var DashboardAPI = class {
80543
80543
  this.coanaAPI = getCoanaAPI();
80544
80544
  this.socketAPI = getSocketAPI();
80545
80545
  }
80546
- async createReport(repoUrl, projectName, cliVersion2, commitSha, branchName, cliOptions, apiKey3, cliRunEnv, systemInformation) {
80546
+ async createReport(repoUrl, projectName, cliVersion2, commitSha, branchName, cliOptions, apiKey4, cliRunEnv, systemInformation) {
80547
80547
  if (this.disableAnalyticsSharing) {
80548
80548
  return;
80549
80549
  }
@@ -80557,12 +80557,12 @@ var DashboardAPI = class {
80557
80557
  commitSha,
80558
80558
  branchName,
80559
80559
  cliOptions,
80560
- apiKey3,
80560
+ apiKey4,
80561
80561
  cliRunEnv
80562
80562
  );
80563
80563
  }
80564
80564
  }
80565
- async sendErrorReport(apiKey3, stackTrace, shouldLogSharing, errorType, reportId, repoUrl, projectName, logContent) {
80565
+ async sendErrorReport(apiKey4, stackTrace, shouldLogSharing, errorType, reportId, repoUrl, projectName, logContent) {
80566
80566
  if (this.disableAnalyticsSharing) {
80567
80567
  return;
80568
80568
  }
@@ -80576,7 +80576,7 @@ var DashboardAPI = class {
80576
80576
  );
80577
80577
  } else {
80578
80578
  await this.coanaAPI.sendErrorReportToCoanaDashboard(
80579
- apiKey3,
80579
+ apiKey4,
80580
80580
  stackTrace,
80581
80581
  shouldLogSharing,
80582
80582
  reportId,
@@ -80586,27 +80586,27 @@ var DashboardAPI = class {
80586
80586
  );
80587
80587
  }
80588
80588
  }
80589
- async registerSubprojects(subprojects, reportId, apiKey3) {
80589
+ async registerSubprojects(subprojects, reportId, apiKey4) {
80590
80590
  if (this.disableAnalyticsSharing) {
80591
80591
  return;
80592
80592
  }
80593
80593
  if (this.socketMode) {
80594
80594
  await this.socketAPI.registerSubprojectsSocket(subprojects, reportId);
80595
80595
  } else {
80596
- await this.coanaAPI.registerSubprojectsCoana(subprojects, reportId, apiKey3);
80596
+ await this.coanaAPI.registerSubprojectsCoana(subprojects, reportId, apiKey4);
80597
80597
  }
80598
80598
  }
80599
- async registerCLIProgress(cliProgressEvent, isStartEvent, reportId, apiKey3) {
80599
+ async registerCLIProgress(cliProgressEvent, isStartEvent, reportId, apiKey4) {
80600
80600
  if (this.disableAnalyticsSharing) {
80601
80601
  return;
80602
80602
  }
80603
80603
  if (this.socketMode) {
80604
80604
  await this.socketAPI.registerCLIProgressSocket(isStartEvent, cliProgressEvent, reportId);
80605
80605
  } else {
80606
- await this.coanaAPI.registerCLIProgressCoana(cliProgressEvent, isStartEvent, reportId, apiKey3);
80606
+ await this.coanaAPI.registerCLIProgressCoana(cliProgressEvent, isStartEvent, reportId, apiKey4);
80607
80607
  }
80608
80608
  }
80609
- async registerAnalysisMetadata(subprojectPath, workspacePath, ecosystem, analysisMetadata, reportId, apiKey3) {
80609
+ async registerAnalysisMetadata(subprojectPath, workspacePath, ecosystem, analysisMetadata, reportId, apiKey4) {
80610
80610
  if (this.disableAnalyticsSharing) {
80611
80611
  return;
80612
80612
  }
@@ -80625,15 +80625,15 @@ var DashboardAPI = class {
80625
80625
  ecosystem,
80626
80626
  analysisMetadata,
80627
80627
  reportId,
80628
- apiKey3
80628
+ apiKey4
80629
80629
  );
80630
80630
  }
80631
80631
  }
80632
- async getBucketsForLastReport(subprojectPath, workspacePath, ecosystem, reportId, apiKey3) {
80632
+ async getBucketsForLastReport(subprojectPath, workspacePath, ecosystem, reportId, apiKey4) {
80633
80633
  if (this.socketMode) {
80634
80634
  return await this.socketAPI.getLatestBucketsSocket(subprojectPath, workspacePath);
80635
80635
  } else {
80636
- return await this.coanaAPI.getBucketsForLastReport(subprojectPath, workspacePath, ecosystem, reportId, apiKey3);
80636
+ return await this.coanaAPI.getBucketsForLastReport(subprojectPath, workspacePath, ecosystem, reportId, apiKey4);
80637
80637
  }
80638
80638
  }
80639
80639
  async sendLogChunk(reportId, logs) {
@@ -88663,6 +88663,9 @@ var ToolPathResolver = class {
88663
88663
  }[`${platform7}-${arch === "arm" ? "arm64" : arch}`];
88664
88664
  return resolve6(COANA_REPOS_PATH(), "spar", `sparjs-${name2}.gz`);
88665
88665
  }
88666
+ static get sparJSRuntimeDir() {
88667
+ return resolve6(COANA_REPOS_PATH(), "spar/runtime/dist");
88668
+ }
88666
88669
  /**
88667
88670
  * Get the path to the Javap Service JAR file
88668
88671
  */
@@ -114157,7 +114160,7 @@ var SparJSAnalysisEngine = class extends JSAnalysisEngine {
114157
114160
  return extracted;
114158
114161
  })();
114159
114162
  }
114160
- async runAnalysis(mainProjectRoot, projectRoot, { maxIndirections, includePackages }, reachabilityAnalysisOptions, timeoutInSeconds, vulnerabilities, _experiment, telemetryHandler, analyzerTelemetryHandler) {
114163
+ async runAnalysis(mainProjectRoot, projectRoot, { maxIndirections, includePackages, approx }, reachabilityAnalysisOptions, timeoutInSeconds, vulnerabilities, _experiment, telemetryHandler, analyzerTelemetryHandler) {
114161
114164
  const tmpFolder = await createTmpDirectory("sparjs-analysis");
114162
114165
  try {
114163
114166
  const filesToAnalyze = reachabilityAnalysisOptions.entryPoints ?? [projectRoot];
@@ -114188,6 +114191,8 @@ var SparJSAnalysisEngine = class extends JSAnalysisEngine {
114188
114191
  --diagnostics-json ${diagnosticsFile}
114189
114192
  --max-indirections ${maxIndirections}
114190
114193
  ${!!includePackages && (includePackages.length ? ["--include-packages", ...includePackages] : ["--ignore-dependencies"])}
114194
+ ${/* XXX: Requires Node 22+ */
114195
+ approx && "--approx"}
114191
114196
  --callstacks-json ${callStackFile}
114192
114197
  --unresolved-non-vulnerable
114193
114198
  ${parseShellArgs(process.env.COANA_SPARJS_ADDITIONAL_FLAGS ?? "")}
@@ -114203,7 +114208,12 @@ var SparJSAnalysisEngine = class extends JSAnalysisEngine {
114203
114208
  heartbeat: HEARTBEATS.js,
114204
114209
  telemetryHandler,
114205
114210
  analyzerTelemetryHandler,
114206
- outputLogFile: logFile
114211
+ outputLogFile: logFile,
114212
+ env: {
114213
+ ...process.env,
114214
+ // Required for approximate interpretation
114215
+ SPAR_RUNTIME_DIR: ToolPathResolver.sparJSRuntimeDir
114216
+ }
114207
114217
  }
114208
114218
  );
114209
114219
  if (reachabilityAnalysisOptions.printLogFile)
@@ -114327,20 +114337,33 @@ function pluralize(count, word) {
114327
114337
  var { partition: partition3, memoize: memoize2 } = import_lodash20.default;
114328
114338
  var SOCKET_MODE2 = process.env.SOCKET_MODE === "true";
114329
114339
  var dashboardAPI2 = new DashboardAPI(SOCKET_MODE2, process.env.DISABLE_ANALYTICS_SHARING === "true");
114340
+ var apiKey2 = COANA_API_KEY ? { type: "present", value: COANA_API_KEY } : { type: "missing" };
114330
114341
  var NpmAnalyzer = class {
114331
114342
  state;
114332
114343
  projectDir;
114333
114344
  statsSourceFilesAnalyzed;
114334
114345
  preinstalledDependencies = "NO";
114335
- engine;
114346
+ _enginePromise;
114336
114347
  constructor(state, projectDir) {
114337
114348
  this.state = state;
114338
114349
  this.projectDir = projectDir;
114339
- this.engine = state.otherAnalysisOptions.jsAnalysisEngine === "sparjs" ? new SparJSAnalysisEngine() : new JellyJSAnalysisEngine();
114350
+ }
114351
+ get engine() {
114352
+ return this._enginePromise ??= this.resolveEngine();
114353
+ }
114354
+ async resolveEngine() {
114355
+ const engine = this.state.otherAnalysisOptions.jsAnalysisEngine;
114356
+ let useSparJS = engine === "sparjs";
114357
+ if (!engine) {
114358
+ const expName = await getExperimentName(relative10(this.state.rootWorkingDir, this.state.subprojectDir) || ".", this.state.workspacePath, "NPM", COANA_REPORT_ID, apiKey2);
114359
+ useSparJS = expName === "SPARJS_EXPERIMENT";
114360
+ }
114361
+ return new (useSparJS ? SparJSAnalysisEngine : JellyJSAnalysisEngine)();
114340
114362
  }
114341
114363
  async runPhantomDependencyAnalysis() {
114342
114364
  try {
114343
- return (await this.engine.runPhantomDependencyAnalysis(this.projectDir, this.state.reachabilityAnalysisOptions)).map((r) => r.name);
114365
+ const engine = await this.engine;
114366
+ return (await engine.runPhantomDependencyAnalysis(this.projectDir, this.state.reachabilityAnalysisOptions)).map((r) => r.name);
114344
114367
  } catch (e) {
114345
114368
  logger.debug("Error while running phantom dependency analysis: ", e);
114346
114369
  }
@@ -114356,8 +114379,9 @@ var NpmAnalyzer = class {
114356
114379
  }
114357
114380
  analysisMetadataCollector?.(metadata);
114358
114381
  };
114382
+ const engine = await this.engine;
114359
114383
  try {
114360
- const vulnerabilityScanner = new JSCodeAwareVulnerabilityScanner(this.engine, this.state.rootWorkingDir, this.projectDir, this.state.reachabilityAnalysisOptions);
114384
+ const vulnerabilityScanner = new JSCodeAwareVulnerabilityScanner(engine, this.state.rootWorkingDir, this.projectDir, this.state.reachabilityAnalysisOptions);
114361
114385
  await vulnerabilityScanner.prepareDependencies(this.state, heuristicsInOrder[0]);
114362
114386
  logger.info(`Running import reachability analysis for ${vulns.length} ${pluralize(vulns.length, "vulnerability")}`);
114363
114387
  let reachable;
@@ -114370,7 +114394,7 @@ var NpmAnalyzer = class {
114370
114394
  try {
114371
114395
  statusUpdater?.("Running import reachability analysis");
114372
114396
  logger.debug("Starting import reachability analysis");
114373
- reachable = await this.engine.runImportReachabilityAnalysis(this.state.rootWorkingDir, this.projectDir, vulns, this.state.reachabilityAnalysisOptions, createTelemetryHandler(dashboardAPI2, importAnalysisMetadataId), createAnalyzerTelemetryHandler(dashboardAPI2, importAnalysisMetadataId));
114397
+ reachable = await engine.runImportReachabilityAnalysis(this.state.rootWorkingDir, this.projectDir, vulns, this.state.reachabilityAnalysisOptions, createTelemetryHandler(dashboardAPI2, importAnalysisMetadataId), createAnalyzerTelemetryHandler(dashboardAPI2, importAnalysisMetadataId));
114374
114398
  dashboardAPI2.registerDiagnosticsToAnalysisMetadata(importAnalysisMetadataId, {
114375
114399
  analysisDiagnostics: {
114376
114400
  timeout: false,
@@ -114471,7 +114495,7 @@ ${e.stack}` : String(e),
114471
114495
  }
114472
114496
  return res;
114473
114497
  } finally {
114474
- await this.engine.cleanup();
114498
+ await engine.cleanup();
114475
114499
  if (!nodeModulesAlreadyExisted) {
114476
114500
  if (existsSync14(resolve22(this.state.subprojectDir, "node_modules")))
114477
114501
  await rm8(resolve22(this.state.subprojectDir, "node_modules"), { recursive: true });
@@ -114939,7 +114963,7 @@ var ecosystemAnalyzer = {
114939
114963
  RUST: RustAnalyzer,
114940
114964
  RUBYGEMS: RubyGemsAnalyzer
114941
114965
  };
114942
- var apiKey2 = COANA_API_KEY ? { type: "present", value: COANA_API_KEY } : { type: "missing" };
114966
+ var apiKey3 = COANA_API_KEY ? { type: "present", value: COANA_API_KEY } : { type: "missing" };
114943
114967
  var dashboardAPI3 = new DashboardAPI(process.env.SOCKET_MODE === "true", process.env.DISABLE_ANALYTICS_SHARING === "true");
114944
114968
  async function runReachabilityAnalysis(state) {
114945
114969
  const projectDir = resolve24(state.subprojectDir, state.workspacePath);
@@ -114951,7 +114975,7 @@ async function runReachabilityAnalysis(state) {
114951
114975
  const analyzer = new constructor(state, projectDir);
114952
114976
  const [vulnerabilitiesWithPrecomputedResults, vulnerabilitiesWithoutPrecomputedResults] = partition4(state.vulnerabilities, (v) => "results" in v);
114953
114977
  const augmentedVulnerabilities = await runWholeProgramCodeAwareVulnerabilityScanner(analyzer, vulnerabilitiesWithoutPrecomputedResults, async (amd) => {
114954
- await dashboardAPI3.registerAnalysisMetadata(relative12(state.rootWorkingDir, state.subprojectDir) || ".", state.workspacePath, state.workspaceData.data.type, amd, COANA_REPORT_ID, apiKey2);
114978
+ await dashboardAPI3.registerAnalysisMetadata(relative12(state.rootWorkingDir, state.subprojectDir) || ".", state.workspacePath, state.workspaceData.data.type, amd, COANA_REPORT_ID, apiKey3);
114955
114979
  });
114956
114980
  const diagnostics = await analyzer.getWorkspaceDiagnostics();
114957
114981
  return {