@socketsecurity/cli-with-sentry 1.0.17 → 1.0.19

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/dist/cli.js CHANGED
@@ -3725,6 +3725,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
3725
3725
  autoMerge,
3726
3726
  cwd,
3727
3727
  limit,
3728
+ minSatisfying,
3728
3729
  rangeStyle,
3729
3730
  spinner,
3730
3731
  test,
@@ -3737,9 +3738,13 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
3737
3738
  if (!infoByPartialPurl) {
3738
3739
  spinner?.stop();
3739
3740
  logger.logger.info('No fixable vulns found.');
3740
- debug.debugFn('inspect:\n', {
3741
- alertsMap
3742
- });
3741
+ if (alertsMap.size) {
3742
+ debug.debugFn('inspect:', {
3743
+ alertsMap
3744
+ });
3745
+ } else {
3746
+ debug.debugFn('inspect: { alertsMap: Map(0) {} }');
3747
+ }
3743
3748
  return {
3744
3749
  ok: true,
3745
3750
  data: {
@@ -3872,7 +3877,10 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
3872
3877
  firstPatchedVersionIdentifier,
3873
3878
  vulnerableVersionRange
3874
3879
  } of infos) {
3875
- const newVersion = shadowNpmInject.findBestPatchVersion(node, availableVersions, vulnerableVersionRange);
3880
+ const newVersion = shadowNpmInject.findBestPatchVersion(node, availableVersions, {
3881
+ minSatisfying,
3882
+ vulnerableVersionRange
3883
+ });
3876
3884
  const newVersionPackument = newVersion ? packument.versions[newVersion] : undefined;
3877
3885
  if (!(newVersion && newVersionPackument)) {
3878
3886
  warningsForAfter.add(`${oldId} not updated: requires >=${firstPatchedVersionIdentifier}`);
@@ -4500,6 +4508,7 @@ async function handleFix({
4500
4508
  cwd,
4501
4509
  ghsas,
4502
4510
  limit,
4511
+ minSatisfying,
4503
4512
  outputKind,
4504
4513
  purls,
4505
4514
  rangeStyle,
@@ -4574,23 +4583,25 @@ async function handleFix({
4574
4583
  }, outputKind);
4575
4584
  return;
4576
4585
  }
4577
- logger.logger.info(`Fixing packages for ${pkgEnvDetails.agent} v${pkgEnvDetails.agentVersion}.\n`);
4578
4586
  const {
4579
- agent
4587
+ agent,
4588
+ agentVersion
4580
4589
  } = pkgEnvDetails;
4581
4590
  if (agent !== NPM$7 && agent !== PNPM$6) {
4582
4591
  await outputFixResult({
4583
4592
  ok: false,
4584
4593
  message: 'Not supported.',
4585
- cause: `${agent} is not supported by this command.`
4594
+ cause: `${agent} v${agentVersion} is not supported by this command.`
4586
4595
  }, outputKind);
4587
4596
  return;
4588
4597
  }
4598
+ logger.logger.info(`Fixing packages for ${agent} v${agentVersion}.\n`);
4589
4599
  const fixer = agent === NPM$7 ? npmFix : pnpmFix;
4590
4600
  await outputFixResult(await fixer(pkgEnvDetails, {
4591
4601
  autoMerge,
4592
4602
  cwd,
4593
4603
  limit,
4604
+ minSatisfying,
4594
4605
  purls,
4595
4606
  rangeStyle,
4596
4607
  spinner,
@@ -4629,6 +4640,17 @@ const config$H = {
4629
4640
  default: Infinity,
4630
4641
  description: 'The number of fixes to attempt at a time'
4631
4642
  },
4643
+ maxSatisfying: {
4644
+ type: 'boolean',
4645
+ default: true,
4646
+ description: 'Use the maximum satisfying version for dependency updates',
4647
+ hidden: true
4648
+ },
4649
+ minSatisfying: {
4650
+ type: 'boolean',
4651
+ default: false,
4652
+ description: 'Constrain dependency updates to the minimum satisfying version'
4653
+ },
4632
4654
  purl: {
4633
4655
  type: 'string',
4634
4656
  default: [],
@@ -4732,6 +4754,8 @@ async function run$H(argv, importMeta, {
4732
4754
  }
4733
4755
  const ghsas = utils.cmdFlagValueToArray(cli.flags['ghsa']);
4734
4756
  const limit = (cli.flags['limit'] ? parseInt(String(cli.flags['limit'] || ''), 10) : Infinity) || Infinity;
4757
+ const maxSatisfying = Boolean(cli.flags['maxSatisfying']);
4758
+ const minSatisfying = Boolean(cli.flags['minSatisfying']) || !maxSatisfying;
4735
4759
  const purls = utils.cmdFlagValueToArray(cli.flags['purl']);
4736
4760
  const testScript = String(cli.flags['testScript'] || 'test');
4737
4761
  await handleFix({
@@ -4739,6 +4763,7 @@ async function run$H(argv, importMeta, {
4739
4763
  cwd,
4740
4764
  ghsas,
4741
4765
  limit,
4766
+ minSatisfying,
4742
4767
  outputKind,
4743
4768
  purls,
4744
4769
  rangeStyle,
@@ -7595,27 +7620,10 @@ async function updateLockfile(pkgEnvDetails, options) {
7595
7620
  };
7596
7621
  }
7597
7622
 
7598
- const {
7599
- VLT
7600
- } = constants;
7601
- async function applyOptimization(cwd, pin, prod) {
7602
- const result = await utils.detectAndValidatePackageEnvironment(cwd, {
7603
- cmdName: CMD_NAME,
7604
- logger: logger.logger,
7605
- prod
7606
- });
7607
- if (!result.ok) {
7608
- return result;
7609
- }
7610
- const pkgEnvDetails = result.data;
7611
- if (pkgEnvDetails.agent === VLT) {
7612
- return {
7613
- ok: false,
7614
- message: 'Unsupported',
7615
- cause: utils.cmdPrefixMessage(CMD_NAME, `${VLT} does not support overrides. Soon, though ⚡`)
7616
- };
7617
- }
7618
-
7623
+ async function applyOptimization(pkgEnvDetails, {
7624
+ pin,
7625
+ prod
7626
+ }) {
7619
7627
  // Lazily access constants.spinner.
7620
7628
  const {
7621
7629
  spinner
@@ -7683,14 +7691,49 @@ function createActionMessage(verb, overrideCount, workspaceCount) {
7683
7691
  return `${verb} ${overrideCount} Socket.dev optimized ${words.pluralize('override', overrideCount)}${workspaceCount ? ` in ${workspaceCount} ${words.pluralize('workspace', workspaceCount)}` : ''}`;
7684
7692
  }
7685
7693
 
7694
+ const {
7695
+ VLT
7696
+ } = constants;
7686
7697
  async function handleOptimize({
7687
7698
  cwd,
7688
7699
  outputKind,
7689
7700
  pin,
7690
7701
  prod
7691
7702
  }) {
7692
- const result = await applyOptimization(cwd, pin, prod);
7693
- await outputOptimizeResult(result, outputKind);
7703
+ const pkgEnvCResult = await utils.detectAndValidatePackageEnvironment(cwd, {
7704
+ cmdName: CMD_NAME,
7705
+ logger: logger.logger,
7706
+ prod
7707
+ });
7708
+ if (!pkgEnvCResult.ok) {
7709
+ await outputOptimizeResult(pkgEnvCResult, outputKind);
7710
+ return;
7711
+ }
7712
+ const pkgEnvDetails = pkgEnvCResult.data;
7713
+ if (!pkgEnvDetails) {
7714
+ await outputOptimizeResult({
7715
+ ok: false,
7716
+ message: 'No package found.',
7717
+ cause: `No valid package environment found for project path: ${cwd}`
7718
+ }, outputKind);
7719
+ return;
7720
+ }
7721
+ const {
7722
+ agent,
7723
+ agentVersion
7724
+ } = pkgEnvDetails;
7725
+ if (agent === VLT) {
7726
+ return {
7727
+ ok: false,
7728
+ message: 'Unsupported',
7729
+ cause: utils.cmdPrefixMessage(CMD_NAME, `${agent} v${agentVersion} does not support overrides. Soon, though ⚡`)
7730
+ };
7731
+ }
7732
+ logger.logger.info(`Optimizing packages for ${agent} v${agentVersion}.\n`);
7733
+ await outputOptimizeResult(await applyOptimization(pkgEnvDetails, {
7734
+ pin,
7735
+ prod
7736
+ }), outputKind);
7694
7737
  }
7695
7738
 
7696
7739
  const {
@@ -14184,5 +14227,5 @@ void (async () => {
14184
14227
  await utils.captureException(e);
14185
14228
  }
14186
14229
  })();
14187
- //# debugId=335a870f-91f1-494a-ab58-35161f055590
14230
+ //# debugId=32ad27b9-7ef0-4597-96b8-7dac14a0ff3e
14188
14231
  //# sourceMappingURL=cli.js.map