@socketsecurity/cli 0.14.3 → 0.14.5
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/dist/chalk-markdown.d.ts +23 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +4701 -0
- package/dist/errors.d.ts +7 -0
- package/dist/link.d.ts +2 -0
- package/dist/link.js +45 -0
- package/dist/npm-cli.d.ts +2 -0
- package/dist/npm-cli.js +84 -0
- package/dist/npm-injection.d.ts +1 -0
- package/dist/npm-injection.js +1437 -0
- package/dist/npx-cli.d.ts +2 -0
- package/dist/npx-cli.js +61 -0
- package/dist/path-resolve.d.ts +11 -0
- package/dist/path-resolve.js +136 -0
- package/dist/sdk.d.ts +13 -0
- package/dist/sdk.js +270 -0
- package/dist/settings.d.ts +9 -0
- package/dist/vendor.d.ts +0 -0
- package/dist/vendor.js +18048 -0
- package/package.json +2 -1
package/dist/errors.d.ts
ADDED
package/dist/link.d.ts
ADDED
package/dist/link.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var require$$0 = require('node:fs');
|
|
4
|
+
var require$$1 = require('node:path');
|
|
5
|
+
var require$$5 = require('which');
|
|
6
|
+
|
|
7
|
+
var link = {};
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(link, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
link.installLinks = installLinks;
|
|
13
|
+
var _nodeFs = require$$0;
|
|
14
|
+
var _nodePath = require$$1;
|
|
15
|
+
var _which = require$$5;
|
|
16
|
+
function installLinks(realDirname, binName) {
|
|
17
|
+
const realShadowBinDir = realDirname;
|
|
18
|
+
// find package manager being shadowed by this process
|
|
19
|
+
const bins = _which.sync(binName, {
|
|
20
|
+
all: true
|
|
21
|
+
});
|
|
22
|
+
let shadowIndex = -1;
|
|
23
|
+
const binPath = bins.find((binPath, i) => {
|
|
24
|
+
if ((0, _nodeFs.realpathSync)(_nodePath.dirname(binPath)) === realShadowBinDir) {
|
|
25
|
+
shadowIndex = i;
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
});
|
|
30
|
+
const isWin = process.platform === 'win32';
|
|
31
|
+
if (isWin && binPath) {
|
|
32
|
+
return binPath;
|
|
33
|
+
}
|
|
34
|
+
if (!binPath) {
|
|
35
|
+
console.error(`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable`);
|
|
36
|
+
process.exit(127);
|
|
37
|
+
}
|
|
38
|
+
if (shadowIndex === -1) {
|
|
39
|
+
const binDir = _nodePath.join(realDirname);
|
|
40
|
+
process.env['PATH'] = `${binDir}${isWin ? ';' : ':'}${process.env['PATH']}`;
|
|
41
|
+
}
|
|
42
|
+
return binPath;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
exports.link = link;
|
package/dist/npm-cli.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
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 link = require('./link.js');
|
|
9
|
+
var pathResolve = require('./path-resolve.js');
|
|
10
|
+
|
|
11
|
+
var npmCli$1 = {};
|
|
12
|
+
|
|
13
|
+
var npmCli = {};
|
|
14
|
+
|
|
15
|
+
var _nodeFs = require$$0;
|
|
16
|
+
var _nodePath = require$$1;
|
|
17
|
+
var _promiseSpawn = require$$1$1;
|
|
18
|
+
var _link = link.link;
|
|
19
|
+
var _pathResolve = pathResolve.pathResolve;
|
|
20
|
+
const realFilename = (0, _nodeFs.realpathSync)(__filename);
|
|
21
|
+
const realDirname = _nodePath.dirname(realFilename);
|
|
22
|
+
const npmPath = (0, _link.installLinks)(_nodePath.join(realDirname, 'bin'), 'npm');
|
|
23
|
+
const injectionPath = _nodePath.join(realDirname, 'npm-injection.js');
|
|
24
|
+
process.exitCode = 1;
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
Adding the `--quiet` and `--no-progress` flags when the `proc-log` module
|
|
28
|
+
is found to fix a UX issue when running the command with recent versions of npm
|
|
29
|
+
(input swallowed by the standard npm spinner)
|
|
30
|
+
*/
|
|
31
|
+
let npmArgs = [];
|
|
32
|
+
if (process.argv.slice(2).includes('install')) {
|
|
33
|
+
const npmEntrypoint = (0, _nodeFs.realpathSync)(npmPath);
|
|
34
|
+
const npmRootPath = (0, _pathResolve.findRoot)(_nodePath.dirname(npmEntrypoint));
|
|
35
|
+
if (npmRootPath === undefined) {
|
|
36
|
+
process.exit(127);
|
|
37
|
+
}
|
|
38
|
+
const npmDepPath = _nodePath.join(npmRootPath, 'node_modules');
|
|
39
|
+
let npmlog;
|
|
40
|
+
try {
|
|
41
|
+
npmlog = require(_nodePath.join(npmDepPath, 'proc-log/lib/index.js')).log;
|
|
42
|
+
} catch {}
|
|
43
|
+
if (npmlog) {
|
|
44
|
+
npmArgs = ['--quiet', '--no-progress'];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
_promiseSpawn(process.execPath, ['--require', injectionPath, npmPath, ...process.argv.slice(2), ...npmArgs], {
|
|
48
|
+
stdio: 'inherit'
|
|
49
|
+
}).process.on('exit', (code, signal) => {
|
|
50
|
+
if (signal) {
|
|
51
|
+
process.kill(process.pid, signal);
|
|
52
|
+
} else if (code !== null) {
|
|
53
|
+
process.exit(code);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
(function (exports) {
|
|
58
|
+
|
|
59
|
+
var _interopRequireWildcard = vendor.interopRequireWildcard.default;
|
|
60
|
+
Object.defineProperty(exports, "__esModule", {
|
|
61
|
+
value: true
|
|
62
|
+
});
|
|
63
|
+
var _exportNames = {};
|
|
64
|
+
Object.defineProperty(exports, "default", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return _npmCli.default;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
var _npmCli = _interopRequireWildcard(npmCli, true);
|
|
71
|
+
Object.keys(_npmCli).forEach(function (key) {
|
|
72
|
+
if (key === "default" || key === "__esModule") return;
|
|
73
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
74
|
+
if (key in exports && exports[key] === _npmCli[key]) return;
|
|
75
|
+
Object.defineProperty(exports, key, {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () {
|
|
78
|
+
return _npmCli[key];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
} (npmCli$1));
|
|
83
|
+
|
|
84
|
+
module.exports = npmCli$1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|