socket 0.14.33 → 0.14.35
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 +34 -4
- package/bin/npm-cli.js +3 -4
- package/bin/npx-cli.js +3 -4
- package/dist/constants.js +59 -0
- package/dist/module-sync/cli.d.ts +0 -1
- package/dist/module-sync/cli.js +637 -1423
- package/dist/module-sync/constants.d.ts +24 -21
- package/dist/module-sync/constants.d.ts.map +1 -0
- package/dist/module-sync/constants.js +2 -79
- package/dist/module-sync/npm-injection.js +116 -435
- package/dist/module-sync/path-resolve.js +24 -45
- package/dist/module-sync/sdk.js +69 -118
- package/dist/module-sync/shadow-bin.d.ts +2 -0
- package/dist/module-sync/shadow-bin.js +109 -0
- package/dist/require/cli.js +633 -1418
- package/dist/require/constants.d.ts.map +1 -0
- package/dist/require/constants.js +2 -79
- package/dist/require/npm-injection.js +116 -434
- package/dist/require/path-resolve.js +24 -45
- package/dist/require/sdk.js +67 -115
- package/dist/require/shadow-bin.js +109 -0
- package/dist/require/vendor.js +8300 -8798
- package/package.json +39 -54
- package/shadow-bin/npm +4 -0
- package/shadow-bin/npx +4 -0
- package/bin/shadow/module-sync/npm +0 -3
- package/bin/shadow/module-sync/npx +0 -3
- package/bin/shadow/require/npm +0 -3
- package/bin/shadow/require/npx +0 -3
- package/dist/module-sync/cli.d.ts.map +0 -1
- package/dist/module-sync/link.d.ts +0 -2
- package/dist/module-sync/link.js +0 -57
- package/dist/module-sync/npm-cli.d.ts +0 -2
- package/dist/module-sync/npm-cli.js +0 -97
- package/dist/module-sync/npx-cli.d.ts +0 -2
- package/dist/module-sync/npx-cli.js +0 -73
- package/dist/module-sync/vendor.js +0 -82
- package/dist/require/cli.d.ts +0 -3
- package/dist/require/cli.d.ts.map +0 -1
- package/dist/require/color-or-markdown.d.ts +0 -23
- package/dist/require/constants.d.ts +0 -21
- package/dist/require/errors.d.ts +0 -7
- package/dist/require/link.d.ts +0 -2
- package/dist/require/link.js +0 -57
- package/dist/require/npm-cli.d.ts +0 -2
- package/dist/require/npm-cli.js +0 -97
- package/dist/require/npm-injection.d.ts +0 -1
- package/dist/require/npx-cli.d.ts +0 -2
- package/dist/require/npx-cli.js +0 -73
- package/dist/require/path-resolve.d.ts +0 -8
- package/dist/require/sdk.d.ts +0 -8
- package/dist/require/settings.d.ts +0 -9
package/bin/cli.js
CHANGED
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict'
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const constants = require('../dist/constants')
|
|
5
|
+
|
|
6
|
+
const { DIST_TYPE } = constants
|
|
7
|
+
|
|
8
|
+
if (DIST_TYPE === 'require') {
|
|
9
|
+
require(`../dist/${DIST_TYPE}/cli.js`)
|
|
10
|
+
} else {
|
|
11
|
+
const path = require('node:path')
|
|
12
|
+
const spawn = require('@npmcli/promise-spawn')
|
|
13
|
+
|
|
14
|
+
const { abortSignal, execPath, rootDistPath } = constants
|
|
15
|
+
|
|
16
|
+
process.exitCode = 1
|
|
17
|
+
const spawnPromise = spawn(
|
|
18
|
+
execPath,
|
|
19
|
+
[
|
|
20
|
+
// Lazily access constants.nodeNoWarningsFlags.
|
|
21
|
+
...constants.nodeNoWarningsFlags,
|
|
22
|
+
path.join(rootDistPath, DIST_TYPE, 'cli.js'),
|
|
23
|
+
...process.argv.slice(2)
|
|
24
|
+
],
|
|
25
|
+
{
|
|
26
|
+
signal: abortSignal,
|
|
27
|
+
stdio: 'inherit'
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
spawnPromise.process.on('exit', (code, signal) => {
|
|
31
|
+
if (signal) {
|
|
32
|
+
process.kill(process.pid, signal)
|
|
33
|
+
} else if (code !== null) {
|
|
34
|
+
process.exit(code)
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
}
|
package/bin/npm-cli.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict'
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require(`../dist/${DIST_TYPE}/npm-cli.js`)
|
|
4
|
+
const constants = require('../dist/constants')
|
|
5
|
+
const shadowBin = require(`../dist/${constants.DIST_TYPE}/shadow-bin.js`)
|
|
6
|
+
shadowBin('npm')
|
package/bin/npx-cli.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict'
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require(`../dist/${DIST_TYPE}/npx-cli.js`)
|
|
4
|
+
const constants = require('../dist/constants')
|
|
5
|
+
const shadowBin = require(`../dist/${constants.DIST_TYPE}/shadow-bin.js`)
|
|
6
|
+
shadowBin('npx')
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('node:fs');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
var env = require('@socketsecurity/registry/lib/env');
|
|
6
|
+
var registryConstants = require('@socketsecurity/registry/lib/constants');
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
kInternalsSymbol,
|
|
10
|
+
PACKAGE_JSON,
|
|
11
|
+
[kInternalsSymbol]: {
|
|
12
|
+
createConstantsObject
|
|
13
|
+
}
|
|
14
|
+
} = registryConstants;
|
|
15
|
+
const API_V0_URL = 'https://api.socket.dev/v0';
|
|
16
|
+
const NPM_REGISTRY_URL = 'https://registry.npmjs.org';
|
|
17
|
+
const SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues';
|
|
18
|
+
const UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE = 'UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE';
|
|
19
|
+
const ENV = Object.freeze({
|
|
20
|
+
...registryConstants.ENV,
|
|
21
|
+
// Flag set by the optimize command to bypass the packagesHaveRiskyIssues check.
|
|
22
|
+
[UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE]: env.envAsBoolean(process.env[UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE])
|
|
23
|
+
});
|
|
24
|
+
const rootPath = path.resolve(fs.realpathSync(__dirname), '..');
|
|
25
|
+
const rootDistPath = path.join(rootPath, 'dist');
|
|
26
|
+
const rootBinPath = path.join(rootPath, 'bin');
|
|
27
|
+
const rootPkgJsonPath = path.join(rootPath, PACKAGE_JSON);
|
|
28
|
+
const nmBinPath = path.join(rootPath, 'node_modules/.bin');
|
|
29
|
+
const cdxgenBinPath = path.join(nmBinPath, 'cdxgen');
|
|
30
|
+
const shadowBinPath = path.join(rootPath, 'shadow-bin');
|
|
31
|
+
const synpBinPath = path.join(nmBinPath, 'synp');
|
|
32
|
+
const LAZY_DIST_TYPE = () => registryConstants.SUPPORTS_NODE_REQUIRE_MODULE ? 'module-sync' : 'require';
|
|
33
|
+
const lazyDistPath = () => path.join(rootDistPath, constants.DIST_TYPE);
|
|
34
|
+
const constants = createConstantsObject({
|
|
35
|
+
API_V0_URL,
|
|
36
|
+
ENV,
|
|
37
|
+
// Lazily defined values are initialized as `undefined` to keep their key order.
|
|
38
|
+
DIST_TYPE: undefined,
|
|
39
|
+
NPM_REGISTRY_URL,
|
|
40
|
+
SOCKET_CLI_ISSUES_URL,
|
|
41
|
+
UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE,
|
|
42
|
+
cdxgenBinPath,
|
|
43
|
+
distPath: undefined,
|
|
44
|
+
nmBinPath,
|
|
45
|
+
rootBinPath,
|
|
46
|
+
rootDistPath,
|
|
47
|
+
rootPath,
|
|
48
|
+
rootPkgJsonPath,
|
|
49
|
+
shadowBinPath,
|
|
50
|
+
synpBinPath
|
|
51
|
+
}, {
|
|
52
|
+
getters: {
|
|
53
|
+
DIST_TYPE: LAZY_DIST_TYPE,
|
|
54
|
+
distPath: lazyDistPath
|
|
55
|
+
},
|
|
56
|
+
mixin: registryConstants
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
module.exports = constants;
|