@socketsecurity/cli-with-sentry 1.1.3 → 1.1.4

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 (79) hide show
  1. package/CHANGELOG.md +426 -0
  2. package/bin/cli.js +3 -1
  3. package/dist/cli.js +362 -400
  4. package/dist/cli.js.map +1 -1
  5. package/dist/constants.js +211 -19
  6. package/dist/constants.js.map +1 -1
  7. package/dist/flags.js +3 -3
  8. package/dist/flags.js.map +1 -1
  9. package/dist/instrument-with-sentry.js +8 -8
  10. package/dist/instrument-with-sentry.js.map +1 -1
  11. package/dist/shadow-npm-bin.js +14 -14
  12. package/dist/shadow-npm-bin.js.map +1 -1
  13. package/dist/shadow-npm-inject.js +16 -16
  14. package/dist/shadow-npm-inject.js.map +1 -1
  15. package/dist/tsconfig.dts.tsbuildinfo +1 -1
  16. package/dist/types/commands/ci/handle-ci.d.mts.map +1 -1
  17. package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
  18. package/dist/types/commands/npm/cmd-npm.d.mts +1 -1
  19. package/dist/types/commands/npm/cmd-npm.d.mts.map +1 -1
  20. package/dist/types/commands/optimize/add-overrides.d.mts.map +1 -1
  21. package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -1
  22. package/dist/types/commands/patch/handle-patch.d.mts +9 -2
  23. package/dist/types/commands/patch/handle-patch.d.mts.map +1 -1
  24. package/dist/types/commands/patch/output-patch-result.d.mts +1 -1
  25. package/dist/types/commands/patch/output-patch-result.d.mts.map +1 -1
  26. package/dist/types/commands/scan/cmd-scan-create.d.mts.map +1 -1
  27. package/dist/types/commands/scan/cmd-scan-github.d.mts.map +1 -1
  28. package/dist/types/commands/scan/cmd-scan-report.d.mts.map +1 -1
  29. package/dist/types/commands/scan/create-scan-from-github.d.mts.map +1 -1
  30. package/dist/types/commands/scan/generate-report.d.mts +9 -8
  31. package/dist/types/commands/scan/generate-report.d.mts.map +1 -1
  32. package/dist/types/commands/scan/handle-create-new-scan.d.mts +5 -2
  33. package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +1 -1
  34. package/dist/types/commands/scan/handle-scan-report.d.mts +7 -5
  35. package/dist/types/commands/scan/handle-scan-report.d.mts.map +1 -1
  36. package/dist/types/commands/scan/output-scan-report.d.mts +10 -8
  37. package/dist/types/commands/scan/output-scan-report.d.mts.map +1 -1
  38. package/dist/types/commands/scan/perform-reachability-analysis.d.mts.map +1 -1
  39. package/dist/types/commands/scan/types.d.mts +3 -0
  40. package/dist/types/commands/scan/types.d.mts.map +1 -0
  41. package/dist/types/constants.d.mts +99 -46
  42. package/dist/types/constants.d.mts.map +1 -1
  43. package/dist/types/shadow/npm/arborist-helpers.d.mts +1 -17
  44. package/dist/types/shadow/npm/arborist-helpers.d.mts.map +1 -1
  45. package/dist/types/shadow/npm/bin.d.mts +4 -3
  46. package/dist/types/shadow/npm/bin.d.mts.map +1 -1
  47. package/dist/types/utils/coana.d.mts.map +1 -1
  48. package/dist/types/utils/ecosystem.d.mts.map +1 -1
  49. package/dist/types/utils/get-output-kind.d.mts.map +1 -1
  50. package/dist/types/utils/glob.d.mts.map +1 -1
  51. package/dist/types/utils/package-environment.d.mts.map +1 -1
  52. package/dist/types/utils/purl.d.mts +25 -9
  53. package/dist/types/utils/purl.d.mts.map +1 -1
  54. package/dist/types/utils/spec.d.mts.map +1 -1
  55. package/dist/utils.js +120 -102
  56. package/dist/utils.js.map +1 -1
  57. package/dist/vendor.js +222 -4598
  58. package/external/@socketsecurity/registry/lib/constants/env.js +0 -3
  59. package/external/@socketsecurity/registry/lib/constants/ext-cjs.js +3 -0
  60. package/external/@socketsecurity/registry/lib/constants/ext-cts.js +3 -0
  61. package/external/@socketsecurity/registry/lib/constants/ext-dts.js +3 -0
  62. package/external/@socketsecurity/registry/lib/constants/ext-js.js +3 -0
  63. package/external/@socketsecurity/registry/lib/constants/ext-json.js +3 -0
  64. package/external/@socketsecurity/registry/lib/constants/ext-lock.js +3 -0
  65. package/external/@socketsecurity/registry/lib/constants/ext-lockb.js +3 -0
  66. package/external/@socketsecurity/registry/lib/constants/ext-md.js +3 -0
  67. package/external/@socketsecurity/registry/lib/constants/ext-mjs.js +3 -0
  68. package/external/@socketsecurity/registry/lib/constants/ext-mts.js +3 -0
  69. package/external/@socketsecurity/registry/lib/constants/index.js +82 -83
  70. package/external/@socketsecurity/registry/lib/constants/ipc-promise.js +4 -5
  71. package/external/@socketsecurity/registry/lib/constants/node-debug-flags.js +9 -0
  72. package/external/@socketsecurity/registry/lib/constants/pnpm.js +3 -0
  73. package/external/@socketsecurity/registry/lib/constants/yarn-lock.js +3 -0
  74. package/external/@socketsecurity/registry/lib/json.js +11 -0
  75. package/external/@socketsecurity/registry/lib/strings.js +16 -0
  76. package/package.json +13 -12
  77. package/external/@socketsecurity/registry/lib/constants/socket-public-api-key.js +0 -3
  78. package/external/@socketsecurity/registry/lib/constants/tap.js +0 -3
  79. /package/external/@socketsecurity/registry/lib/constants/{ipc.js → ipc-object.js} +0 -0
package/dist/utils.js CHANGED
@@ -5,13 +5,13 @@ var logger = require('../external/@socketsecurity/registry/lib/logger');
5
5
  var strings = require('../external/@socketsecurity/registry/lib/strings');
6
6
  var require$$9 = require('../external/@socketsecurity/registry/lib/debug');
7
7
  var require$$11 = require('../external/@socketsecurity/registry/lib/objects');
8
+ var constants = require('./constants.js');
8
9
  var arrays = require('../external/@socketsecurity/registry/lib/arrays');
9
10
  var path$1 = require('../external/@socketsecurity/registry/lib/path');
10
11
  var sorts = require('../external/@socketsecurity/registry/lib/sorts');
11
12
  var words = require('../external/@socketsecurity/registry/lib/words');
12
13
  var Module = require('node:module');
13
14
  var path = require('node:path');
14
- var constants = require('./constants.js');
15
15
  var flags = require('./flags.js');
16
16
  var regexps = require('../external/@socketsecurity/registry/lib/regexps');
17
17
  var prompts = require('../external/@socketsecurity/registry/lib/prompts');
@@ -36,7 +36,7 @@ function getConfigValues() {
36
36
  _cachedConfig = {};
37
37
  const {
38
38
  socketAppDataPath
39
- } = constants;
39
+ } = constants.default;
40
40
  if (socketAppDataPath) {
41
41
  const raw = fs.safeReadFileSync(socketAppDataPath);
42
42
  if (raw) {
@@ -238,7 +238,7 @@ function updateConfigValue(configKey, value) {
238
238
  _pendingSave = false;
239
239
  const {
240
240
  socketAppDataPath
241
- } = constants;
241
+ } = constants.default;
242
242
  if (socketAppDataPath) {
243
243
  fs$1.writeFileSync(socketAppDataPath, Buffer.from(JSON.stringify(localConfig)).toString('base64'));
244
244
  }
@@ -257,13 +257,13 @@ const TOKEN_VISIBLE_LENGTH = 5;
257
257
 
258
258
  // The Socket API server that should be used for operations.
259
259
  function getDefaultApiBaseUrl$1() {
260
- const baseUrl = constants.ENV.SOCKET_CLI_API_BASE_URL || getConfigValueOrUndef('apiBaseUrl');
260
+ const baseUrl = constants.default.ENV.SOCKET_CLI_API_BASE_URL || getConfigValueOrUndef('apiBaseUrl');
261
261
  return isUrl(baseUrl) ? baseUrl : undefined;
262
262
  }
263
263
 
264
264
  // The Socket API server that should be used for operations.
265
265
  function getDefaultProxyUrl() {
266
- const apiProxy = constants.ENV.SOCKET_CLI_API_PROXY || getConfigValueOrUndef('apiProxy');
266
+ const apiProxy = constants.default.ENV.SOCKET_CLI_API_PROXY || getConfigValueOrUndef('apiProxy');
267
267
  return isUrl(apiProxy) ? apiProxy : undefined;
268
268
  }
269
269
  function isUrl(value) {
@@ -280,16 +280,16 @@ function isUrl(value) {
280
280
  // This Socket API token should be stored globally for the duration of the CLI execution.
281
281
  let _defaultToken;
282
282
  function getDefaultApiToken() {
283
- if (constants.ENV.SOCKET_CLI_NO_API_TOKEN) {
283
+ if (constants.default.ENV.SOCKET_CLI_NO_API_TOKEN) {
284
284
  _defaultToken = undefined;
285
285
  return _defaultToken;
286
286
  }
287
- const key = constants.ENV.SOCKET_CLI_API_TOKEN || getConfigValueOrUndef('apiToken') || _defaultToken;
287
+ const key = constants.default.ENV.SOCKET_CLI_API_TOKEN || getConfigValueOrUndef('apiToken') || _defaultToken;
288
288
  _defaultToken = strings.isNonEmptyString(key) ? key : undefined;
289
289
  return _defaultToken;
290
290
  }
291
291
  function getPublicApiToken() {
292
- return getDefaultApiToken() || constants.ENV.SOCKET_CLI_API_TOKEN || constants.SOCKET_PUBLIC_API_TOKEN;
292
+ return getDefaultApiToken() || constants.default.ENV.SOCKET_CLI_API_TOKEN || constants.default.SOCKET_PUBLIC_API_TOKEN;
293
293
  }
294
294
  function getVisibleTokenPrefix() {
295
295
  const apiToken = getDefaultApiToken();
@@ -336,11 +336,11 @@ async function setupSdk(options) {
336
336
  proxy: apiProxy
337
337
  }) : undefined,
338
338
  baseUrl: apiBaseUrl,
339
- timeout: constants.ENV.SOCKET_CLI_API_TIMEOUT,
339
+ timeout: constants.default.ENV.SOCKET_CLI_API_TIMEOUT,
340
340
  userAgent: vendor.distExports.createUserAgentFromPkgJson({
341
- name: constants.ENV.INLINED_SOCKET_CLI_NAME,
342
- version: constants.ENV.INLINED_SOCKET_CLI_VERSION,
343
- homepage: constants.ENV.INLINED_SOCKET_CLI_HOMEPAGE
341
+ name: constants.default.ENV.INLINED_SOCKET_CLI_NAME,
342
+ version: constants.default.ENV.INLINED_SOCKET_CLI_VERSION,
343
+ homepage: constants.default.ENV.INLINED_SOCKET_CLI_HOMEPAGE
344
344
  })
345
345
  })
346
346
  };
@@ -350,11 +350,11 @@ const NO_ERROR_MESSAGE = 'No error message returned';
350
350
 
351
351
  // The Socket API server that should be used for operations.
352
352
  function getDefaultApiBaseUrl() {
353
- const baseUrl = constants.ENV.SOCKET_CLI_API_BASE_URL || getConfigValueOrUndef('apiBaseUrl');
353
+ const baseUrl = constants.default.ENV.SOCKET_CLI_API_BASE_URL || getConfigValueOrUndef('apiBaseUrl');
354
354
  if (strings.isNonEmptyString(baseUrl)) {
355
355
  return baseUrl;
356
356
  }
357
- const API_V0_URL = constants.API_V0_URL;
357
+ const API_V0_URL = constants.default.API_V0_URL;
358
358
  return API_V0_URL;
359
359
  }
360
360
  async function getErrorMessageForHttpStatusCode(code) {
@@ -509,7 +509,7 @@ async function queryApiSafeText(path, desc) {
509
509
  }
510
510
  const {
511
511
  spinner
512
- } = constants;
512
+ } = constants.default;
513
513
  if (desc) {
514
514
  spinner.start(`Requesting ${desc} from API...`);
515
515
  }
@@ -595,7 +595,7 @@ async function sendApiRequest(path, options) {
595
595
  }
596
596
  const {
597
597
  spinner
598
- } = constants;
598
+ } = constants.default;
599
599
  if (options.desc) {
600
600
  spinner.start(`Requesting ${options.desc} from API...`);
601
601
  }
@@ -843,19 +843,19 @@ function checkCommandInput(outputKind, ...checks) {
843
843
 
844
844
  function getOutputKind(json, markdown) {
845
845
  if (json) {
846
- return 'json';
846
+ return constants.JSON;
847
847
  }
848
848
  if (markdown) {
849
- return 'markdown';
849
+ return constants.MARKDOWN;
850
850
  }
851
- return 'text';
851
+ return constants.TEXT;
852
852
  }
853
853
 
854
854
  const require$2 = Module.createRequire(require('node:url').pathToFileURL(__filename).href);
855
855
  let _requirements;
856
856
  function getRequirements() {
857
857
  if (_requirements === undefined) {
858
- _requirements = /*@__PURE__*/require$2(path.join(constants.rootPath, 'requirements.json'));
858
+ _requirements = /*@__PURE__*/require$2(path.join(constants.default.rootPath, 'requirements.json'));
859
859
  }
860
860
  return _requirements;
861
861
  }
@@ -935,7 +935,7 @@ function getHelpListOutput(list, options) {
935
935
  // Replace the start of a path with ~/ when it starts with your home dir.
936
936
  // A common way to abbreviate the user home dir (though not strictly posix).
937
937
  function tildify(cwd) {
938
- return cwd.replace(new RegExp(`^${regexps.escapeRegExp(constants.homePath)}(?:${path.sep}|$)`, 'i'), '~/');
938
+ return cwd.replace(new RegExp(`^${regexps.escapeRegExp(constants.default.homePath)}(?:${path.sep}|$)`, 'i'), '~/');
939
939
  }
940
940
 
941
941
  // Property names are picked such that the name is at the top when the props
@@ -1100,17 +1100,17 @@ async function meowWithSubcommands(subcommands, options) {
1100
1100
  // The env var overrides the --flag, which overrides the persisted config
1101
1101
  // Also, when either of these are used, config updates won't persist.
1102
1102
  let configOverrideResult;
1103
- if (constants.ENV.SOCKET_CLI_CONFIG) {
1104
- configOverrideResult = overrideCachedConfig(constants.ENV.SOCKET_CLI_CONFIG);
1103
+ if (constants.default.ENV.SOCKET_CLI_CONFIG) {
1104
+ configOverrideResult = overrideCachedConfig(constants.default.ENV.SOCKET_CLI_CONFIG);
1105
1105
  } else if (cli1.flags['config']) {
1106
1106
  configOverrideResult = overrideCachedConfig(String(cli1.flags['config'] || ''));
1107
1107
  }
1108
- if (constants.ENV.SOCKET_CLI_NO_API_TOKEN) {
1108
+ if (constants.default.ENV.SOCKET_CLI_NO_API_TOKEN) {
1109
1109
  // This overrides the config override and even the explicit token env var.
1110
1110
  // The config will be marked as readOnly to prevent persisting it.
1111
1111
  overrideConfigApiToken(undefined);
1112
1112
  } else {
1113
- const tokenOverride = constants.ENV.SOCKET_CLI_API_TOKEN;
1113
+ const tokenOverride = constants.default.ENV.SOCKET_CLI_API_TOKEN;
1114
1114
  if (tokenOverride) {
1115
1115
  // This will set the token (even if there was a config override) and
1116
1116
  // set it to readOnly, making sure the temp token won't be persisted.
@@ -1161,7 +1161,7 @@ async function meowWithSubcommands(subcommands, options) {
1161
1161
  // "Bucket" some commands for easier usage.
1162
1162
  const commands = new Set(['analytics', 'audit-log', 'ci', 'cdxgen', 'config', 'dependencies', 'fix', 'install',
1163
1163
  //'json',
1164
- 'license', 'login', 'logout', 'manifest', 'npm', 'npx', 'optimize', 'organization', 'package',
1164
+ 'license', 'login', 'logout', 'manifest', constants.NPM, constants.NPX, 'optimize', 'organization', 'package',
1165
1165
  //'patch',
1166
1166
  'raw-npm', 'raw-npx', 'repository', 'scan',
1167
1167
  //'security',
@@ -1179,7 +1179,7 @@ async function meowWithSubcommands(subcommands, options) {
1179
1179
  // test snapshots we use joinAnd.
1180
1180
  arrays.joinAnd(Array.from(commands).sort(sorts.naturalCompare).map(c => `'${c}'`)));
1181
1181
  }
1182
- lines.push('Note: All commands have their own --help', '', 'Main commands', ` socket login ${description(subcommands['login'])}`, ` socket scan create Create a new Socket scan and report`, ` socket npm/lodash@4.17.21 Request the Socket score of a package`, ` socket ci ${description(subcommands['ci'])}`, ``, 'Socket API', ` analytics ${description(subcommands['analytics'])}`, ` audit-log ${description(subcommands['audit-log'])}`, ` organization ${description(subcommands['organization'])}`, ` package ${description(subcommands['package'])}`, ` repository ${description(subcommands['repository'])}`, ` scan ${description(subcommands['scan'])}`, ` threat-feed ${description(subcommands['threat-feed'])}`, ``, 'Local tools', ` fix ${description(subcommands['fix'])}`, ` manifest ${description(subcommands['manifest'])}`, ` npm ${description(subcommands['npm'])}`, ` npx ${description(subcommands['npx'])}`, ` optimize ${description(subcommands['optimize'])}`, ` raw-npm ${description(subcommands['raw-npm'])}`, ` raw-npx ${description(subcommands['raw-npx'])}`, '', 'CLI configuration', ` config ${description(subcommands['config'])}`, ` install ${description(subcommands['install'])}`, ` login Socket API login and CLI setup`, ` logout ${description(subcommands['logout'])}`, ` uninstall ${description(subcommands['uninstall'])}`, ` wrapper ${description(subcommands['wrapper'])}`);
1182
+ lines.push('Note: All commands have their own --help', '', 'Main commands', ` socket login ${description(subcommands['login'])}`, ` socket scan create Create a new Socket scan and report`, ` socket npm/lodash@4.17.21 Request the Socket score of a package`, ` socket ci ${description(subcommands['ci'])}`, ``, 'Socket API', ` analytics ${description(subcommands['analytics'])}`, ` audit-log ${description(subcommands['audit-log'])}`, ` organization ${description(subcommands['organization'])}`, ` package ${description(subcommands['package'])}`, ` repository ${description(subcommands['repository'])}`, ` scan ${description(subcommands['scan'])}`, ` threat-feed ${description(subcommands['threat-feed'])}`, ``, 'Local tools', ` fix ${description(subcommands['fix'])}`, ` manifest ${description(subcommands['manifest'])}`, ` npm ${description(subcommands[constants.NPM])}`, ` npx ${description(subcommands[constants.NPX])}`, ` optimize ${description(subcommands['optimize'])}`, ` raw-npm ${description(subcommands['raw-npm'])}`, ` raw-npx ${description(subcommands['raw-npx'])}`, '', 'CLI configuration', ` config ${description(subcommands['config'])}`, ` install ${description(subcommands['install'])}`, ` login Socket API login and CLI setup`, ` logout ${description(subcommands['logout'])}`, ` uninstall ${description(subcommands['uninstall'])}`, ` wrapper ${description(subcommands['wrapper'])}`);
1183
1183
  } else {
1184
1184
  lines.push('Commands');
1185
1185
  lines.push(` ${getHelpListOutput({
@@ -1241,7 +1241,7 @@ async function meowWithSubcommands(subcommands, options) {
1241
1241
  }
1242
1242
  if (!cli2.flags['help'] && cli2.flags['dryRun']) {
1243
1243
  process.exitCode = 0;
1244
- logger.logger.log(`${constants.DRY_RUN_LABEL}: No-op, call a sub-command; ok`);
1244
+ logger.logger.log(`${constants.default.DRY_RUN_LABEL}: No-op, call a sub-command; ok`);
1245
1245
  } else {
1246
1246
  // When you explicitly request --help, the command should be successful
1247
1247
  // so we exit(0). If we do it because we need more input, we exit(2).
@@ -1349,9 +1349,9 @@ function getAsciiHeader(command, orgFlag) {
1349
1349
  // Note: In tests we return <redacted> because otherwise snapshots will fail.
1350
1350
  const {
1351
1351
  REDACTED
1352
- } = constants;
1353
- const redacting = constants.ENV.VITEST;
1354
- const cliVersion = redacting ? REDACTED : constants.ENV.INLINED_SOCKET_CLI_VERSION_HASH;
1352
+ } = constants.default;
1353
+ const redacting = constants.default.ENV.VITEST;
1354
+ const cliVersion = redacting ? REDACTED : constants.default.ENV.INLINED_SOCKET_CLI_VERSION_HASH;
1355
1355
  const nodeVersion = redacting ? REDACTED : process.version;
1356
1356
  const defaultOrg = getConfigValueOrUndef('defaultOrg');
1357
1357
  const readOnlyConfig = isReadOnlyConfig() ? '*' : '.';
@@ -1542,7 +1542,7 @@ async function getDefaultOrgSlug() {
1542
1542
  data: defaultOrgResult
1543
1543
  };
1544
1544
  }
1545
- const envOrgSlug = constants.ENV.SOCKET_CLI_ORG_SLUG;
1545
+ const envOrgSlug = constants.default.ENV.SOCKET_CLI_ORG_SLUG;
1546
1546
  if (envOrgSlug) {
1547
1547
  require$$9.debugFn('notice', 'use: org from SOCKET_CLI_ORG_SLUG environment variable', envOrgSlug);
1548
1548
  return {
@@ -1598,7 +1598,7 @@ async function getBaseBranch(cwd = process.cwd()) {
1598
1598
  GITHUB_BASE_REF,
1599
1599
  GITHUB_REF_NAME,
1600
1600
  GITHUB_REF_TYPE
1601
- } = constants.ENV;
1601
+ } = constants.default.ENV;
1602
1602
  // 1. In a pull request, this is always the base branch.
1603
1603
  if (GITHUB_BASE_REF) {
1604
1604
  return GITHUB_BASE_REF;
@@ -1647,7 +1647,7 @@ async function getRepoInfo(cwd = process.cwd()) {
1647
1647
  }
1648
1648
  async function getRepoName(cwd = process.cwd()) {
1649
1649
  const repoInfo = await getRepoInfo(cwd);
1650
- return repoInfo?.repo ?? constants.SOCKET_DEFAULT_REPOSITORY;
1650
+ return repoInfo?.repo ?? constants.default.SOCKET_DEFAULT_REPOSITORY;
1651
1651
  }
1652
1652
  async function gitBranch(cwd = process.cwd()) {
1653
1653
  const stdioPipeOptions = {
@@ -1711,7 +1711,7 @@ async function detectDefaultBranch(cwd = process.cwd()) {
1711
1711
  return branch;
1712
1712
  }
1713
1713
  }
1714
- return constants.SOCKET_DEFAULT_BRANCH;
1714
+ return constants.default.SOCKET_DEFAULT_BRANCH;
1715
1715
  }
1716
1716
  async function gitCleanFdx(cwd = process.cwd()) {
1717
1717
  const stdioIgnoreOptions = {
@@ -1798,8 +1798,8 @@ async function gitCommit(commitMsg, filepaths, options) {
1798
1798
  }
1799
1799
  const {
1800
1800
  cwd = process.cwd(),
1801
- email = constants.ENV.SOCKET_CLI_GIT_USER_EMAIL,
1802
- user = constants.ENV.SOCKET_CLI_GIT_USER_NAME
1801
+ email = constants.default.ENV.SOCKET_CLI_GIT_USER_EMAIL,
1802
+ user = constants.default.ENV.SOCKET_CLI_GIT_USER_NAME
1803
1803
  } = {
1804
1804
  __proto__: null,
1805
1805
  ...options
@@ -2038,8 +2038,22 @@ function parseGitRemoteUrl(remoteUrl) {
2038
2038
  } : result;
2039
2039
  }
2040
2040
 
2041
- function getPurlObject(purl) {
2042
- return typeof purl === 'string' ? vendor.packageurlJsExports.PackageURL.fromString(purl) : purl;
2041
+ function getPurlObject(purl, options) {
2042
+ const {
2043
+ throws
2044
+ } = {
2045
+ __proto__: null,
2046
+ ...options
2047
+ };
2048
+ const shouldThrow = throws === undefined || !!throws;
2049
+ try {
2050
+ return typeof purl === 'string' ? vendor.packageurlJsExports.PackageURL.fromString(purl) : purl;
2051
+ } catch (e) {
2052
+ if (shouldThrow) {
2053
+ throw e;
2054
+ }
2055
+ return null;
2056
+ }
2043
2057
  }
2044
2058
 
2045
2059
  function getPkgFullNameFromPurl(purl) {
@@ -2056,7 +2070,7 @@ function getSocketDevPackageOverviewUrlFromPurl(purl) {
2056
2070
  return getSocketDevPackageOverviewUrl(purlObj.type, fullName, purlObj.version);
2057
2071
  }
2058
2072
  function getSocketDevPackageOverviewUrl(ecosystem, fullName, version) {
2059
- const url = `${constants.SOCKET_WEBSITE_URL}/${ecosystem}/package/${fullName}`;
2073
+ const url = `${constants.default.SOCKET_WEBSITE_URL}/${ecosystem}/package/${fullName}`;
2060
2074
  return ecosystem === 'golang' ? `${url}${version ? `?section=overview&version=${version}` : ''}` : `${url}${version ? `/overview/${version}` : ''}`;
2061
2075
  }
2062
2076
 
@@ -2099,7 +2113,7 @@ const IGNORED_DIRS = [
2099
2113
  // Where Bower packages are installed, see <http://bower.io/>
2100
2114
  'coverage',
2101
2115
  // Standard output directory for code coverage reports, see <https://github.com/gotwarlost/istanbul>
2102
- 'node_modules',
2116
+ constants.NODE_MODULES,
2103
2117
  // Where Node modules are installed, see <https://nodejs.org/>
2104
2118
  // Taken from globby:
2105
2119
  // https://github.com/sindresorhus/globby/blob/v14.0.2/ignore.js#L11-L16
@@ -2107,7 +2121,7 @@ const IGNORED_DIRS = [
2107
2121
  const IGNORED_DIR_PATTERNS = IGNORED_DIRS.map(i => `**/${i}`);
2108
2122
  async function getWorkspaceGlobs(agent, cwd = process.cwd()) {
2109
2123
  let workspacePatterns;
2110
- if (agent === 'pnpm') {
2124
+ if (agent === constants.PNPM) {
2111
2125
  for (const workspacePath of [path.join(cwd, 'pnpm-workspace.yaml'), path.join(cwd, 'pnpm-workspace.yml')]) {
2112
2126
  // eslint-disable-next-line no-await-in-loop
2113
2127
  const yml = await fs.safeReadFile(workspacePath);
@@ -2289,7 +2303,7 @@ function findBinPathDetailsSync(binName) {
2289
2303
  }) ?? [];
2290
2304
  const {
2291
2305
  shadowBinPath
2292
- } = constants;
2306
+ } = constants.default;
2293
2307
  let shadowIndex = -1;
2294
2308
  let theBinPath;
2295
2309
  for (let i = 0, {
@@ -2313,10 +2327,10 @@ function findBinPathDetailsSync(binName) {
2313
2327
  function findNpmDirPathSync(npmBinPath) {
2314
2328
  const {
2315
2329
  WIN32
2316
- } = constants;
2330
+ } = constants.default;
2317
2331
  let thePath = npmBinPath;
2318
2332
  while (true) {
2319
- const libNmNpmPath = path.join(thePath, 'lib/node_modules/npm');
2333
+ const libNmNpmPath = path.join(thePath, `lib/${constants.NODE_MODULES}/${constants.NPM}`);
2320
2334
  // mise, which uses opaque binaries, puts its npm bin in a path like:
2321
2335
  // /Users/SomeUsername/.local/share/mise/installs/node/vX.X.X/bin/npm.
2322
2336
  // HOWEVER, the location of the npm install is:
@@ -2328,8 +2342,8 @@ function findNpmDirPathSync(npmBinPath) {
2328
2342
  fs.isDirSync(libNmNpmPath)) {
2329
2343
  thePath = libNmNpmPath;
2330
2344
  }
2331
- const hasNmInCurrPath = fs.isDirSync(path.join(thePath, 'node_modules'));
2332
- const hasNmInParentPath = !hasNmInCurrPath && fs.isDirSync(path.join(thePath, '../node_modules'));
2345
+ const hasNmInCurrPath = fs.isDirSync(path.join(thePath, constants.NODE_MODULES));
2346
+ const hasNmInParentPath = !hasNmInCurrPath && fs.isDirSync(path.join(thePath, `../${constants.NODE_MODULES}`));
2333
2347
  if (
2334
2348
  // npm bin paths may look like:
2335
2349
  // /usr/local/share/npm/bin/npm
@@ -2345,9 +2359,9 @@ function findNpmDirPathSync(npmBinPath) {
2345
2359
  // In some bespoke cases the node_modules folder is in the parent directory.
2346
2360
  hasNmInParentPath) && (
2347
2361
  // Optimistically look for the default location.
2348
- path.basename(thePath) === 'npm' ||
2362
+ path.basename(thePath) === constants.NPM ||
2349
2363
  // Chocolatey installs npm bins in the same directory as node bins.
2350
- WIN32 && fs$1.existsSync(path.join(thePath, 'npm.cmd')))) {
2364
+ WIN32 && fs$1.existsSync(path.join(thePath, `${constants.NPM}.cmd`)))) {
2351
2365
  return hasNmInParentPath ? path.dirname(thePath) : thePath;
2352
2366
  }
2353
2367
  const parent = path.dirname(thePath);
@@ -2384,7 +2398,7 @@ function getNpmBinPath() {
2384
2398
  if (_npmBinPath === undefined) {
2385
2399
  _npmBinPath = getNpmBinPathDetails().path;
2386
2400
  if (!_npmBinPath) {
2387
- exitWithBinPathError('npm');
2401
+ exitWithBinPathError(constants.NPM);
2388
2402
  }
2389
2403
  }
2390
2404
  return _npmBinPath;
@@ -2392,7 +2406,7 @@ function getNpmBinPath() {
2392
2406
  let _npmBinPathDetails;
2393
2407
  function getNpmBinPathDetails() {
2394
2408
  if (_npmBinPathDetails === undefined) {
2395
- _npmBinPathDetails = findBinPathDetailsSync('npm');
2409
+ _npmBinPathDetails = findBinPathDetailsSync(constants.NPM);
2396
2410
  }
2397
2411
  return _npmBinPathDetails;
2398
2412
  }
@@ -2402,7 +2416,7 @@ function getNpmDirPath() {
2402
2416
  const npmBinPath = getNpmBinPath();
2403
2417
  _npmDirPath = npmBinPath ? findNpmDirPathSync(npmBinPath) : undefined;
2404
2418
  if (!_npmDirPath) {
2405
- _npmDirPath = constants.ENV.SOCKET_CLI_NPM_PATH || undefined;
2419
+ _npmDirPath = constants.default.ENV.SOCKET_CLI_NPM_PATH || undefined;
2406
2420
  }
2407
2421
  if (!_npmDirPath) {
2408
2422
  let message = 'Unable to find npm CLI install directory.';
@@ -2410,7 +2424,7 @@ function getNpmDirPath() {
2410
2424
  message += `\nSearched parent directories of ${path.dirname(npmBinPath)}.`;
2411
2425
  }
2412
2426
  message += '\n\nThis is may be a bug with socket-npm related to changes to the npm CLI.';
2413
- message += `\nPlease report to ${constants.SOCKET_CLI_ISSUES_URL}.`;
2427
+ message += `\nPlease report to ${constants.default.SOCKET_CLI_ISSUES_URL}.`;
2414
2428
  logger.logger.fail(message);
2415
2429
  // The exit code 127 indicates that the command or binary being executed
2416
2430
  // could not be found.
@@ -2424,7 +2438,7 @@ let _npmRequire;
2424
2438
  function getNpmRequire() {
2425
2439
  if (_npmRequire === undefined) {
2426
2440
  const npmDirPath = getNpmDirPath();
2427
- const npmNmPath = path.join(npmDirPath, 'node_modules/npm');
2441
+ const npmNmPath = path.join(npmDirPath, `${constants.NODE_MODULES}/npm`);
2428
2442
  _npmRequire = Module.createRequire(path.join(fs$1.existsSync(npmNmPath) ? npmNmPath : npmDirPath, '<dummy-basename>'));
2429
2443
  }
2430
2444
  return _npmRequire;
@@ -2495,7 +2509,7 @@ async function findUp(name, options) {
2495
2509
  };
2496
2510
  const {
2497
2511
  cwd = process.cwd(),
2498
- signal = constants.abortSignal
2512
+ signal = constants.default.abortSignal
2499
2513
  } = opts;
2500
2514
  let {
2501
2515
  onlyDirectories = false,
@@ -2551,7 +2565,7 @@ async function spawnCoana(args, orgSlug, options, extra) {
2551
2565
  ...options
2552
2566
  };
2553
2567
  const mixinsEnv = {
2554
- SOCKET_CLI_VERSION: constants.ENV.INLINED_SOCKET_CLI_VERSION
2568
+ SOCKET_CLI_VERSION: constants.default.ENV.INLINED_SOCKET_CLI_VERSION
2555
2569
  };
2556
2570
  const defaultApiToken = getDefaultApiToken();
2557
2571
  if (defaultApiToken) {
@@ -2568,16 +2582,18 @@ async function spawnCoana(args, orgSlug, options, extra) {
2568
2582
  try {
2569
2583
  const {
2570
2584
  spawnPromise
2571
- } = await shadowNpmBin('npx', ['--yes', `@coana-tech/cli@~${constants.ENV.INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION}`, ...args], {
2585
+ } = await shadowNpmBin('npx', ['--yes', `@coana-tech/cli@~${constants.default.ENV.INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION}`, ...args], {
2572
2586
  ...spawnOpts,
2573
2587
  env: {
2588
+ ...process.env,
2589
+ ...constants.default.processEnv,
2574
2590
  ...mixinsEnv,
2575
2591
  ...spawnEnv
2576
2592
  },
2577
2593
  ipc: {
2578
- [constants.SOCKET_CLI_SHADOW_ACCEPT_RISKS]: true,
2579
- [constants.SOCKET_CLI_SHADOW_API_TOKEN]: constants.SOCKET_PUBLIC_API_TOKEN,
2580
- [constants.SOCKET_CLI_SHADOW_SILENT]: true,
2594
+ [constants.default.SOCKET_CLI_SHADOW_ACCEPT_RISKS]: true,
2595
+ [constants.default.SOCKET_CLI_SHADOW_API_TOKEN]: constants.default.SOCKET_PUBLIC_API_TOKEN,
2596
+ [constants.default.SOCKET_CLI_SHADOW_SILENT]: true,
2581
2597
  ...ipc
2582
2598
  }
2583
2599
  }, extra);
@@ -2719,7 +2735,7 @@ async function writeSocketJson(cwd, sockJson) {
2719
2735
  async function readCache(key,
2720
2736
  // 5 minute in milliseconds time to live (TTL).
2721
2737
  ttlMs = 5 * 60 * 1000) {
2722
- const cacheJsonPath = path.join(constants.githubCachePath, `${key}.json`);
2738
+ const cacheJsonPath = path.join(constants.default.githubCachePath, `${key}.json`);
2723
2739
  const stat = fs.safeStatsSync(cacheJsonPath);
2724
2740
  if (stat) {
2725
2741
  const isExpired = Date.now() - stat.mtimeMs > ttlMs;
@@ -2732,7 +2748,7 @@ ttlMs = 5 * 60 * 1000) {
2732
2748
  async function writeCache(key, data) {
2733
2749
  const {
2734
2750
  githubCachePath
2735
- } = constants;
2751
+ } = constants.default;
2736
2752
  const cacheJsonPath = path.join(githubCachePath, `${key}.json`);
2737
2753
  if (!fs$1.existsSync(githubCachePath)) {
2738
2754
  await fs$1.promises.mkdir(githubCachePath, {
@@ -2743,7 +2759,7 @@ async function writeCache(key, data) {
2743
2759
  }
2744
2760
  async function cacheFetch(key, fetcher, ttlMs) {
2745
2761
  // Optionally disable cache.
2746
- if (constants.ENV.DISABLE_GITHUB_CACHE) {
2762
+ if (constants.default.ENV.DISABLE_GITHUB_CACHE) {
2747
2763
  return await fetcher();
2748
2764
  }
2749
2765
  let data = await readCache(key, ttlMs);
@@ -2804,13 +2820,13 @@ function getOctokit() {
2804
2820
  if (_octokit === undefined) {
2805
2821
  const {
2806
2822
  SOCKET_CLI_GITHUB_TOKEN
2807
- } = constants.ENV;
2823
+ } = constants.default.ENV;
2808
2824
  if (!SOCKET_CLI_GITHUB_TOKEN) {
2809
2825
  require$$9.debugFn('notice', 'miss: SOCKET_CLI_GITHUB_TOKEN env var');
2810
2826
  }
2811
2827
  const octokitOptions = {
2812
2828
  auth: SOCKET_CLI_GITHUB_TOKEN,
2813
- baseUrl: constants.ENV.GITHUB_API_URL
2829
+ baseUrl: constants.default.ENV.GITHUB_API_URL
2814
2830
  };
2815
2831
  require$$9.debugDir('inspect', {
2816
2832
  octokitOptions
@@ -2824,7 +2840,7 @@ function getOctokitGraphql() {
2824
2840
  if (!_octokitGraphql) {
2825
2841
  const {
2826
2842
  SOCKET_CLI_GITHUB_TOKEN
2827
- } = constants.ENV;
2843
+ } = constants.default.ENV;
2828
2844
  if (!SOCKET_CLI_GITHUB_TOKEN) {
2829
2845
  require$$9.debugFn('notice', 'miss: SOCKET_CLI_GITHUB_TOKEN env var');
2830
2846
  }
@@ -2878,7 +2894,7 @@ async function enablePrAutoMerge({
2878
2894
  async function setGitRemoteGithubRepoUrl(owner, repo, token, cwd = process.cwd()) {
2879
2895
  const {
2880
2896
  host
2881
- } = new URL(constants.ENV.GITHUB_SERVER_URL);
2897
+ } = new URL(constants.default.ENV.GITHUB_SERVER_URL);
2882
2898
  const url = `https://x-access-token:${token}@${host}/${owner}/${repo}`;
2883
2899
  const stdioIgnoreOptions = {
2884
2900
  cwd,
@@ -2910,7 +2926,7 @@ function getMajor(version) {
2910
2926
  const COMPLETION_CMD_PREFIX = 'complete -F _socket_completion';
2911
2927
  function getCompletionSourcingCommand() {
2912
2928
  // Note: this is exported to distPath in .config/rollup.dist.config.mjs
2913
- const completionScriptExportPath = path.join(constants.distPath, 'socket-completion.bash');
2929
+ const completionScriptExportPath = path.join(constants.default.distPath, 'socket-completion.bash');
2914
2930
  if (!fs$1.existsSync(completionScriptExportPath)) {
2915
2931
  return {
2916
2932
  ok: false,
@@ -2930,7 +2946,7 @@ function getBashrcDetails(targetCommandName) {
2930
2946
  }
2931
2947
  const {
2932
2948
  socketAppDataPath
2933
- } = constants;
2949
+ } = constants.default;
2934
2950
  if (!socketAppDataPath) {
2935
2951
  return {
2936
2952
  ok: false,
@@ -2969,7 +2985,7 @@ const {
2969
2985
  [kInternalsSymbol]: {
2970
2986
  getSentry
2971
2987
  }
2972
- } = constants;
2988
+ } = constants.default;
2973
2989
  class AuthError extends Error {}
2974
2990
  class InputError extends Error {
2975
2991
  constructor(message, body) {
@@ -3033,7 +3049,7 @@ function shadowNpmInstall(options) {
3033
3049
  } else {
3034
3050
  stdio = useIpc ? ['pipe', 'pipe', 'pipe', 'ipc'] : 'pipe';
3035
3051
  }
3036
- const spawnPromise = spawn.spawn(constants.execPath, [...constants.nodeNoWarningsFlags, ...constants.nodeDebugFlags, ...constants.nodeHardenFlags, ...constants.nodeMemoryFlags, ...(constants.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD ? ['--require', constants.instrumentWithSentryPath] : []), '--require', constants.shadowNpmInjectPath, npm.resolveBinPathSync(agentExecPath), 'install',
3052
+ const spawnPromise = spawn.spawn(constants.default.execPath, [...constants.default.nodeNoWarningsFlags, ...constants.default.nodeDebugFlags, ...constants.default.nodeHardenFlags, ...constants.default.nodeMemoryFlags, ...(constants.default.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD ? ['--require', constants.default.instrumentWithSentryPath] : []), '--require', constants.default.shadowNpmInjectPath, npm.resolveBinPathSync(agentExecPath), 'install',
3037
3053
  // Avoid code paths for 'audit' and 'fund'.
3038
3054
  '--no-audit', '--no-fund',
3039
3055
  // Add '--no-progress' to fix input being swallowed by the npm spinner.
@@ -3044,7 +3060,7 @@ function shadowNpmInstall(options) {
3044
3060
  ...spawnOpts,
3045
3061
  env: {
3046
3062
  ...process.env,
3047
- ...constants.processEnv,
3063
+ ...constants.default.processEnv,
3048
3064
  ...require$$11.getOwn(spawnOpts, 'env')
3049
3065
  },
3050
3066
  spinner,
@@ -3052,9 +3068,9 @@ function shadowNpmInstall(options) {
3052
3068
  });
3053
3069
  if (useIpc) {
3054
3070
  spawnPromise.process.send({
3055
- [constants.SOCKET_IPC_HANDSHAKE]: {
3056
- [constants.SOCKET_CLI_SHADOW_BIN]: 'npm',
3057
- [constants.SOCKET_CLI_SHADOW_PROGRESS]: progressArg,
3071
+ [constants.default.SOCKET_IPC_HANDSHAKE]: {
3072
+ [constants.default.SOCKET_CLI_SHADOW_BIN]: constants.NPM,
3073
+ [constants.default.SOCKET_CLI_SHADOW_PROGRESS]: progressArg,
3058
3074
  ...ipc
3059
3075
  }
3060
3076
  });
@@ -3067,8 +3083,8 @@ function runAgentInstall(pkgEnvDetails, options) {
3067
3083
  agent,
3068
3084
  agentExecPath
3069
3085
  } = pkgEnvDetails;
3070
- const isNpm = agent === 'npm';
3071
- const isPnpm = agent === 'pnpm';
3086
+ const isNpm = agent === constants.NPM;
3087
+ const isPnpm = agent === constants.PNPM;
3072
3088
  // All package managers support the "install" command.
3073
3089
  if (isNpm) {
3074
3090
  return shadowNpmInstall({
@@ -3086,24 +3102,25 @@ function runAgentInstall(pkgEnvDetails, options) {
3086
3102
  };
3087
3103
  const skipNodeHardenFlags = isPnpm && pkgEnvDetails.agentVersion.major < 11;
3088
3104
  return spawn.spawn(agentExecPath, ['install', ...args], {
3089
- shell: constants.WIN32,
3105
+ shell: constants.default.WIN32,
3090
3106
  spinner,
3091
3107
  stdio: 'inherit',
3092
3108
  ...spawnOpts,
3093
3109
  env: {
3094
3110
  ...process.env,
3095
- ...constants.processEnv,
3096
- NODE_OPTIONS: cmdFlagsToString([...(skipNodeHardenFlags ? [] : constants.nodeHardenFlags), ...constants.nodeNoWarningsFlags]),
3111
+ ...constants.default.processEnv,
3112
+ NODE_OPTIONS: cmdFlagsToString([...(skipNodeHardenFlags ? [] : constants.default.nodeHardenFlags), ...constants.default.nodeNoWarningsFlags]),
3097
3113
  ...require$$11.getOwn(spawnOpts, 'env')
3098
3114
  }
3099
3115
  });
3100
3116
  }
3101
3117
 
3102
3118
  const {
3103
- BINARY_LOCK_EXT,
3104
3119
  BUN,
3120
+ EXT_LOCK,
3121
+ EXT_LOCKB,
3105
3122
  HIDDEN_PACKAGE_LOCK_JSON,
3106
- LOCK_EXT,
3123
+ NODE_MODULES,
3107
3124
  NPM,
3108
3125
  NPM_BUGGY_OVERRIDES_PATCHED_VERSION,
3109
3126
  PACKAGE_JSON,
@@ -3112,7 +3129,7 @@ const {
3112
3129
  YARN,
3113
3130
  YARN_BERRY,
3114
3131
  YARN_CLASSIC
3115
- } = constants;
3132
+ } = constants.default;
3116
3133
  const AGENTS = [BUN, NPM, PNPM, YARN_BERRY, YARN_CLASSIC, VLT];
3117
3134
  const binByAgent = new Map([[BUN, BUN], [NPM, NPM], [PNPM, PNPM], [YARN_BERRY, YARN], [YARN_CLASSIC, YARN], [VLT, VLT]]);
3118
3135
  const readLockFileByAgent = (() => {
@@ -3128,10 +3145,10 @@ const readLockFileByAgent = (() => {
3128
3145
  const defaultReader = wrapReader(async lockPath => await fs.readFileUtf8(lockPath));
3129
3146
  return new Map([[BUN, wrapReader(async (lockPath, agentExecPath, cwd = process.cwd()) => {
3130
3147
  const ext = path.extname(lockPath);
3131
- if (ext === LOCK_EXT) {
3148
+ if (ext === EXT_LOCK) {
3132
3149
  return await defaultReader(lockPath);
3133
3150
  }
3134
- if (ext === BINARY_LOCK_EXT) {
3151
+ if (ext === EXT_LOCKB) {
3135
3152
  const lockBuffer = await binaryReader(lockPath);
3136
3153
  if (lockBuffer) {
3137
3154
  try {
@@ -3143,7 +3160,7 @@ const readLockFileByAgent = (() => {
3143
3160
  // https://bun.sh/guides/install/yarnlock
3144
3161
  return (await spawn.spawn(agentExecPath, [lockPath], {
3145
3162
  cwd,
3146
- shell: constants.WIN32
3163
+ shell: constants.default.WIN32
3147
3164
  })).stdout;
3148
3165
  }
3149
3166
  return undefined;
@@ -3152,8 +3169,8 @@ const readLockFileByAgent = (() => {
3152
3169
 
3153
3170
  // The order of LOCKS properties IS significant as it affects iteration order.
3154
3171
  const LOCKS = {
3155
- [`bun${LOCK_EXT}`]: BUN,
3156
- [`bun${BINARY_LOCK_EXT}`]: BUN,
3172
+ [`bun${EXT_LOCK}`]: BUN,
3173
+ [`bun${EXT_LOCKB}`]: BUN,
3157
3174
  // If both package-lock.json and npm-shrinkwrap.json are present in the root
3158
3175
  // of a project, npm-shrinkwrap.json will take precedence and package-lock.json
3159
3176
  // will be ignored.
@@ -3162,19 +3179,19 @@ const LOCKS = {
3162
3179
  'package-lock.json': NPM,
3163
3180
  'pnpm-lock.yaml': PNPM,
3164
3181
  'pnpm-lock.yml': PNPM,
3165
- [`yarn${LOCK_EXT}`]: YARN_CLASSIC,
3182
+ [`yarn${EXT_LOCK}`]: YARN_CLASSIC,
3166
3183
  'vlt-lock.json': VLT,
3167
3184
  // Lastly, look for a hidden lock file which is present if .npmrc has package-lock=false:
3168
3185
  // https://docs.npmjs.com/cli/v10/configuring-npm/package-lock-json#hidden-lockfiles
3169
3186
  //
3170
3187
  // Unlike the other LOCKS keys this key contains a directory AND filename so
3171
3188
  // it has to be handled differently.
3172
- 'node_modules/.package-lock.json': NPM
3189
+ [`${NODE_MODULES}/.package-lock.json`]: NPM
3173
3190
  };
3174
3191
  async function getAgentExecPath(agent) {
3175
3192
  const binName = binByAgent.get(agent);
3176
3193
  if (binName === NPM) {
3177
- return constants.npmExecPath;
3194
+ return constants.default.npmExecPath;
3178
3195
  }
3179
3196
  return (await vendor.libExports$1(binName, {
3180
3197
  nothrow: true
@@ -3193,7 +3210,7 @@ async function getAgentVersion(agent, agentExecPath, cwd) {
3193
3210
  // All package managers support the "--version" flag.
3194
3211
  (await spawn.spawn(agentExecPath, ['--version'], {
3195
3212
  cwd,
3196
- shell: constants.WIN32
3213
+ shell: constants.default.WIN32
3197
3214
  })).stdout) ?? undefined;
3198
3215
  } catch (e) {
3199
3216
  require$$9.debugFn('error', `caught: ${quotedCmd} failed`);
@@ -3249,8 +3266,8 @@ async function detectPackageEnvironment({
3249
3266
  }
3250
3267
  const {
3251
3268
  maintainedNodeVersions
3252
- } = constants;
3253
- const minSupportedAgentVersion = constants.minimumVersionByAgent.get(agent);
3269
+ } = constants.default;
3270
+ const minSupportedAgentVersion = constants.default.minimumVersionByAgent.get(agent);
3254
3271
  const minSupportedNodeMajor = vendor.semverExports.major(maintainedNodeVersions.last);
3255
3272
  const minSupportedNodeVersion = `${minSupportedNodeMajor}.0.0`;
3256
3273
  const minSupportedNodeRange = `>=${minSupportedNodeMajor}`;
@@ -3360,7 +3377,7 @@ async function detectAndValidatePackageEnvironment(cwd, options) {
3360
3377
  } = details;
3361
3378
  const agentVersion = details.agentVersion ?? 'unknown';
3362
3379
  if (!details.agentSupported) {
3363
- const minVersion = constants.minimumVersionByAgent.get(agent);
3380
+ const minVersion = constants.default.minimumVersionByAgent.get(agent);
3364
3381
  return {
3365
3382
  ok: false,
3366
3383
  message: 'Version mismatch',
@@ -3368,7 +3385,7 @@ async function detectAndValidatePackageEnvironment(cwd, options) {
3368
3385
  };
3369
3386
  }
3370
3387
  if (!details.nodeSupported) {
3371
- const minVersion = constants.maintainedNodeVersions.last;
3388
+ const minVersion = constants.default.maintainedNodeVersions.last;
3372
3389
  return {
3373
3390
  ok: false,
3374
3391
  message: 'Version mismatch',
@@ -3420,7 +3437,7 @@ async function detectAndValidatePackageEnvironment(cwd, options) {
3420
3437
  }
3421
3438
  if (details.lockPath && path.relative(cwd, details.lockPath).startsWith('.')) {
3422
3439
  // Note: In tests we return <redacted> because otherwise snapshots will fail.
3423
- logger?.warn(cmdPrefixMessage(cmdName, `Package ${lockName} found at ${constants.ENV.VITEST ? constants.REDACTED : details.lockPath}`));
3440
+ logger?.warn(cmdPrefixMessage(cmdName, `Package ${lockName} found at ${constants.default.ENV.VITEST ? constants.default.REDACTED : details.lockPath}`));
3424
3441
  }
3425
3442
  return {
3426
3443
  ok: true,
@@ -3428,7 +3445,7 @@ async function detectAndValidatePackageEnvironment(cwd, options) {
3428
3445
  };
3429
3446
  }
3430
3447
 
3431
- const ALL_ECOSYSTEMS = ['apk', 'bitbucket', 'cargo', 'chrome', 'cocoapods', 'composer', 'conan', 'conda', 'cran', 'deb', 'docker', 'gem', 'generic', 'github', 'golang', 'hackage', 'hex', 'huggingface', 'maven', 'mlflow', 'npm', 'nuget', 'oci', 'pub', 'pypi', 'qpkg', 'rpm', 'swift', 'swid', 'unknown'];
3448
+ const ALL_ECOSYSTEMS = ['apk', 'bitbucket', 'cargo', 'chrome', 'cocoapods', 'composer', 'conan', 'conda', 'cran', 'deb', 'docker', 'gem', 'generic', 'github', 'golang', 'hackage', 'hex', 'huggingface', 'maven', 'mlflow', constants.NPM, 'nuget', 'oci', 'pub', 'pypi', 'qpkg', 'rpm', 'swift', 'swid', 'unknown'];
3432
3449
  new Set(ALL_ECOSYSTEMS);
3433
3450
  function getEcosystemChoicesForMeow() {
3434
3451
  return [...ALL_ECOSYSTEMS];
@@ -3438,7 +3455,7 @@ function isArtifactAlertCve(alert) {
3438
3455
  const {
3439
3456
  type
3440
3457
  } = alert;
3441
- return type === constants.ALERT_TYPE_CVE || type === constants.ALERT_TYPE_MEDIUM_CVE || type === constants.ALERT_TYPE_MILD_CVE || type === constants.ALERT_TYPE_CRITICAL_CVE;
3458
+ return type === constants.default.ALERT_TYPE_CVE || type === constants.default.ALERT_TYPE_MEDIUM_CVE || type === constants.default.ALERT_TYPE_MILD_CVE || type === constants.default.ALERT_TYPE_CRITICAL_CVE;
3442
3459
  }
3443
3460
 
3444
3461
  function createEnum(obj) {
@@ -3515,7 +3532,7 @@ const require$1 = Module.createRequire(require('node:url').pathToFileURL(__filen
3515
3532
  let _translations;
3516
3533
  function getTranslations() {
3517
3534
  if (_translations === undefined) {
3518
- _translations = /*@__PURE__*/require$1(path.join(constants.rootPath, 'translations.json'));
3535
+ _translations = /*@__PURE__*/require$1(path.join(constants.default.rootPath, 'translations.json'));
3519
3536
  }
3520
3537
  return _translations;
3521
3538
  }
@@ -3865,7 +3882,7 @@ function logAlertsMap(alertsMap, options) {
3865
3882
  }
3866
3883
 
3867
3884
  function idToNpmPurl(id) {
3868
- return `pkg:npm/${id}`;
3885
+ return `pkg:${constants.NPM}/${id}`;
3869
3886
  }
3870
3887
 
3871
3888
  async function getAlertsMapFromPurls(purls, options) {
@@ -4000,6 +4017,7 @@ exports.getOrgSlugs = getOrgSlugs;
4000
4017
  exports.getOutputKind = getOutputKind;
4001
4018
  exports.getPackageFilesForScan = getPackageFilesForScan;
4002
4019
  exports.getPublicApiToken = getPublicApiToken;
4020
+ exports.getPurlObject = getPurlObject;
4003
4021
  exports.getRepoInfo = getRepoInfo;
4004
4022
  exports.getRepoName = getRepoName;
4005
4023
  exports.getSocketDevPackageOverviewUrlFromPurl = getSocketDevPackageOverviewUrlFromPurl;
@@ -4053,5 +4071,5 @@ exports.toFilterConfig = toFilterConfig;
4053
4071
  exports.updateConfigValue = updateConfigValue;
4054
4072
  exports.walkNestedMap = walkNestedMap;
4055
4073
  exports.writeSocketJson = writeSocketJson;
4056
- //# debugId=c9a337ab-9c3d-4d21-a5a6-ef5d89be0e38
4074
+ //# debugId=7cff9fde-d98e-4cf5-94ca-db24c760fc8e
4057
4075
  //# sourceMappingURL=utils.js.map