@socketsecurity/cli 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.
Files changed (52) hide show
  1. package/bin/cli.js +34 -4
  2. package/bin/npm-cli.js +3 -4
  3. package/bin/npx-cli.js +3 -4
  4. package/dist/constants.js +59 -0
  5. package/dist/module-sync/cli.d.ts +0 -1
  6. package/dist/module-sync/cli.js +637 -1423
  7. package/dist/module-sync/constants.d.ts +24 -21
  8. package/dist/module-sync/constants.d.ts.map +1 -0
  9. package/dist/module-sync/constants.js +2 -79
  10. package/dist/module-sync/npm-injection.js +116 -436
  11. package/dist/module-sync/path-resolve.js +24 -45
  12. package/dist/module-sync/sdk.js +69 -118
  13. package/dist/module-sync/shadow-bin.d.ts +2 -0
  14. package/dist/module-sync/shadow-bin.js +109 -0
  15. package/dist/require/cli.js +633 -1418
  16. package/dist/require/constants.d.ts.map +1 -0
  17. package/dist/require/constants.js +2 -79
  18. package/dist/require/npm-injection.js +116 -435
  19. package/dist/require/path-resolve.js +24 -45
  20. package/dist/require/sdk.js +67 -115
  21. package/dist/require/shadow-bin.js +109 -0
  22. package/dist/require/vendor.js +8300 -8798
  23. package/package.json +39 -54
  24. package/shadow-bin/npm +4 -0
  25. package/shadow-bin/npx +4 -0
  26. package/bin/shadow/module-sync/npm +0 -3
  27. package/bin/shadow/module-sync/npx +0 -3
  28. package/bin/shadow/require/npm +0 -3
  29. package/bin/shadow/require/npx +0 -3
  30. package/dist/module-sync/cli.d.ts.map +0 -1
  31. package/dist/module-sync/link.d.ts +0 -2
  32. package/dist/module-sync/link.js +0 -57
  33. package/dist/module-sync/npm-cli.d.ts +0 -2
  34. package/dist/module-sync/npm-cli.js +0 -97
  35. package/dist/module-sync/npx-cli.d.ts +0 -2
  36. package/dist/module-sync/npx-cli.js +0 -73
  37. package/dist/module-sync/vendor.js +0 -82
  38. package/dist/require/cli.d.ts +0 -3
  39. package/dist/require/cli.d.ts.map +0 -1
  40. package/dist/require/color-or-markdown.d.ts +0 -23
  41. package/dist/require/constants.d.ts +0 -21
  42. package/dist/require/errors.d.ts +0 -7
  43. package/dist/require/link.d.ts +0 -2
  44. package/dist/require/link.js +0 -57
  45. package/dist/require/npm-cli.d.ts +0 -2
  46. package/dist/require/npm-cli.js +0 -97
  47. package/dist/require/npm-injection.d.ts +0 -1
  48. package/dist/require/npx-cli.d.ts +0 -2
  49. package/dist/require/npx-cli.js +0 -73
  50. package/dist/require/path-resolve.d.ts +0 -8
  51. package/dist/require/sdk.d.ts +0 -8
  52. package/dist/require/settings.d.ts +0 -9
@@ -1,57 +0,0 @@
1
- 'use strict';
2
-
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'));
18
-
19
- var link = {};
20
-
21
- Object.defineProperty(link, "__esModule", {
22
- value: true
23
- });
24
- link.installLinks = installLinks;
25
- var _nodeFs = require$$0;
26
- var _nodePath = require$$1;
27
- var _which = require$$4;
28
- function installLinks(realDirname, binName) {
29
- const realShadowBinDir = realDirname;
30
- // find package manager being shadowed by this process
31
- const bins = _which.sync(binName, {
32
- all: true
33
- });
34
- let shadowIndex = -1;
35
- const binPath = bins.find((binPath, i) => {
36
- if ((0, _nodeFs.realpathSync)(_nodePath.dirname(binPath)) === realShadowBinDir) {
37
- shadowIndex = i;
38
- return false;
39
- }
40
- return true;
41
- });
42
- const isWin = process.platform === 'win32';
43
- if (isWin && binPath) {
44
- return binPath;
45
- }
46
- if (!binPath) {
47
- console.error(`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable`);
48
- process.exit(127);
49
- }
50
- if (shadowIndex === -1) {
51
- const binDir = _nodePath.join(realDirname);
52
- process.env['PATH'] = `${binDir}${isWin ? ';' : ':'}${process.env['PATH']}`;
53
- }
54
- return binPath;
55
- }
56
-
57
- exports.link = link;
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,97 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
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'));
23
-
24
- var npmCli$2 = {};
25
-
26
- var npmCli$1 = {};
27
-
28
- var _nodeFs = require$$0;
29
- var _nodePath = require$$1;
30
- var _promiseSpawn = require$$1$1;
31
- var _constants = constants.constants;
32
- var _link = link.link;
33
- var _pathResolve = pathResolve.pathResolve;
34
- const npmPath = (0, _link.installLinks)(_constants.shadowBinPath, 'npm');
35
- const injectionPath = _nodePath.join(_constants.distPath, 'npm-injection.js');
36
-
37
- // Adding the `--quiet` and `--no-progress` flags when the `proc-log` module
38
- // is found to fix a UX issue when running the command with recent versions of
39
- // npm (input swallowed by the standard npm spinner)
40
- const npmArgs = process.argv.slice(2);
41
- if (npmArgs.includes('install') && !npmArgs.includes('--no-progress') && !npmArgs.includes('--quiet')) {
42
- const npmEntrypoint = (0, _nodeFs.realpathSync)(npmPath);
43
- const npmRootPath = (0, _pathResolve.findRoot)(_nodePath.dirname(npmEntrypoint));
44
- if (npmRootPath === undefined) {
45
- process.exit(127);
46
- }
47
- const npmDepPath = _nodePath.join(npmRootPath, 'node_modules');
48
- let procLog;
49
- try {
50
- procLog = require(_nodePath.join(npmDepPath, 'proc-log/lib/index.js')).log;
51
- } catch {}
52
- if (procLog) {
53
- npmArgs.push('--no-progress', '--quiet');
54
- }
55
- }
56
- process.exitCode = 1;
57
- const spawnPromise = _promiseSpawn(process.execPath, ['--disable-warning', 'ExperimentalWarning', '--require', injectionPath, npmPath, ...npmArgs], {
58
- stdio: 'inherit'
59
- });
60
- spawnPromise.process.on('exit', (code, signal) => {
61
- if (signal) {
62
- process.kill(process.pid, signal);
63
- } else if (code !== null) {
64
- process.exit(code);
65
- }
66
- });
67
-
68
- (function (exports) {
69
-
70
- var _interopRequireWildcard = vendor.interopRequireWildcard.default;
71
- Object.defineProperty(exports, "__esModule", {
72
- value: true
73
- });
74
- var _exportNames = {};
75
- Object.defineProperty(exports, "default", {
76
- enumerable: true,
77
- get: function () {
78
- return _npmCli.default;
79
- }
80
- });
81
- var _npmCli = _interopRequireWildcard(npmCli$1, true);
82
- Object.keys(_npmCli).forEach(function (key) {
83
- if (key === "default" || key === "__esModule") return;
84
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
85
- if (key in exports && exports[key] === _npmCli[key]) return;
86
- Object.defineProperty(exports, key, {
87
- enumerable: true,
88
- get: function () {
89
- return _npmCli[key];
90
- }
91
- });
92
- });
93
- } (npmCli$2));
94
-
95
- var npmCli = /*@__PURE__*/vendor.getDefaultExportFromCjs(npmCli$2);
96
-
97
- module.exports = npmCli;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,73 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
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$$1 = _interop(require('node:path'));
18
- var require$$1$1 = _interop(require('@npmcli/promise-spawn'));
19
- var constants = _interop(require('./constants.js'));
20
- var link = _interop(require('./link.js'));
21
-
22
- var npxCli$2 = {};
23
-
24
- var npxCli$1 = {};
25
-
26
- var _nodePath = require$$1;
27
- var _promiseSpawn = require$$1$1;
28
- var _constants = constants.constants;
29
- var _link = link.link;
30
- const npxPath = (0, _link.installLinks)(_constants.shadowBinPath, 'npx');
31
- const injectionPath = _nodePath.join(_constants.distPath, 'npm-injection.js');
32
- process.exitCode = 1;
33
- const spawnPromise = _promiseSpawn(process.execPath, ['--disable-warning', 'ExperimentalWarning', '--require', injectionPath, npxPath, ...process.argv.slice(2)], {
34
- stdio: 'inherit'
35
- });
36
- spawnPromise.process.on('exit', (code, signal) => {
37
- if (signal) {
38
- process.kill(process.pid, signal);
39
- } else if (code !== null) {
40
- process.exit(code);
41
- }
42
- });
43
-
44
- (function (exports) {
45
-
46
- var _interopRequireWildcard = vendor.interopRequireWildcard.default;
47
- Object.defineProperty(exports, "__esModule", {
48
- value: true
49
- });
50
- var _exportNames = {};
51
- Object.defineProperty(exports, "default", {
52
- enumerable: true,
53
- get: function () {
54
- return _npxCli.default;
55
- }
56
- });
57
- var _npxCli = _interopRequireWildcard(npxCli$1, true);
58
- Object.keys(_npxCli).forEach(function (key) {
59
- if (key === "default" || key === "__esModule") return;
60
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
61
- if (key in exports && exports[key] === _npxCli[key]) return;
62
- Object.defineProperty(exports, key, {
63
- enumerable: true,
64
- get: function () {
65
- return _npxCli[key];
66
- }
67
- });
68
- });
69
- } (npxCli$2));
70
-
71
- var npxCli = /*@__PURE__*/vendor.getDefaultExportFromCjs(npxCli$2);
72
-
73
- module.exports = npxCli;
@@ -1,8 +0,0 @@
1
- /// <reference types="node" />
2
- import { SocketYml } from '@socketsecurity/config';
3
- import { SocketSdkReturnType } from '@socketsecurity/sdk';
4
- declare function directoryPatterns(): string[];
5
- declare function findRoot(filepath: string): string | undefined;
6
- declare function getPackageFiles(cwd: string, inputPaths: string[], config: SocketYml | undefined, supportedFiles: SocketSdkReturnType<'getReportSupportedFiles'>['data'], debugLog?: typeof console.error): Promise<string[]>;
7
- declare function getPackageFilesFullScans(cwd: string, inputPaths: string[], supportedFiles: SocketSdkReturnType<'getReportSupportedFiles'>['data'], debugLog?: typeof console.error): Promise<string[]>;
8
- export { directoryPatterns, findRoot, getPackageFiles, getPackageFilesFullScans };
@@ -1,8 +0,0 @@
1
- /// <reference types="node" />
2
- import { SocketSdk } from '@socketsecurity/sdk';
3
- declare function createDebugLogger(printDebugLogs?: boolean): typeof console.error;
4
- declare function isErrnoException(value: unknown): value is NodeJS.ErrnoException;
5
- declare function stringJoinWithSeparateFinalSeparator(list: (string | undefined)[], separator?: string): string;
6
- declare function getDefaultKey(): string | undefined;
7
- declare function setupSdk(apiKey?: string | undefined, apiBaseUrl?: string | undefined, proxy?: string | undefined): Promise<SocketSdk>;
8
- export { createDebugLogger, isErrnoException, stringJoinWithSeparateFinalSeparator, getDefaultKey, setupSdk };
@@ -1,9 +0,0 @@
1
- interface Settings {
2
- apiKey?: string | null;
3
- enforcedOrgs?: string[] | null;
4
- apiBaseUrl?: string | null;
5
- apiProxy?: string | null;
6
- }
7
- declare function getSetting<Key extends keyof Settings>(key: Key): Settings[Key];
8
- declare function updateSetting<Key extends keyof Settings>(key: Key, value: Settings[Key]): void;
9
- export { getSetting, updateSetting };