@socketsecurity/cli-with-sentry 1.1.49 → 1.1.51

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/bin/npm-cli.js +1 -1
  3. package/bin/npx-cli.js +2 -2
  4. package/dist/cli.js +100 -509
  5. package/dist/cli.js.map +1 -1
  6. package/dist/constants.js +6 -4
  7. package/dist/constants.js.map +1 -1
  8. package/dist/tsconfig.dts.tsbuildinfo +1 -1
  9. package/dist/types/commands/ci/handle-ci.d.mts.map +1 -1
  10. package/dist/types/commands/patch/cmd-patch.d.mts +1 -1
  11. package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -1
  12. package/dist/types/commands/scan/cmd-scan-create.d.mts.map +1 -1
  13. package/dist/types/commands/scan/cmd-scan-reach.d.mts.map +1 -1
  14. package/dist/types/commands/scan/output-scan-report.d.mts.map +1 -1
  15. package/dist/types/commands/scan/perform-reachability-analysis.d.mts +1 -0
  16. package/dist/types/commands/scan/perform-reachability-analysis.d.mts.map +1 -1
  17. package/dist/types/commands/scan/reachability-flags.d.mts.map +1 -1
  18. package/dist/types/commands.d.mts +1 -1
  19. package/dist/types/constants.d.mts +1 -0
  20. package/dist/types/constants.d.mts.map +1 -1
  21. package/dist/types/utils/config.d.mts +6 -0
  22. package/dist/types/utils/config.d.mts.map +1 -1
  23. package/dist/types/utils/editable-json.d.mts +63 -0
  24. package/dist/types/utils/editable-json.d.mts.map +1 -0
  25. package/dist/types/utils/package-environment.d.mts.map +1 -1
  26. package/dist/utils.js +482 -50
  27. package/dist/utils.js.map +1 -1
  28. package/dist/vendor.js +13495 -3663
  29. package/package.json +4 -3
  30. package/dist/types/commands/patch/handle-patch.d.mts +0 -12
  31. package/dist/types/commands/patch/handle-patch.d.mts.map +0 -1
  32. package/dist/types/commands/patch/manifest-schema.d.mts +0 -34
  33. package/dist/types/commands/patch/manifest-schema.d.mts.map +0 -1
  34. package/dist/types/commands/patch/output-patch-result.d.mts +0 -5
  35. package/dist/types/commands/patch/output-patch-result.d.mts.map +0 -1
package/dist/cli.js CHANGED
@@ -25,7 +25,6 @@ var registry = require('../external/@socketsecurity/registry');
25
25
  var packages = require('../external/@socketsecurity/registry/lib/packages');
26
26
  var require$$12 = require('../external/@socketsecurity/registry/lib/promises');
27
27
  var regexps = require('../external/@socketsecurity/registry/lib/regexps');
28
- var require$$0$1 = require('node:crypto');
29
28
  var require$$1 = require('node:util');
30
29
  var promises = require('node:stream/promises');
31
30
 
@@ -325,7 +324,7 @@ async function handleAnalytics({
325
324
  });
326
325
  }
327
326
 
328
- const CMD_NAME$y = 'analytics';
327
+ const CMD_NAME$x = 'analytics';
329
328
  const description$F = 'Look up analytics data';
330
329
  const hidden$x = false;
331
330
  const cmdAnalytics = {
@@ -337,7 +336,7 @@ async function run$S(argv, importMeta, {
337
336
  parentName
338
337
  }) {
339
338
  const config = {
340
- commandName: CMD_NAME$y,
339
+ commandName: CMD_NAME$x,
341
340
  description: description$F,
342
341
  hidden: hidden$x,
343
342
  flags: {
@@ -356,7 +355,7 @@ async function run$S(argv, importMeta, {
356
355
  $ ${command} [options] [ "org" | "repo" <reponame>] [TIME]
357
356
 
358
357
  API Token Requirements
359
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$y}`)}
358
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$x}`)}
360
359
 
361
360
  The scope is either org or repo level, defaults to org.
362
361
 
@@ -748,7 +747,7 @@ async function handleAuditLog({
748
747
  });
749
748
  }
750
749
 
751
- const CMD_NAME$x = 'audit-log';
750
+ const CMD_NAME$w = 'audit-log';
752
751
  const description$E = 'Look up the audit log for an organization';
753
752
  const hidden$w = false;
754
753
  const cmdAuditLog = {
@@ -760,7 +759,7 @@ async function run$R(argv, importMeta, {
760
759
  parentName
761
760
  }) {
762
761
  const config = {
763
- commandName: CMD_NAME$x,
762
+ commandName: CMD_NAME$w,
764
763
  description: description$E,
765
764
  hidden: hidden$w,
766
765
  flags: {
@@ -790,7 +789,7 @@ async function run$R(argv, importMeta, {
790
789
  $ ${command} [options] [FILTER]
791
790
 
792
791
  API Token Requirements
793
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$x}`)}
792
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$w}`)}
794
793
 
795
794
  This feature requires an Enterprise Plan. To learn more about getting access
796
795
  to this feature and many more, please visit the ${utils.webLink(`${constants.default.SOCKET_WEBSITE_URL}/pricing`, 'Socket pricing page')}.
@@ -1361,6 +1360,10 @@ async function outputScanReport(result, {
1361
1360
  logger.logger.fail(utils.failMsgWithBadge(scanReport.message, scanReport.cause));
1362
1361
  return;
1363
1362
  }
1363
+ if (!scanReport.data.healthy) {
1364
+ // When report contains healthy: false, process should exit with non-zero code.
1365
+ process.exitCode = 1;
1366
+ }
1364
1367
 
1365
1368
  // I don't think we emit the default error message with banner for an unhealthy report, do we?
1366
1369
  // if (!scanReport.data.healthy) {
@@ -1643,7 +1646,7 @@ async function performReachabilityAnalysis(options) {
1643
1646
  // Build Coana arguments.
1644
1647
  const coanaArgs = ['run', analysisTarget, '--output-dir', path.dirname(outputFilePath), '--socket-mode', outputFilePath, '--disable-report-submission', ...(reachabilityOptions.reachAnalysisTimeout ? ['--analysis-timeout', `${reachabilityOptions.reachAnalysisTimeout}`] : []), ...(reachabilityOptions.reachAnalysisMemoryLimit ? ['--memory-limit', `${reachabilityOptions.reachAnalysisMemoryLimit}`] : []), ...(reachabilityOptions.reachConcurrency ? ['--concurrency', `${reachabilityOptions.reachConcurrency}`] : []), ...(reachabilityOptions.reachDebug ? ['--debug'] : []), ...(reachabilityOptions.reachDisableAnalytics ? ['--disable-analytics-sharing'] : []), ...(reachabilityOptions.reachDisableAnalysisSplitting ? ['--disable-analysis-splitting'] : []), ...(tarHash ? ['--run-without-docker', '--manifests-tar-hash', tarHash] : []),
1645
1648
  // Empty reachEcosystems implies scanning all ecosystems.
1646
- ...(reachabilityOptions.reachEcosystems.length ? ['--purl-types', ...reachabilityOptions.reachEcosystems] : []), ...(reachabilityOptions.reachExcludePaths.length ? ['--exclude-dirs', ...reachabilityOptions.reachExcludePaths] : []), ...(reachabilityOptions.reachSkipCache ? ['--skip-cache-usage'] : []), ...(reachabilityOptions.reachUseOnlyPregeneratedSboms ? ['--use-only-pregenerated-sboms'] : [])];
1649
+ ...(reachabilityOptions.reachEcosystems.length ? ['--purl-types', ...reachabilityOptions.reachEcosystems] : []), ...(reachabilityOptions.reachExcludePaths.length ? ['--exclude-dirs', ...reachabilityOptions.reachExcludePaths] : []), ...(reachabilityOptions.reachLazyMode ? ['--lazy-mode'] : []), ...(reachabilityOptions.reachSkipCache ? ['--skip-cache-usage'] : []), ...(reachabilityOptions.reachUseOnlyPregeneratedSboms ? ['--use-only-pregenerated-sboms'] : [])];
1647
1650
 
1648
1651
  // Build environment variables.
1649
1652
  const coanaEnv = {};
@@ -2419,6 +2422,7 @@ async function handleCi(autoManifest) {
2419
2422
  reachDisableAnalytics: false,
2420
2423
  reachEcosystems: [],
2421
2424
  reachExcludePaths: [],
2425
+ reachLazyMode: false,
2422
2426
  reachSkipCache: false,
2423
2427
  reachUseOnlyPregeneratedSboms: false,
2424
2428
  reachVersion: undefined,
@@ -2716,7 +2720,7 @@ async function handleConfigAuto({
2716
2720
  await outputConfigAuto(key, result, outputKind);
2717
2721
  }
2718
2722
 
2719
- const CMD_NAME$w = 'auto';
2723
+ const CMD_NAME$v = 'auto';
2720
2724
  const description$D = 'Automatically discover and set the correct value config item';
2721
2725
  const hidden$v = false;
2722
2726
  const cmdConfigAuto = {
@@ -2728,7 +2732,7 @@ async function run$P(argv, importMeta, {
2728
2732
  parentName
2729
2733
  }) {
2730
2734
  const config = {
2731
- commandName: CMD_NAME$w,
2735
+ commandName: CMD_NAME$v,
2732
2736
  description: description$D,
2733
2737
  hidden: hidden$v,
2734
2738
  flags: {
@@ -3082,7 +3086,7 @@ async function handleConfigSet({
3082
3086
  await outputConfigSet(result, outputKind);
3083
3087
  }
3084
3088
 
3085
- const CMD_NAME$v = 'set';
3089
+ const CMD_NAME$u = 'set';
3086
3090
  const description$C = 'Update the value of a local CLI config item';
3087
3091
  const hidden$u = false;
3088
3092
  const cmdConfigSet = {
@@ -3094,7 +3098,7 @@ async function run$M(argv, importMeta, {
3094
3098
  parentName
3095
3099
  }) {
3096
3100
  const config = {
3097
- commandName: CMD_NAME$v,
3101
+ commandName: CMD_NAME$u,
3098
3102
  description: description$C,
3099
3103
  hidden: hidden$u,
3100
3104
  flags: {
@@ -3209,7 +3213,7 @@ async function handleConfigUnset({
3209
3213
  await outputConfigUnset(updateResult, outputKind);
3210
3214
  }
3211
3215
 
3212
- const CMD_NAME$u = 'unset';
3216
+ const CMD_NAME$t = 'unset';
3213
3217
  const description$B = 'Clear the value of a local CLI config item';
3214
3218
  const hidden$t = false;
3215
3219
  const cmdConfigUnset = {
@@ -3221,7 +3225,7 @@ async function run$L(argv, importMeta, {
3221
3225
  parentName
3222
3226
  }) {
3223
3227
  const config = {
3224
- commandName: CMD_NAME$u,
3228
+ commandName: CMD_NAME$t,
3225
3229
  description: description$B,
3226
3230
  hidden: hidden$t,
3227
3231
  flags: {
@@ -4277,7 +4281,7 @@ async function handleFix({
4277
4281
  }), outputKind);
4278
4282
  }
4279
4283
 
4280
- const CMD_NAME$t = 'fix';
4284
+ const CMD_NAME$s = 'fix';
4281
4285
  const DEFAULT_LIMIT = 10;
4282
4286
  const description$z = 'Fix CVEs in dependencies';
4283
4287
  const hidden$s = false;
@@ -4436,7 +4440,7 @@ async function run$K(argv, importMeta, {
4436
4440
  parentName
4437
4441
  }) {
4438
4442
  const config = {
4439
- commandName: CMD_NAME$t,
4443
+ commandName: CMD_NAME$s,
4440
4444
  description: description$z,
4441
4445
  hidden: hidden$s,
4442
4446
  flags: {
@@ -4450,7 +4454,7 @@ async function run$K(argv, importMeta, {
4450
4454
  $ ${command} [options] [CWD=.]
4451
4455
 
4452
4456
  API Token Requirements
4453
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$t}`)}
4457
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$s}`)}
4454
4458
 
4455
4459
  Options
4456
4460
  ${utils.getFlagListOutput({
@@ -4991,7 +4995,7 @@ async function attemptLogin(apiBaseUrl, apiProxy) {
4991
4995
  }
4992
4996
  }
4993
4997
 
4994
- const CMD_NAME$s = 'login';
4998
+ const CMD_NAME$r = 'login';
4995
4999
  const description$x = 'Setup Socket CLI with an API token and defaults';
4996
5000
  const hidden$r = false;
4997
5001
  const cmdLogin = {
@@ -5003,7 +5007,7 @@ async function run$H(argv, importMeta, {
5003
5007
  parentName
5004
5008
  }) {
5005
5009
  const config = {
5006
- commandName: CMD_NAME$s,
5010
+ commandName: CMD_NAME$r,
5007
5011
  description: description$x,
5008
5012
  hidden: hidden$r,
5009
5013
  flags: {
@@ -5024,7 +5028,7 @@ async function run$H(argv, importMeta, {
5024
5028
  $ ${command} [options]
5025
5029
 
5026
5030
  API Token Requirements
5027
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$s}`)}
5031
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$r}`)}
5028
5032
 
5029
5033
  Logs into the Socket API by prompting for an API token
5030
5034
 
@@ -6766,7 +6770,7 @@ async function run$y(argv, importMeta, {
6766
6770
  }
6767
6771
 
6768
6772
  const require$5 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
6769
- const CMD_NAME$r = constants.NPM;
6773
+ const CMD_NAME$q = constants.NPM;
6770
6774
  const description$w = 'Wraps npm with Socket security scanning';
6771
6775
  const hidden$q = false;
6772
6776
  const cmdNpm = {
@@ -6782,7 +6786,7 @@ async function run$x(argv, importMeta, context) {
6782
6786
  ...context
6783
6787
  };
6784
6788
  const config = {
6785
- commandName: CMD_NAME$r,
6789
+ commandName: CMD_NAME$q,
6786
6790
  description: description$w,
6787
6791
  hidden: hidden$q,
6788
6792
  flags: {
@@ -6793,7 +6797,7 @@ async function run$x(argv, importMeta, context) {
6793
6797
  $ ${command} ...
6794
6798
 
6795
6799
  API Token Requirements
6796
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$r}`)}
6800
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$q}`)}
6797
6801
 
6798
6802
  Note: Everything after "${constants.NPM}" is passed to the ${constants.NPM} command.
6799
6803
  Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
@@ -6852,7 +6856,7 @@ async function run$x(argv, importMeta, context) {
6852
6856
  }
6853
6857
 
6854
6858
  const require$4 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
6855
- const CMD_NAME$q = constants.NPX;
6859
+ const CMD_NAME$p = constants.NPX;
6856
6860
  const description$v = 'Wraps npx with Socket security scanning';
6857
6861
  const hidden$p = false;
6858
6862
  const cmdNpx = {
@@ -6864,7 +6868,7 @@ async function run$w(argv, importMeta, {
6864
6868
  parentName
6865
6869
  }) {
6866
6870
  const config = {
6867
- commandName: CMD_NAME$q,
6871
+ commandName: CMD_NAME$p,
6868
6872
  description: description$v,
6869
6873
  hidden: hidden$p,
6870
6874
  flags: {
@@ -6875,7 +6879,7 @@ async function run$w(argv, importMeta, {
6875
6879
  $ ${command} ...
6876
6880
 
6877
6881
  API Token Requirements
6878
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$q}`)}
6882
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$p}`)}
6879
6883
 
6880
6884
  Note: Everything after "${constants.NPX}" is passed to the ${constants.NPX} command.
6881
6885
  Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
@@ -7386,7 +7390,7 @@ async function listPackages(pkgEnvDetails, options) {
7386
7390
  }
7387
7391
  }
7388
7392
 
7389
- const CMD_NAME$p = 'socket optimize';
7393
+ const CMD_NAME$o = 'socket optimize';
7390
7394
 
7391
7395
  const {
7392
7396
  BUN,
@@ -7558,7 +7562,7 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
7558
7562
  npmExecPath === constants.NPM && !state.warnedPnpmWorkspaceRequiresNpm) {
7559
7563
  state.warnedPnpmWorkspaceRequiresNpm = true;
7560
7564
  spinner?.stop();
7561
- logger?.warn(utils.cmdPrefixMessage(CMD_NAME$p, `${agent} workspace support requires \`npm ls\`, falling back to \`${agent} list\``));
7565
+ logger?.warn(utils.cmdPrefixMessage(CMD_NAME$o, `${agent} workspace support requires \`npm ls\`, falling back to \`${agent} list\``));
7562
7566
  spinner?.start();
7563
7567
  }
7564
7568
  const overridesDataObjects = [];
@@ -7786,7 +7790,7 @@ async function applyOptimization(pkgEnvDetails, {
7786
7790
  const pkgJsonChanged = addedCount > 0 || updatedCount > 0;
7787
7791
  if (pkgJsonChanged || pkgEnvDetails.features.npmBuggyOverrides) {
7788
7792
  const result = await updateLockfile(pkgEnvDetails, {
7789
- cmdName: CMD_NAME$p,
7793
+ cmdName: CMD_NAME$o,
7790
7794
  logger: logger.logger,
7791
7795
  spinner
7792
7796
  });
@@ -7855,7 +7859,7 @@ async function handleOptimize({
7855
7859
  prod
7856
7860
  });
7857
7861
  const pkgEnvCResult = await utils.detectAndValidatePackageEnvironment(cwd, {
7858
- cmdName: CMD_NAME$p,
7862
+ cmdName: CMD_NAME$o,
7859
7863
  logger: logger.logger,
7860
7864
  prod
7861
7865
  });
@@ -7893,7 +7897,7 @@ async function handleOptimize({
7893
7897
  await outputOptimizeResult({
7894
7898
  ok: false,
7895
7899
  message: 'Unsupported',
7896
- cause: utils.cmdPrefixMessage(CMD_NAME$p, `${agent} v${agentVersion} does not support overrides.`)
7900
+ cause: utils.cmdPrefixMessage(CMD_NAME$o, `${agent} v${agentVersion} does not support overrides.`)
7897
7901
  }, outputKind);
7898
7902
  return;
7899
7903
  }
@@ -7913,7 +7917,7 @@ async function handleOptimize({
7913
7917
  await outputOptimizeResult(optimizationResult, outputKind);
7914
7918
  }
7915
7919
 
7916
- const CMD_NAME$o = 'optimize';
7920
+ const CMD_NAME$n = 'optimize';
7917
7921
  const description$u = 'Optimize dependencies with @socketregistry overrides';
7918
7922
  const hidden$o = false;
7919
7923
  const cmdOptimize = {
@@ -7925,7 +7929,7 @@ async function run$u(argv, importMeta, {
7925
7929
  parentName
7926
7930
  }) {
7927
7931
  const config = {
7928
- commandName: CMD_NAME$o,
7932
+ commandName: CMD_NAME$n,
7929
7933
  description: description$u,
7930
7934
  hidden: hidden$o,
7931
7935
  flags: {
@@ -7946,7 +7950,7 @@ async function run$u(argv, importMeta, {
7946
7950
  $ ${command} [options] [CWD=.]
7947
7951
 
7948
7952
  API Token Requirements
7949
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$o}`)}
7953
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$n}`)}
7950
7954
 
7951
7955
  Options
7952
7956
  ${utils.getFlagListOutput(config.flags)}
@@ -8099,7 +8103,7 @@ async function handleDependencies({
8099
8103
  });
8100
8104
  }
8101
8105
 
8102
- const CMD_NAME$n = 'dependencies';
8106
+ const CMD_NAME$m = 'dependencies';
8103
8107
  const description$t = 'Search for any dependency that is being used in your organization';
8104
8108
  const hidden$n = false;
8105
8109
  const cmdOrganizationDependencies = {
@@ -8111,7 +8115,7 @@ async function run$t(argv, importMeta, {
8111
8115
  parentName
8112
8116
  }) {
8113
8117
  const config = {
8114
- commandName: CMD_NAME$n,
8118
+ commandName: CMD_NAME$m,
8115
8119
  description: description$t,
8116
8120
  hidden: hidden$n,
8117
8121
  flags: {
@@ -8133,7 +8137,7 @@ async function run$t(argv, importMeta, {
8133
8137
  ${command} [options]
8134
8138
 
8135
8139
  API Token Requirements
8136
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$n}`)}
8140
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$m}`)}
8137
8141
 
8138
8142
  Options
8139
8143
  ${utils.getFlagListOutput(config.flags)}
@@ -8233,7 +8237,7 @@ async function handleLicensePolicy(orgSlug, outputKind) {
8233
8237
  await outputLicensePolicy(data, outputKind);
8234
8238
  }
8235
8239
 
8236
- const CMD_NAME$m = 'license';
8240
+ const CMD_NAME$l = 'license';
8237
8241
  const description$s = 'Retrieve the license policy of an organization';
8238
8242
  const hidden$m = false;
8239
8243
  const cmdOrganizationPolicyLicense = {
@@ -8245,7 +8249,7 @@ async function run$s(argv, importMeta, {
8245
8249
  parentName
8246
8250
  }) {
8247
8251
  const config = {
8248
- commandName: CMD_NAME$m,
8252
+ commandName: CMD_NAME$l,
8249
8253
  description: description$s,
8250
8254
  hidden: hidden$m,
8251
8255
  flags: {
@@ -8266,7 +8270,7 @@ async function run$s(argv, importMeta, {
8266
8270
  $ ${command} [options]
8267
8271
 
8268
8272
  API Token Requirements
8269
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$m}`)}
8273
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$l}`)}
8270
8274
 
8271
8275
  Options
8272
8276
  ${utils.getFlagListOutput(config.flags)}
@@ -8369,7 +8373,7 @@ async function handleSecurityPolicy(orgSlug, outputKind) {
8369
8373
  await outputSecurityPolicy(data, outputKind);
8370
8374
  }
8371
8375
 
8372
- const CMD_NAME$l = 'security';
8376
+ const CMD_NAME$k = 'security';
8373
8377
  const description$r = 'Retrieve the security policy of an organization';
8374
8378
  const hidden$l = true;
8375
8379
  const cmdOrganizationPolicySecurity = {
@@ -8381,7 +8385,7 @@ async function run$r(argv, importMeta, {
8381
8385
  parentName
8382
8386
  }) {
8383
8387
  const config = {
8384
- commandName: CMD_NAME$l,
8388
+ commandName: CMD_NAME$k,
8385
8389
  description: description$r,
8386
8390
  hidden: hidden$l,
8387
8391
  flags: {
@@ -8402,7 +8406,7 @@ async function run$r(argv, importMeta, {
8402
8406
  $ ${command} [options]
8403
8407
 
8404
8408
  API Token Requirements
8405
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$l}`)}
8409
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$k}`)}
8406
8410
 
8407
8411
  Options
8408
8412
  ${utils.getFlagListOutput(config.flags)}
@@ -8514,7 +8518,7 @@ async function handleOrganizationList(outputKind = 'text') {
8514
8518
  await outputOrganizationList(data, outputKind);
8515
8519
  }
8516
8520
 
8517
- const CMD_NAME$k = 'list';
8521
+ const CMD_NAME$j = 'list';
8518
8522
  const description$q = 'List organizations associated with the Socket API token';
8519
8523
  const hidden$k = false;
8520
8524
  const cmdOrganizationList = {
@@ -8526,7 +8530,7 @@ async function run$q(argv, importMeta, {
8526
8530
  parentName
8527
8531
  }) {
8528
8532
  const config = {
8529
- commandName: CMD_NAME$k,
8533
+ commandName: CMD_NAME$j,
8530
8534
  description: description$q,
8531
8535
  hidden: hidden$k,
8532
8536
  flags: {
@@ -8538,7 +8542,7 @@ async function run$q(argv, importMeta, {
8538
8542
  $ ${command} [options]
8539
8543
 
8540
8544
  API Token Requirements
8541
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$k}`)}
8545
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$j}`)}
8542
8546
 
8543
8547
  Options
8544
8548
  ${utils.getFlagListOutput(config.flags)}
@@ -8980,7 +8984,7 @@ function parsePackageSpecifiers(ecosystem, pkgs) {
8980
8984
  };
8981
8985
  }
8982
8986
 
8983
- const CMD_NAME$j = 'score';
8987
+ const CMD_NAME$i = 'score';
8984
8988
  const description$n = 'Look up score for one package which reflects all of its transitive dependencies as well';
8985
8989
  const hidden$j = false;
8986
8990
  const cmdPackageScore = {
@@ -8992,7 +8996,7 @@ async function run$o(argv, importMeta, {
8992
8996
  parentName
8993
8997
  }) {
8994
8998
  const config = {
8995
- commandName: CMD_NAME$j,
8999
+ commandName: CMD_NAME$i,
8996
9000
  description: description$n,
8997
9001
  hidden: hidden$j,
8998
9002
  flags: {
@@ -9004,7 +9008,7 @@ async function run$o(argv, importMeta, {
9004
9008
  $ ${command} [options] <<ECOSYSTEM> <NAME> | <PURL>>
9005
9009
 
9006
9010
  API Token Requirements
9007
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$j}`)}
9011
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$i}`)}
9008
9012
 
9009
9013
  Options
9010
9014
  ${utils.getFlagListOutput(config.flags)}
@@ -9371,7 +9375,7 @@ async function handlePurlsShallowScore({
9371
9375
  outputPurlsShallowScore(purls, packageData, outputKind);
9372
9376
  }
9373
9377
 
9374
- const CMD_NAME$i = 'shallow';
9378
+ const CMD_NAME$h = 'shallow';
9375
9379
  const description$m = 'Look up info regarding one or more packages but not their transitives';
9376
9380
  const hidden$i = false;
9377
9381
  const cmdPackageShallow = {
@@ -9390,7 +9394,7 @@ async function run$n(argv, importMeta, {
9390
9394
  parentName
9391
9395
  }) {
9392
9396
  const config = {
9393
- commandName: CMD_NAME$i,
9397
+ commandName: CMD_NAME$h,
9394
9398
  description: description$m,
9395
9399
  hidden: hidden$i,
9396
9400
  flags: {
@@ -9402,7 +9406,7 @@ async function run$n(argv, importMeta, {
9402
9406
  $ ${command} [options] <<ECOSYSTEM> <PKGNAME> [<PKGNAME> ...] | <PURL> [<PURL> ...]>
9403
9407
 
9404
9408
  API Token Requirements
9405
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$i}`)}
9409
+ ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$h}`)}
9406
9410
 
9407
9411
  Options
9408
9412
  ${utils.getFlagListOutput(config.flags)}
@@ -9504,472 +9508,48 @@ const cmdPackage = {
9504
9508
  }
9505
9509
  };
9506
9510
 
9507
- const PatchRecordSchema = vendor.object({
9508
- exportedAt: vendor.string(),
9509
- files: vendor.record(vendor.string(),
9510
- // File path
9511
- vendor.object({
9512
- beforeHash: vendor.string(),
9513
- afterHash: vendor.string()
9514
- })),
9515
- vulnerabilities: vendor.record(vendor.string(),
9516
- // Vulnerability ID like "GHSA-jrhj-2j3q-xf3v"
9517
- vendor.object({
9518
- cves: vendor.array(vendor.string()),
9519
- summary: vendor.string(),
9520
- severity: vendor.string(),
9521
- description: vendor.string(),
9522
- patchExplanation: vendor.string()
9523
- }))
9524
- });
9525
- const PatchManifestSchema = vendor.object({
9526
- patches: vendor.record(
9527
- // Package identifier like "npm:simplehttpserver@0.0.6".
9528
- vendor.string(), PatchRecordSchema)
9529
- });
9530
-
9531
- async function outputPatchResult(result, outputKind) {
9532
- if (!result.ok) {
9533
- process.exitCode = result.code ?? 1;
9534
- }
9535
- if (outputKind === constants.OUTPUT_JSON) {
9536
- logger.logger.log(utils.serializeResultJson(result));
9537
- return;
9538
- }
9539
- if (!result.ok) {
9540
- logger.logger.fail(utils.failMsgWithBadge(result.message, result.cause));
9541
- return;
9542
- }
9511
+ const description$k = 'Manage CVE patches for dependencies';
9512
+ const hidden$h = false;
9513
+ const cmdPatch = {
9514
+ description: description$k,
9515
+ hidden: hidden$h,
9516
+ run: run$m
9517
+ };
9518
+ async function run$m(argv, _importMeta, _context) {
9543
9519
  const {
9544
- patched
9545
- } = result.data;
9546
- logger.logger.log('');
9547
- if (patched.length) {
9548
- logger.logger.group(`Successfully processed patches for ${patched.length} ${words.pluralize('package', patched.length)}:`);
9549
- for (const pkg of patched) {
9550
- logger.logger.success(pkg);
9551
- }
9552
- logger.logger.groupEnd();
9553
- } else {
9554
- logger.logger.warn('No packages found requiring patches.');
9555
- }
9556
- logger.logger.log('');
9557
- logger.logger.success('Patch command completed!');
9558
- }
9520
+ ENV
9521
+ } = constants.default;
9559
9522
 
9560
- async function applyNpmPatches(socketDir, patches, options) {
9561
- const {
9562
- cwd = process.cwd(),
9563
- dryRun = false,
9564
- purlObjs,
9565
- spinner
9566
- } = {
9567
- __proto__: null,
9568
- ...options
9569
- };
9570
- const wasSpinning = !!spinner?.isSpinning;
9571
- spinner?.start();
9572
- const patchLookup = new Map();
9573
- for (const patchInfo of patches) {
9574
- patchLookup.set(patchInfo.purl, patchInfo);
9575
- }
9576
- const nmPaths = await findNodeModulesPaths(cwd);
9577
- spinner?.stop();
9578
- logger.logger.log(`Found ${nmPaths.length} ${constants.NODE_MODULES} ${words.pluralize('folder', nmPaths.length)}`);
9579
- logger.logger.group('');
9580
- spinner?.start();
9581
- const result = {
9582
- passed: [],
9583
- failed: []
9584
- };
9585
- for (const nmPath of nmPaths) {
9586
- // eslint-disable-next-line no-await-in-loop
9587
- const dirNames = await fs$2.readDirNames(nmPath);
9588
- for (const dirName of dirNames) {
9589
- const isScoped = dirName.startsWith('@');
9590
- const pkgPath = path.join(nmPath, dirName);
9591
- const pkgSubNames = isScoped ?
9592
- // eslint-disable-next-line no-await-in-loop
9593
- await fs$2.readDirNames(pkgPath) : [dirName];
9594
- for (const pkgSubName of pkgSubNames) {
9595
- const dirFullName = isScoped ? `${dirName}/${pkgSubName}` : pkgSubName;
9596
- const pkgPath = path.join(nmPath, dirFullName);
9597
- // eslint-disable-next-line no-await-in-loop
9598
- const pkgJson = await packages.readPackageJson(pkgPath, {
9599
- throws: false
9600
- });
9601
- if (!strings.isNonEmptyString(pkgJson?.name) || !strings.isNonEmptyString(pkgJson?.version)) {
9602
- continue;
9603
- }
9604
- const purl = `pkg:npm/${pkgJson.name}@${pkgJson.version}`;
9605
- const purlObj = utils.getPurlObject(purl, {
9606
- throws: false
9607
- });
9608
- if (!purlObj) {
9609
- continue;
9610
- }
9523
+ // Map socket-cli environment to socket-patch options.
9524
+ // Only include properties with defined values (exactOptionalPropertyTypes).
9525
+ const options = {};
9611
9526
 
9612
- // Skip if specific packages requested and this isn't one of them
9613
- if (purlObjs?.length && purlObjs.findIndex(p => p.type === constants.NPM && p.namespace === purlObj.namespace && p.name === purlObj.name) === -1) {
9614
- continue;
9615
- }
9616
- const patchInfo = patchLookup.get(purl);
9617
- if (!patchInfo) {
9618
- continue;
9619
- }
9620
- spinner?.stop();
9621
- logger.logger.log(`Found match: ${pkgJson.name}@${pkgJson.version} at ${pkgPath}`);
9622
- logger.logger.log(`Patch key: ${patchInfo.key}`);
9623
- logger.logger.group(`Processing files:`);
9624
- spinner?.start();
9625
- let passed = true;
9626
- for (const {
9627
- 0: fileName,
9628
- 1: fileInfo
9629
- } of Object.entries(patchInfo.patch.files)) {
9630
- // eslint-disable-next-line no-await-in-loop
9631
- const filePatchPassed = await processFilePatch(pkgPath, fileName, fileInfo, socketDir, {
9632
- dryRun,
9633
- spinner
9634
- });
9635
- if (!filePatchPassed) {
9636
- passed = false;
9637
- }
9638
- }
9639
- logger.logger.groupEnd();
9640
- if (passed) {
9641
- result.passed.push(purl);
9642
- } else {
9643
- result.failed.push(purl);
9644
- }
9645
- }
9646
- }
9527
+ // Strip /v0/ suffix from API URL if present.
9528
+ const apiUrl = ENV.SOCKET_CLI_API_BASE_URL?.replace(/\/v0\/?$/, '');
9529
+ if (apiUrl) {
9530
+ options.apiUrl = apiUrl;
9647
9531
  }
9648
- spinner?.stop();
9649
- logger.logger.groupEnd();
9650
- if (wasSpinning) {
9651
- spinner.start();
9532
+ if (ENV.SOCKET_CLI_API_TOKEN) {
9533
+ options.apiToken = ENV.SOCKET_CLI_API_TOKEN;
9652
9534
  }
9653
- return result;
9654
- }
9655
-
9656
- /**
9657
- * Compute SHA256 hash of file contents.
9658
- */
9659
- async function computeSHA256(filepath) {
9660
- try {
9661
- const content = await fs$1.promises.readFile(filepath);
9662
- const hash = require$$0$1.createHash('sha256');
9663
- hash.update(content);
9664
- return {
9665
- ok: true,
9666
- data: hash.digest('hex')
9667
- };
9668
- } catch (e) {
9669
- return {
9670
- ok: false,
9671
- message: 'Failed to compute file hash',
9672
- cause: `Unable to read file ${filepath}: ${utils.getErrorCause(e)}`
9673
- };
9535
+ if (ENV.SOCKET_CLI_ORG_SLUG) {
9536
+ options.orgSlug = ENV.SOCKET_CLI_ORG_SLUG;
9674
9537
  }
9675
- }
9676
- async function findNodeModulesPaths(cwd) {
9677
- const rootNmPath = await utils.findUp(constants.NODE_MODULES, {
9678
- cwd,
9679
- onlyDirectories: true
9680
- });
9681
- if (!rootNmPath) {
9682
- return [];
9538
+ if (ENV.SOCKET_PATCH_PROXY_URL) {
9539
+ options.patchProxyUrl = ENV.SOCKET_PATCH_PROXY_URL;
9683
9540
  }
9684
- return await vendor.outExports.glob([`**/${constants.NODE_MODULES}`], {
9685
- absolute: true,
9686
- cwd: path.dirname(rootNmPath),
9687
- dot: true,
9688
- followSymbolicLinks: false,
9689
- onlyDirectories: true
9690
- });
9691
- }
9692
- async function processFilePatch(pkgPath, fileName, fileInfo, socketDir, options) {
9693
- const {
9694
- dryRun,
9695
- spinner
9696
- } = {
9697
- __proto__: null,
9698
- ...options
9699
- };
9700
- const wasSpinning = !!spinner?.isSpinning;
9701
- spinner?.stop();
9702
- const filepath = path.join(pkgPath, fileName);
9703
- if (!fs$1.existsSync(filepath)) {
9704
- logger.logger.log(`File not found: ${fileName}`);
9705
- if (wasSpinning) {
9706
- spinner?.start();
9707
- }
9708
- return false;
9541
+ if (ENV.SOCKET_CLI_API_PROXY) {
9542
+ options.httpProxy = ENV.SOCKET_CLI_API_PROXY;
9709
9543
  }
9710
- const currentHashResult = await computeSHA256(filepath);
9711
- if (!currentHashResult.ok) {
9712
- logger.logger.log(`Failed to compute hash for: ${fileName}: ${currentHashResult.cause || currentHashResult.message}`);
9713
- if (wasSpinning) {
9714
- spinner?.start();
9715
- }
9716
- return false;
9717
- }
9718
- if (currentHashResult.data === fileInfo.afterHash) {
9719
- logger.logger.success(`File already patched: ${fileName}`);
9720
- logger.logger.group();
9721
- logger.logger.log(`Current hash: ${currentHashResult.data}`);
9722
- logger.logger.groupEnd();
9723
- if (wasSpinning) {
9724
- spinner?.start();
9725
- }
9726
- return true;
9727
- }
9728
- if (currentHashResult.data !== fileInfo.beforeHash) {
9729
- logger.logger.fail(`File hash mismatch: ${fileName}`);
9730
- logger.logger.group();
9731
- logger.logger.log(`Expected: ${fileInfo.beforeHash}`);
9732
- logger.logger.log(`Current: ${currentHashResult.data}`);
9733
- logger.logger.log(`Target: ${fileInfo.afterHash}`);
9734
- logger.logger.groupEnd();
9735
- if (wasSpinning) {
9736
- spinner?.start();
9737
- }
9738
- return false;
9739
- }
9740
- logger.logger.success(`File matches expected hash: ${fileName}`);
9741
- logger.logger.group();
9742
- logger.logger.log(`Current hash: ${currentHashResult.data}`);
9743
- logger.logger.log(`Ready to patch to: ${fileInfo.afterHash}`);
9744
- logger.logger.group();
9745
- if (dryRun) {
9746
- logger.logger.log(`(dry run - no changes made)`);
9747
- logger.logger.groupEnd();
9748
- logger.logger.groupEnd();
9749
- if (wasSpinning) {
9750
- spinner?.start();
9751
- }
9752
- return false;
9753
- }
9754
- const blobPath = path.join(socketDir, 'blobs', fileInfo.afterHash);
9755
- if (!fs$1.existsSync(blobPath)) {
9756
- logger.logger.fail(`Error: Patch file not found at ${blobPath}`);
9757
- logger.logger.groupEnd();
9758
- logger.logger.groupEnd();
9759
- if (wasSpinning) {
9760
- spinner?.start();
9761
- }
9762
- return false;
9763
- }
9764
- spinner?.start();
9765
- let result = true;
9766
- try {
9767
- await fs$1.promises.copyFile(blobPath, filepath);
9768
-
9769
- // Verify the hash after copying to ensure file integrity.
9770
- const verifyHashResult = await computeSHA256(filepath);
9771
- if (!verifyHashResult.ok) {
9772
- logger.logger.error(`Failed to verify hash after patch: ${verifyHashResult.cause || verifyHashResult.message}`);
9773
- result = false;
9774
- } else if (verifyHashResult.data !== fileInfo.afterHash) {
9775
- logger.logger.error(`Hash verification failed after patch`);
9776
- logger.logger.group();
9777
- logger.logger.log(`Expected: ${fileInfo.afterHash}`);
9778
- logger.logger.log(`Got: ${verifyHashResult.data}`);
9779
- logger.logger.groupEnd();
9780
- result = false;
9781
- } else {
9782
- logger.logger.success(`Patch applied successfully`);
9783
- }
9784
- } catch (e) {
9785
- logger.logger.error('Error applying patch');
9786
- require$$9.debugDir('error', e);
9787
- result = false;
9788
- }
9789
- logger.logger.groupEnd();
9790
- logger.logger.groupEnd();
9791
- spinner?.stop();
9792
- if (wasSpinning) {
9793
- spinner?.start();
9544
+ if (ENV.SOCKET_CLI_DEBUG) {
9545
+ options.debug = ENV.SOCKET_CLI_DEBUG;
9794
9546
  }
9795
- return result;
9796
- }
9797
- async function handlePatch({
9798
- cwd,
9799
- dryRun,
9800
- outputKind,
9801
- purlObjs,
9802
- spinner
9803
- }) {
9804
- try {
9805
- const dotSocketDirPath = path.join(cwd, constants.DOT_SOCKET_DIR);
9806
- const manifestPath = path.join(dotSocketDirPath, constants.MANIFEST_JSON);
9807
- const manifestContent = await fs$1.promises.readFile(manifestPath, constants.UTF8);
9808
- const manifestData = JSON.parse(manifestContent);
9809
- const purls = purlObjs.map(String);
9810
- const validated = PatchManifestSchema.parse(manifestData);
9811
-
9812
- // Parse PURLs and group by ecosystem.
9813
- const patchesByEcosystem = new Map();
9814
- for (const {
9815
- 0: key,
9816
- 1: patch
9817
- } of Object.entries(validated.patches)) {
9818
- const purl = utils.normalizePurl(key);
9819
- if (purls.length && !purls.includes(purl)) {
9820
- continue;
9821
- }
9822
- const purlObj = utils.getPurlObject(purl, {
9823
- throws: false
9824
- });
9825
- if (!purlObj) {
9826
- continue;
9827
- }
9828
- let patches = patchesByEcosystem.get(purlObj.type);
9829
- if (!Array.isArray(patches)) {
9830
- patches = [];
9831
- patchesByEcosystem.set(purlObj.type, patches);
9832
- }
9833
- patches.push({
9834
- key,
9835
- patch,
9836
- purl,
9837
- purlObj
9838
- });
9839
- }
9840
- if (purls.length) {
9841
- spinner.start(`Checking patches for: ${arrays.joinAnd(purls)}`);
9842
- } else {
9843
- spinner.start('Scanning all dependencies for available patches');
9844
- }
9845
- const patched = [];
9846
- const npmPatches = patchesByEcosystem.get(constants.NPM);
9847
- if (npmPatches) {
9848
- const patchingResults = await applyNpmPatches(dotSocketDirPath, npmPatches, {
9849
- cwd,
9850
- dryRun,
9851
- purlObjs,
9852
- spinner
9853
- });
9854
- patched.push(...patchingResults.passed);
9855
- }
9856
- spinner.stop();
9857
- await outputPatchResult({
9858
- ok: true,
9859
- data: {
9860
- patched
9861
- }
9862
- }, outputKind);
9863
- } catch (e) {
9864
- spinner.stop();
9865
- let message = 'Failed to apply patches';
9866
- let cause = utils.getErrorCause(e);
9867
- if (e instanceof SyntaxError) {
9868
- message = `Invalid JSON in ${constants.MANIFEST_JSON}`;
9869
- cause = e.message;
9870
- } else if (e instanceof Error && 'issues' in e) {
9871
- message = 'Schema validation failed';
9872
- cause = String(e);
9873
- }
9874
- await outputPatchResult({
9875
- ok: false,
9876
- code: 1,
9877
- message,
9878
- cause
9879
- }, outputKind);
9880
- }
9881
- }
9882
9547
 
9883
- const CMD_NAME$h = 'patch';
9884
- const description$k = 'Apply CVE patches to dependencies';
9885
- const hidden$h = true;
9886
- const cmdPatch = {
9887
- description: description$k,
9888
- hidden: hidden$h,
9889
- run: run$m
9890
- };
9891
- async function run$m(argv, importMeta, {
9892
- parentName
9893
- }) {
9894
- const config = {
9895
- commandName: CMD_NAME$h,
9896
- description: description$k,
9897
- hidden: hidden$h,
9898
- flags: {
9899
- ...flags.commonFlags,
9900
- ...flags.outputFlags,
9901
- purl: {
9902
- type: 'string',
9903
- default: [],
9904
- description: 'Specify purls to patch, as either a comma separated value or as multiple flags',
9905
- isMultiple: true,
9906
- shortFlag: 'p'
9907
- }
9908
- },
9909
- help: (command, config) => `
9910
- Usage
9911
- $ ${command} [options] [CWD=.]
9912
-
9913
- API Token Requirements
9914
- ${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$h}`)}
9915
-
9916
- Options
9917
- ${utils.getFlagListOutput(config.flags)}
9918
-
9919
- Examples
9920
- $ ${command}
9921
- $ ${command} --package lodash
9922
- $ ${command} ./path/to/project --package lodash,react
9923
- `
9924
- };
9925
- const cli = utils.meowOrExit({
9926
- argv,
9927
- config,
9928
- parentName,
9929
- importMeta
9930
- }, {
9931
- allowUnknownFlags: false
9932
- });
9933
- const {
9934
- dryRun,
9935
- json,
9936
- markdown
9937
- } = cli.flags;
9938
- const outputKind = utils.getOutputKind(json, markdown);
9939
- const wasValidInput = utils.checkCommandInput(outputKind, {
9940
- nook: true,
9941
- test: !json || !markdown,
9942
- message: 'The json and markdown flags cannot be both set, pick one',
9943
- fail: 'omit one'
9944
- });
9945
- if (!wasValidInput) {
9946
- return;
9548
+ // Forward all arguments to socket-patch.
9549
+ const exitCode = await vendor.runExports.runPatch([...argv], options);
9550
+ if (exitCode !== 0) {
9551
+ process.exitCode = exitCode;
9947
9552
  }
9948
- let [cwd = '.'] = cli.input;
9949
- // Note: path.resolve vs .join:
9950
- // If given path is absolute then cwd should not affect it.
9951
- cwd = path.resolve(process.cwd(), cwd);
9952
- const dotSocketDirPath = path.join(cwd, constants.DOT_SOCKET_DIR);
9953
- if (!fs$1.existsSync(dotSocketDirPath)) {
9954
- throw new utils.InputError(`No ${constants.DOT_SOCKET_DIR} directory found in current directory`);
9955
- }
9956
- const manifestPath = path.join(dotSocketDirPath, constants.MANIFEST_JSON);
9957
- if (!fs$1.existsSync(manifestPath)) {
9958
- throw new utils.InputError(`No ${constants.MANIFEST_JSON} found in ${constants.DOT_SOCKET_DIR} directory`);
9959
- }
9960
- const {
9961
- spinner
9962
- } = constants.default;
9963
- const purlObjs = arrays.arrayUnique(utils.cmdFlagValueToArray(cli.flags['purl'])).map(p => utils.getPurlObject(p, {
9964
- throws: false
9965
- })).filter(Boolean);
9966
- await handlePatch({
9967
- cwd,
9968
- dryRun,
9969
- outputKind,
9970
- purlObjs,
9971
- spinner
9972
- });
9973
9553
  }
9974
9554
 
9975
9555
  const require$3 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
@@ -11247,6 +10827,12 @@ const reachabilityFlags = {
11247
10827
  isMultiple: true,
11248
10828
  description: 'List of paths to exclude from reachability analysis, as either a comma separated value or as multiple flags.'
11249
10829
  },
10830
+ reachLazyMode: {
10831
+ type: 'boolean',
10832
+ default: false,
10833
+ description: 'Enable lazy mode for reachability analysis.',
10834
+ hidden: true
10835
+ },
11250
10836
  reachSkipCache: {
11251
10837
  type: 'boolean',
11252
10838
  default: false,
@@ -11499,6 +11085,7 @@ async function run$d(argv, importMeta, {
11499
11085
  reachDebug,
11500
11086
  reachDisableAnalysisSplitting,
11501
11087
  reachDisableAnalytics,
11088
+ reachLazyMode,
11502
11089
  reachSkipCache,
11503
11090
  reachUseOnlyPregeneratedSboms,
11504
11091
  reachVersion,
@@ -11630,7 +11217,7 @@ async function run$d(argv, importMeta, {
11630
11217
  const isUsingNonDefaultConcurrency = reachConcurrency !== reachabilityFlags['reachConcurrency']?.default;
11631
11218
  const isUsingNonDefaultAnalytics = reachDisableAnalytics !== reachabilityFlags['reachDisableAnalytics']?.default;
11632
11219
  const isUsingNonDefaultVersion = reachVersion !== reachabilityFlags['reachVersion']?.default;
11633
- const isUsingAnyReachabilityFlags = hasReachEcosystems || hasReachExcludePaths || isUsingNonDefaultAnalytics || isUsingNonDefaultConcurrency || isUsingNonDefaultMemoryLimit || isUsingNonDefaultTimeout || isUsingNonDefaultVersion || reachDisableAnalysisSplitting || reachSkipCache || reachUseOnlyPregeneratedSboms;
11220
+ const isUsingAnyReachabilityFlags = hasReachEcosystems || hasReachExcludePaths || isUsingNonDefaultAnalytics || isUsingNonDefaultConcurrency || isUsingNonDefaultMemoryLimit || isUsingNonDefaultTimeout || isUsingNonDefaultVersion || reachDisableAnalysisSplitting || reachLazyMode || reachSkipCache || reachUseOnlyPregeneratedSboms;
11634
11221
 
11635
11222
  // Validate target constraints when --reach is enabled.
11636
11223
  const reachTargetValidation = reach ? await validateReachabilityTarget(targets, cwd) : {
@@ -11723,6 +11310,7 @@ async function run$d(argv, importMeta, {
11723
11310
  reachDisableAnalytics: Boolean(reachDisableAnalytics),
11724
11311
  reachEcosystems,
11725
11312
  reachExcludePaths,
11313
+ reachLazyMode: Boolean(reachLazyMode),
11726
11314
  reachSkipCache: Boolean(reachSkipCache),
11727
11315
  reachUseOnlyPregeneratedSboms: Boolean(reachUseOnlyPregeneratedSboms),
11728
11316
  reachVersion,
@@ -12373,6 +11961,7 @@ async function scanOneRepo(repoSlug, {
12373
11961
  reachDisableAnalytics: false,
12374
11962
  reachEcosystems: [],
12375
11963
  reachExcludePaths: [],
11964
+ reachLazyMode: false,
12376
11965
  reachSkipCache: false,
12377
11966
  reachUseOnlyPregeneratedSboms: false,
12378
11967
  reachVersion: undefined,
@@ -13662,6 +13251,7 @@ async function run$7(argv, importMeta, {
13662
13251
  reachDebug,
13663
13252
  reachDisableAnalysisSplitting,
13664
13253
  reachDisableAnalytics,
13254
+ reachLazyMode,
13665
13255
  reachSkipCache,
13666
13256
  reachUseOnlyPregeneratedSboms,
13667
13257
  reachVersion
@@ -13762,6 +13352,7 @@ async function run$7(argv, importMeta, {
13762
13352
  reachDisableAnalytics: Boolean(reachDisableAnalytics),
13763
13353
  reachEcosystems,
13764
13354
  reachExcludePaths,
13355
+ reachLazyMode: Boolean(reachLazyMode),
13765
13356
  reachSkipCache: Boolean(reachSkipCache),
13766
13357
  reachUseOnlyPregeneratedSboms: Boolean(reachUseOnlyPregeneratedSboms),
13767
13358
  reachVersion
@@ -15676,5 +15267,5 @@ process.on('unhandledRejection', async (reason, promise) => {
15676
15267
  // eslint-disable-next-line n/no-process-exit
15677
15268
  process.exit(1);
15678
15269
  });
15679
- //# debugId=7bd1ad51-3d27-483b-96d7-504fe33c820f
15270
+ //# debugId=90b6bd73-b1dd-42e8-a3d1-d309882d77f4
15680
15271
  //# sourceMappingURL=cli.js.map