@socketsecurity/cli-with-sentry 1.0.18 → 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,
@@ -3876,7 +3877,10 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
3876
3877
  firstPatchedVersionIdentifier,
3877
3878
  vulnerableVersionRange
3878
3879
  } of infos) {
3879
- const newVersion = shadowNpmInject.findBestPatchVersion(node, availableVersions, vulnerableVersionRange);
3880
+ const newVersion = shadowNpmInject.findBestPatchVersion(node, availableVersions, {
3881
+ minSatisfying,
3882
+ vulnerableVersionRange
3883
+ });
3880
3884
  const newVersionPackument = newVersion ? packument.versions[newVersion] : undefined;
3881
3885
  if (!(newVersion && newVersionPackument)) {
3882
3886
  warningsForAfter.add(`${oldId} not updated: requires >=${firstPatchedVersionIdentifier}`);
@@ -4504,6 +4508,7 @@ async function handleFix({
4504
4508
  cwd,
4505
4509
  ghsas,
4506
4510
  limit,
4511
+ minSatisfying,
4507
4512
  outputKind,
4508
4513
  purls,
4509
4514
  rangeStyle,
@@ -4578,23 +4583,25 @@ async function handleFix({
4578
4583
  }, outputKind);
4579
4584
  return;
4580
4585
  }
4581
- logger.logger.info(`Fixing packages for ${pkgEnvDetails.agent} v${pkgEnvDetails.agentVersion}.\n`);
4582
4586
  const {
4583
- agent
4587
+ agent,
4588
+ agentVersion
4584
4589
  } = pkgEnvDetails;
4585
4590
  if (agent !== NPM$7 && agent !== PNPM$6) {
4586
4591
  await outputFixResult({
4587
4592
  ok: false,
4588
4593
  message: 'Not supported.',
4589
- cause: `${agent} is not supported by this command.`
4594
+ cause: `${agent} v${agentVersion} is not supported by this command.`
4590
4595
  }, outputKind);
4591
4596
  return;
4592
4597
  }
4598
+ logger.logger.info(`Fixing packages for ${agent} v${agentVersion}.\n`);
4593
4599
  const fixer = agent === NPM$7 ? npmFix : pnpmFix;
4594
4600
  await outputFixResult(await fixer(pkgEnvDetails, {
4595
4601
  autoMerge,
4596
4602
  cwd,
4597
4603
  limit,
4604
+ minSatisfying,
4598
4605
  purls,
4599
4606
  rangeStyle,
4600
4607
  spinner,
@@ -4633,6 +4640,17 @@ const config$H = {
4633
4640
  default: Infinity,
4634
4641
  description: 'The number of fixes to attempt at a time'
4635
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
+ },
4636
4654
  purl: {
4637
4655
  type: 'string',
4638
4656
  default: [],
@@ -4736,6 +4754,8 @@ async function run$H(argv, importMeta, {
4736
4754
  }
4737
4755
  const ghsas = utils.cmdFlagValueToArray(cli.flags['ghsa']);
4738
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;
4739
4759
  const purls = utils.cmdFlagValueToArray(cli.flags['purl']);
4740
4760
  const testScript = String(cli.flags['testScript'] || 'test');
4741
4761
  await handleFix({
@@ -4743,6 +4763,7 @@ async function run$H(argv, importMeta, {
4743
4763
  cwd,
4744
4764
  ghsas,
4745
4765
  limit,
4766
+ minSatisfying,
4746
4767
  outputKind,
4747
4768
  purls,
4748
4769
  rangeStyle,
@@ -7599,27 +7620,10 @@ async function updateLockfile(pkgEnvDetails, options) {
7599
7620
  };
7600
7621
  }
7601
7622
 
7602
- const {
7603
- VLT
7604
- } = constants;
7605
- async function applyOptimization(cwd, pin, prod) {
7606
- const result = await utils.detectAndValidatePackageEnvironment(cwd, {
7607
- cmdName: CMD_NAME,
7608
- logger: logger.logger,
7609
- prod
7610
- });
7611
- if (!result.ok) {
7612
- return result;
7613
- }
7614
- const pkgEnvDetails = result.data;
7615
- if (pkgEnvDetails.agent === VLT) {
7616
- return {
7617
- ok: false,
7618
- message: 'Unsupported',
7619
- cause: utils.cmdPrefixMessage(CMD_NAME, `${VLT} does not support overrides. Soon, though ⚡`)
7620
- };
7621
- }
7622
-
7623
+ async function applyOptimization(pkgEnvDetails, {
7624
+ pin,
7625
+ prod
7626
+ }) {
7623
7627
  // Lazily access constants.spinner.
7624
7628
  const {
7625
7629
  spinner
@@ -7687,14 +7691,49 @@ function createActionMessage(verb, overrideCount, workspaceCount) {
7687
7691
  return `${verb} ${overrideCount} Socket.dev optimized ${words.pluralize('override', overrideCount)}${workspaceCount ? ` in ${workspaceCount} ${words.pluralize('workspace', workspaceCount)}` : ''}`;
7688
7692
  }
7689
7693
 
7694
+ const {
7695
+ VLT
7696
+ } = constants;
7690
7697
  async function handleOptimize({
7691
7698
  cwd,
7692
7699
  outputKind,
7693
7700
  pin,
7694
7701
  prod
7695
7702
  }) {
7696
- const result = await applyOptimization(cwd, pin, prod);
7697
- 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);
7698
7737
  }
7699
7738
 
7700
7739
  const {
@@ -14188,5 +14227,5 @@ void (async () => {
14188
14227
  await utils.captureException(e);
14189
14228
  }
14190
14229
  })();
14191
- //# debugId=395a6b0d-069d-4973-b244-16aa28360e30
14230
+ //# debugId=32ad27b9-7ef0-4597-96b8-7dac14a0ff3e
14192
14231
  //# sourceMappingURL=cli.js.map