@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.
- package/bin/cli.js +2 -4
- package/bin/npm-cli.js +2 -4
- package/bin/npx-cli.js +2 -4
- package/dist/module-sync/cli.js +137 -112
- package/dist/module-sync/constants.d.ts +8 -2
- package/dist/module-sync/constants.js +34 -16
- package/dist/module-sync/link.js +15 -3
- package/dist/module-sync/npm-cli.js +21 -9
- package/dist/module-sync/npm-injection.js +406 -173
- package/dist/module-sync/npx-cli.js +19 -7
- package/dist/module-sync/path-resolve.js +17 -5
- package/dist/module-sync/sdk.d.ts +1 -2
- package/dist/module-sync/sdk.js +42 -32
- package/dist/module-sync/vendor.js +82 -0
- package/dist/require/cli.js +102 -76
- package/dist/require/constants.d.ts +8 -2
- package/dist/require/constants.js +35 -12
- package/dist/require/link.js +15 -3
- package/dist/require/npm-cli.js +19 -7
- package/dist/require/npm-injection.js +167 -170
- package/dist/require/npx-cli.js +17 -5
- package/dist/require/path-resolve.js +17 -5
- package/dist/require/sdk.d.ts +1 -2
- package/dist/require/sdk.js +36 -26
- package/dist/require/vendor.js +23 -11
- package/package.json +6 -4
- package/translations.json +191 -288
|
@@ -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,
|
|
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,21 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
11
13
|
}
|
|
12
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'));
|
|
20
|
+
|
|
13
21
|
var constants = {};
|
|
14
22
|
|
|
15
23
|
Object.defineProperty(constants, "__esModule", {
|
|
16
24
|
value: true
|
|
17
25
|
});
|
|
18
|
-
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;
|
|
19
27
|
var _nodeFs = require$$0;
|
|
20
28
|
var _nodePath = require$$1;
|
|
21
29
|
var _env = require$$2;
|
|
@@ -24,20 +32,31 @@ var _semver = require$$4;
|
|
|
24
32
|
const {
|
|
25
33
|
PACKAGE_JSON
|
|
26
34
|
} = _constants;
|
|
35
|
+
const SUPPORTS_SYNC_ESM = constants.SUPPORTS_SYNC_ESM = _semver.satisfies(process.versions.node, '>=22.12');
|
|
27
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';
|
|
28
43
|
constants.ENV = Object.freeze({
|
|
29
44
|
// Flag set by the optimize command to bypass the packagesHaveRiskyIssues check.
|
|
30
|
-
UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE: (0, _env.envAsBoolean)(process.env[
|
|
45
|
+
[UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE]: (0, _env.envAsBoolean)(process.env[UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE])
|
|
31
46
|
});
|
|
32
|
-
|
|
47
|
+
|
|
48
|
+
// Dynamically detect the rootPath so constants.ts can be used in tests.
|
|
33
49
|
const rootPath = constants.rootPath = (() => {
|
|
34
50
|
let oldPath;
|
|
35
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`.
|
|
36
54
|
while (currPath !== oldPath) {
|
|
37
55
|
const pkgJsonPath = _nodePath.join(currPath, PACKAGE_JSON);
|
|
38
56
|
if ((0, _nodeFs.existsSync)(pkgJsonPath)) {
|
|
39
57
|
try {
|
|
40
|
-
// @socketsecurity/cli is replaced by
|
|
58
|
+
// Content matching @socketsecurity/cli is replaced by
|
|
59
|
+
// the @rollup/plugin-replace plugin used in .config/rollup.base.config.mjs
|
|
41
60
|
// with either 'socket' or '@socketsecurity/cli'.
|
|
42
61
|
if (require(pkgJsonPath)?.name === '@socketsecurity/cli') {
|
|
43
62
|
return currPath;
|
|
@@ -47,16 +66,15 @@ const rootPath = constants.rootPath = (() => {
|
|
|
47
66
|
oldPath = currPath;
|
|
48
67
|
currPath = _nodePath.dirname(currPath);
|
|
49
68
|
}
|
|
50
|
-
throw new TypeError(
|
|
69
|
+
throw new TypeError(`Socket CLI initialization error: rootPath cannot be resolved.\n\nPlease report to ${SOCKET_CLI_ISSUES_URL}.`);
|
|
51
70
|
})();
|
|
52
71
|
const rootDistPath = constants.rootDistPath = _nodePath.join(rootPath, 'dist');
|
|
53
72
|
constants.rootBinPath = _nodePath.join(rootPath, 'bin');
|
|
54
73
|
constants.rootPkgJsonPath = _nodePath.join(rootPath, PACKAGE_JSON);
|
|
55
74
|
const nmBinPath = constants.nmBinPath = _nodePath.join(rootPath, 'node_modules/.bin');
|
|
56
75
|
constants.cdxgenBinPath = _nodePath.join(nmBinPath, 'cdxgen');
|
|
57
|
-
constants.distPath = _nodePath.join(rootDistPath,
|
|
58
|
-
constants.shadowBinPath = _nodePath.join(rootPath, 'shadow',
|
|
76
|
+
constants.distPath = _nodePath.join(rootDistPath, DIST_TYPE);
|
|
77
|
+
constants.shadowBinPath = _nodePath.join(rootPath, 'shadow', DIST_TYPE);
|
|
59
78
|
constants.synpBinPath = _nodePath.join(nmBinPath, 'synp');
|
|
60
79
|
|
|
61
80
|
exports.constants = constants;
|
|
62
|
-
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
package/dist/module-sync/link.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
|
@@ -55,7 +67,7 @@ spawnPromise.process.on('exit', (code, signal) => {
|
|
|
55
67
|
|
|
56
68
|
(function (exports) {
|
|
57
69
|
|
|
58
|
-
var _interopRequireWildcard =
|
|
70
|
+
var _interopRequireWildcard = vendor.interopRequireWildcard.default;
|
|
59
71
|
Object.defineProperty(exports, "__esModule", {
|
|
60
72
|
value: true
|
|
61
73
|
});
|
|
@@ -80,6 +92,6 @@ spawnPromise.process.on('exit', (code, signal) => {
|
|
|
80
92
|
});
|
|
81
93
|
} (npmCli$2));
|
|
82
94
|
|
|
83
|
-
var npmCli = /*@__PURE__*/
|
|
95
|
+
var npmCli = /*@__PURE__*/vendor.getDefaultExportFromCjs(npmCli$2);
|
|
84
96
|
|
|
85
97
|
module.exports = npmCli;
|