@socketsecurity/cli 0.10.1 → 0.11.1

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 (81) hide show
  1. package/README.md +22 -22
  2. package/bin/npm +2 -0
  3. package/bin/npx +2 -0
  4. package/dist/cli.d.ts +3 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +3419 -0
  7. package/dist/errors.d.ts +7 -0
  8. package/dist/link.d.ts +2 -0
  9. package/dist/link.js +45 -0
  10. package/dist/npm-cli.d.ts +2 -0
  11. package/dist/npm-cli.js +84 -0
  12. package/dist/npm-injection.d.ts +1 -0
  13. package/dist/npm-injection.js +913 -0
  14. package/dist/npm-injection2.d.ts +25 -0
  15. package/dist/npm-injection2.js +899 -0
  16. package/dist/npx-cli.d.ts +2 -0
  17. package/dist/npx-cli.js +60 -0
  18. package/dist/path-resolve.d.ts +12 -0
  19. package/dist/path-resolve.js +139 -0
  20. package/dist/sdk.d.ts +27 -0
  21. package/dist/sdk.js +224 -0
  22. package/dist/settings.d.ts +9 -0
  23. package/dist/type-helpers.d.ts +3 -0
  24. package/dist/vendor.js +25421 -0
  25. package/package.json +105 -52
  26. package/{lib/shadow/translations.json → translations.json} +20 -20
  27. package/cli.js +0 -72
  28. package/lib/commands/audit-log/index.js +0 -162
  29. package/lib/commands/cdxgen/index.js +0 -211
  30. package/lib/commands/dependencies/index.js +0 -150
  31. package/lib/commands/index.js +0 -14
  32. package/lib/commands/info/index.js +0 -287
  33. package/lib/commands/login/index.js +0 -170
  34. package/lib/commands/logout/index.js +0 -35
  35. package/lib/commands/npm/index.js +0 -27
  36. package/lib/commands/npx/index.js +0 -22
  37. package/lib/commands/raw-npm/index.js +0 -59
  38. package/lib/commands/raw-npx/index.js +0 -59
  39. package/lib/commands/report/create.js +0 -251
  40. package/lib/commands/report/index.js +0 -24
  41. package/lib/commands/report/view.js +0 -176
  42. package/lib/commands/repos/create.js +0 -166
  43. package/lib/commands/repos/delete.js +0 -93
  44. package/lib/commands/repos/index.js +0 -30
  45. package/lib/commands/repos/list.js +0 -170
  46. package/lib/commands/repos/update.js +0 -166
  47. package/lib/commands/repos/view.js +0 -128
  48. package/lib/commands/scan/create.js +0 -245
  49. package/lib/commands/scan/delete.js +0 -112
  50. package/lib/commands/scan/index.js +0 -30
  51. package/lib/commands/scan/list.js +0 -192
  52. package/lib/commands/scan/metadata.js +0 -113
  53. package/lib/commands/scan/stream.js +0 -115
  54. package/lib/commands/wrapper/index.js +0 -199
  55. package/lib/flags/command.js +0 -14
  56. package/lib/flags/index.js +0 -3
  57. package/lib/flags/output.js +0 -16
  58. package/lib/flags/validation.js +0 -14
  59. package/lib/shadow/bin/npm +0 -2
  60. package/lib/shadow/bin/npx +0 -2
  61. package/lib/shadow/link.cjs +0 -50
  62. package/lib/shadow/npm-cli.cjs +0 -27
  63. package/lib/shadow/npm-injection.cjs +0 -649
  64. package/lib/shadow/npx-cli.cjs +0 -27
  65. package/lib/shadow/package.json +0 -3
  66. package/lib/shadow/tty-server.cjs +0 -222
  67. package/lib/shadow/update-notifier.mjs +0 -3
  68. package/lib/utils/api-helpers.js +0 -42
  69. package/lib/utils/chalk-markdown.js +0 -125
  70. package/lib/utils/errors.js +0 -14
  71. package/lib/utils/flags.js +0 -27
  72. package/lib/utils/format-issues.js +0 -99
  73. package/lib/utils/formatting.js +0 -47
  74. package/lib/utils/issue-rules.cjs +0 -180
  75. package/lib/utils/meow-with-subcommands.js +0 -87
  76. package/lib/utils/misc.js +0 -61
  77. package/lib/utils/path-resolve.js +0 -204
  78. package/lib/utils/sdk.js +0 -99
  79. package/lib/utils/settings.js +0 -69
  80. package/lib/utils/type-helpers.cjs +0 -13
  81. package/lib/utils/update-notifier.js +0 -18
@@ -0,0 +1,7 @@
1
+ declare class AuthError extends Error {
2
+ }
3
+ declare class InputError extends Error {
4
+ body: string | undefined;
5
+ constructor(message: string, body?: string);
6
+ }
7
+ export { AuthError, InputError };
package/dist/link.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare function installLinks(realDirname: string, binName: 'npm' | 'npx'): string;
2
+ export { installLinks };
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$$2 = 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$$2;
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;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -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:child_process');
6
+ var require$$0$1 = require('node:fs');
7
+ var require$$1 = require('node:path');
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 _nodeChild_process = require$$0;
16
+ var _nodeFs = require$$0$1;
17
+ var _nodePath = require$$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
+ (0, _nodeChild_process.spawn)(process.execPath, ['--require', injectionPath, npmPath, ...process.argv.slice(2), ...npmArgs], {
48
+ stdio: 'inherit'
49
+ }).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 {};