@socketsecurity/cli 0.14.29 → 0.14.31

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.
@@ -1,8 +1,14 @@
1
+ declare const SUPPORTS_SYNC_ESM: boolean;
1
2
  declare const API_V0_URL = "https://api.socket.dev/v0";
3
+ declare const DIST_TYPE: string;
4
+ declare const LOOP_SENTINEL = 1000000;
5
+ declare const NPM_REGISTRY_URL = "https://registry.npmjs.org";
6
+ declare const SOCKET_PUBLIC_API_KEY = "sktsec_t_--RAN5U4ivauy4w37-6aoKyYPDt5ZbaT5JBVMqiwKo_api";
7
+ declare const SOCKET_CLI_ISSUES_URL = "https://github.com/SocketDev/socket-cli/issues";
8
+ declare const UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE = "UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE";
2
9
  declare const ENV: Readonly<{
3
10
  UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE: boolean;
4
11
  }>;
5
- declare const SUPPORTS_SYNC_ESM: boolean;
6
12
  declare const rootPath: string;
7
13
  declare const rootDistPath: string;
8
14
  declare const rootBinPath: string;
@@ -12,4 +18,4 @@ declare const cdxgenBinPath: string;
12
18
  declare const distPath: string;
13
19
  declare const shadowBinPath: string;
14
20
  declare const synpBinPath: string;
15
- export { API_V0_URL, ENV, SUPPORTS_SYNC_ESM, rootPath, rootDistPath, rootBinPath, rootPkgJsonPath, nmBinPath, cdxgenBinPath, distPath, shadowBinPath, synpBinPath };
21
+ export { SUPPORTS_SYNC_ESM, API_V0_URL, DIST_TYPE, LOOP_SENTINEL, NPM_REGISTRY_URL, SOCKET_PUBLIC_API_KEY, SOCKET_CLI_ISSUES_URL, UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE, ENV, rootPath, rootDistPath, rootBinPath, rootPkgJsonPath, nmBinPath, cdxgenBinPath, distPath, shadowBinPath, synpBinPath };
@@ -1,17 +1,29 @@
1
1
  'use strict';
2
2
 
3
- var require$$0 = require('node:fs');
4
- var require$$1 = require('node:path');
5
- var require$$2 = require('@socketsecurity/registry/lib/env');
6
- var require$$3 = require('@socketsecurity/registry/lib/constants');
7
- var require$$4 = require('semver');
3
+ function _interop(e) {
4
+ let d
5
+ if (e) {
6
+ let c = 0
7
+ for (const k in e) {
8
+ d = c++ === 0 && k === 'default' ? e[k] : void 0
9
+ if (!d) break
10
+ }
11
+ }
12
+ return d ?? e
13
+ }
14
+
15
+ var require$$0 = _interop(require('node:fs'));
16
+ var require$$1 = _interop(require('node:path'));
17
+ var require$$2 = _interop(require('@socketsecurity/registry/lib/env'));
18
+ var require$$3 = _interop(require('@socketsecurity/registry/lib/constants'));
19
+ var require$$4 = _interop(require('semver'));
8
20
 
9
21
  var constants = {};
10
22
 
11
23
  Object.defineProperty(constants, "__esModule", {
12
24
  value: true
13
25
  });
14
- constants.synpBinPath = constants.shadowBinPath = constants.rootPkgJsonPath = constants.rootPath = constants.rootDistPath = constants.rootBinPath = constants.nmBinPath = constants.distPath = constants.cdxgenBinPath = constants.SUPPORTS_SYNC_ESM = constants.ENV = constants.API_V0_URL = void 0;
26
+ constants.synpBinPath = constants.shadowBinPath = constants.rootPkgJsonPath = constants.rootPath = constants.rootDistPath = constants.rootBinPath = constants.nmBinPath = constants.distPath = constants.cdxgenBinPath = constants.UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE = constants.SUPPORTS_SYNC_ESM = constants.SOCKET_PUBLIC_API_KEY = constants.SOCKET_CLI_ISSUES_URL = constants.NPM_REGISTRY_URL = constants.LOOP_SENTINEL = constants.ENV = constants.DIST_TYPE = constants.API_V0_URL = void 0;
15
27
  var _nodeFs = require$$0;
16
28
  var _nodePath = require$$1;
17
29
  var _env = require$$2;
@@ -20,20 +32,31 @@ var _semver = require$$4;
20
32
  const {
21
33
  PACKAGE_JSON
22
34
  } = _constants;
35
+ const SUPPORTS_SYNC_ESM = constants.SUPPORTS_SYNC_ESM = _semver.satisfies(process.versions.node, '>=22.12');
23
36
  constants.API_V0_URL = 'https://api.socket.dev/v0';
37
+ const DIST_TYPE = constants.DIST_TYPE = SUPPORTS_SYNC_ESM ? 'module-sync' : 'require';
38
+ constants.LOOP_SENTINEL = 1_000_000;
39
+ constants.NPM_REGISTRY_URL = 'https://registry.npmjs.org';
40
+ constants.SOCKET_PUBLIC_API_KEY = 'sktsec_t_--RAN5U4ivauy4w37-6aoKyYPDt5ZbaT5JBVMqiwKo_api';
41
+ const SOCKET_CLI_ISSUES_URL = constants.SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues';
42
+ const UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE = constants.UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE = 'UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE';
24
43
  constants.ENV = Object.freeze({
25
44
  // Flag set by the optimize command to bypass the packagesHaveRiskyIssues check.
26
- UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE: (0, _env.envAsBoolean)(process.env['UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE'])
45
+ [UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE]: (0, _env.envAsBoolean)(process.env[UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE])
27
46
  });
28
- const SUPPORTS_SYNC_ESM = constants.SUPPORTS_SYNC_ESM = _semver.satisfies(process.versions.node, '>=22.12');
47
+
48
+ // Dynamically detect the rootPath so constants.ts can be used in tests.
29
49
  const rootPath = constants.rootPath = (() => {
30
50
  let oldPath;
31
51
  let currPath = (0, _nodeFs.realpathSync)(__dirname);
52
+ // Dirname stops when at the filepath root, e.g. '/' for posix and 'C:\\' for win32,
53
+ // so `currPath` equal `oldPath`.
32
54
  while (currPath !== oldPath) {
33
55
  const pkgJsonPath = _nodePath.join(currPath, PACKAGE_JSON);
34
56
  if ((0, _nodeFs.existsSync)(pkgJsonPath)) {
35
57
  try {
36
- // @socketsecurity/cli is replaced by .config/rollup.base.config.mjs
58
+ // Content matching @socketsecurity/cli is replaced by
59
+ // the @rollup/plugin-replace plugin used in .config/rollup.base.config.mjs
37
60
  // with either 'socket' or '@socketsecurity/cli'.
38
61
  if (require(pkgJsonPath)?.name === '@socketsecurity/cli') {
39
62
  return currPath;
@@ -43,15 +66,15 @@ const rootPath = constants.rootPath = (() => {
43
66
  oldPath = currPath;
44
67
  currPath = _nodePath.dirname(currPath);
45
68
  }
46
- throw new TypeError('rootPath cannot be resolved.');
69
+ throw new TypeError(`Socket CLI initialization error: rootPath cannot be resolved.\n\nPlease report to ${SOCKET_CLI_ISSUES_URL}.`);
47
70
  })();
48
71
  const rootDistPath = constants.rootDistPath = _nodePath.join(rootPath, 'dist');
49
72
  constants.rootBinPath = _nodePath.join(rootPath, 'bin');
50
73
  constants.rootPkgJsonPath = _nodePath.join(rootPath, PACKAGE_JSON);
51
74
  const nmBinPath = constants.nmBinPath = _nodePath.join(rootPath, 'node_modules/.bin');
52
75
  constants.cdxgenBinPath = _nodePath.join(nmBinPath, 'cdxgen');
53
- constants.distPath = _nodePath.join(rootDistPath, SUPPORTS_SYNC_ESM ? 'module-sync' : 'require');
54
- constants.shadowBinPath = _nodePath.join(rootPath, 'shadow', SUPPORTS_SYNC_ESM ? 'module-sync' : 'require');
76
+ constants.distPath = _nodePath.join(rootDistPath, DIST_TYPE);
77
+ constants.shadowBinPath = _nodePath.join(rootPath, 'shadow', DIST_TYPE);
55
78
  constants.synpBinPath = _nodePath.join(nmBinPath, 'synp');
56
79
 
57
80
  exports.constants = constants;
@@ -1,8 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var require$$0 = require('node:fs');
4
- var require$$1 = require('node:path');
5
- var require$$4 = require('which');
3
+ function _interop(e) {
4
+ let d
5
+ if (e) {
6
+ let c = 0
7
+ for (const k in e) {
8
+ d = c++ === 0 && k === 'default' ? e[k] : void 0
9
+ if (!d) break
10
+ }
11
+ }
12
+ return d ?? e
13
+ }
14
+
15
+ var require$$0 = _interop(require('node:fs'));
16
+ var require$$1 = _interop(require('node:path'));
17
+ var require$$4 = _interop(require('which'));
6
18
 
7
19
  var link = {};
8
20
 
@@ -1,13 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var vendor = require('./vendor.js');
5
- var require$$0 = require('node:fs');
6
- var require$$1 = require('node:path');
7
- var require$$1$1 = require('@npmcli/promise-spawn');
8
- var constants = require('./constants.js');
9
- var link = require('./link.js');
10
- var pathResolve = require('./path-resolve.js');
4
+ function _interop(e) {
5
+ let d
6
+ if (e) {
7
+ let c = 0
8
+ for (const k in e) {
9
+ d = c++ === 0 && k === 'default' ? e[k] : void 0
10
+ if (!d) break
11
+ }
12
+ }
13
+ return d ?? e
14
+ }
15
+
16
+ var vendor = _interop(require('./vendor.js'));
17
+ var require$$0 = _interop(require('node:fs'));
18
+ var require$$1 = _interop(require('node:path'));
19
+ var require$$1$1 = _interop(require('@npmcli/promise-spawn'));
20
+ var constants = _interop(require('./constants.js'));
21
+ var link = _interop(require('./link.js'));
22
+ var pathResolve = _interop(require('./path-resolve.js'));
11
23
 
12
24
  var npmCli$2 = {};
13
25