@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,21 +1,24 @@
1
- declare const SUPPORTS_SYNC_ESM: boolean;
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";
9
- declare const ENV: Readonly<{
10
- UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE: boolean;
11
- }>;
12
- declare const rootPath: string;
13
- declare const rootDistPath: string;
14
- declare const rootBinPath: string;
15
- declare const rootPkgJsonPath: string;
16
- declare const nmBinPath: string;
17
- declare const cdxgenBinPath: string;
18
- declare const distPath: string;
19
- declare const shadowBinPath: string;
20
- declare const synpBinPath: string;
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
+ import registryConstants from '@socketsecurity/registry/lib/constants';
2
+ type RegistryEnv = typeof registryConstants.ENV;
3
+ type Constants = {
4
+ readonly API_V0_URL: 'https://api.socket.dev/v0';
5
+ readonly ENV: RegistryEnv & {
6
+ UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE: boolean;
7
+ };
8
+ readonly DIST_TYPE: 'module-sync' | 'require';
9
+ readonly NPM_REGISTRY_URL: 'https://registry.npmjs.org';
10
+ readonly SOCKET_CLI_ISSUES_URL: 'https://github.com/SocketDev/socket-cli/issues';
11
+ readonly UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE: 'UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE';
12
+ readonly cdxgenBinPath: string;
13
+ readonly distPath: string;
14
+ readonly nmBinPath: string;
15
+ readonly rootBinPath: string;
16
+ readonly rootDistPath: string;
17
+ readonly rootPath: string;
18
+ readonly rootPkgJsonPath: string;
19
+ readonly shadowBinPath: string;
20
+ readonly synpBinPath: string;
21
+ } & typeof registryConstants;
22
+ declare const constants: Constants;
23
+ export { constants as default };
24
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAIA,OAAO,iBAAiB,MAAM,wCAAwC,CAAA;AAEtE,KAAK,WAAW,GAAG,OAAO,iBAAiB,CAAC,GAAG,CAAA;AAE/C,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAA;IAChD,QAAQ,CAAC,GAAG,EAAE,WAAW,GAAG;QAC1B,4CAA4C,EAAE,OAAO,CAAA;KACtD,CAAA;IACD,QAAQ,CAAC,SAAS,EAAE,aAAa,GAAG,SAAS,CAAA;IAC7C,QAAQ,CAAC,gBAAgB,EAAE,4BAA4B,CAAA;IACvD,QAAQ,CAAC,qBAAqB,EAAE,gDAAgD,CAAA;IAChF,QAAQ,CAAC,4CAA4C,EAAE,8CAA8C,CAAA;IACrG,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B,GAAG,OAAO,iBAAiB,CAAA;AAyC5B,QAAA,MAAM,SAAS,WA0Bd,CAAA"}
@@ -1,80 +1,3 @@
1
- 'use strict';
1
+ 'use strict'
2
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$$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
-
21
- var constants = {};
22
-
23
- Object.defineProperty(constants, "__esModule", {
24
- value: true
25
- });
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;
27
- var _nodeFs = require$$0;
28
- var _nodePath = require$$1;
29
- var _env = require$$2;
30
- var _constants = require$$3;
31
- var _semver = require$$4;
32
- const {
33
- PACKAGE_JSON
34
- } = _constants;
35
- const SUPPORTS_SYNC_ESM = constants.SUPPORTS_SYNC_ESM = _semver.satisfies(process.versions.node, '>=22.12');
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';
43
- constants.ENV = Object.freeze({
44
- // Flag set by the optimize command to bypass the packagesHaveRiskyIssues check.
45
- [UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE]: (0, _env.envAsBoolean)(process.env[UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE])
46
- });
47
-
48
- // Dynamically detect the rootPath so constants.ts can be used in tests.
49
- const rootPath = constants.rootPath = (() => {
50
- let oldPath;
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`.
54
- while (currPath !== oldPath) {
55
- const pkgJsonPath = _nodePath.join(currPath, PACKAGE_JSON);
56
- if ((0, _nodeFs.existsSync)(pkgJsonPath)) {
57
- try {
58
- // Content matching @socketsecurity/cli is replaced by
59
- // the @rollup/plugin-replace plugin used in .config/rollup.base.config.mjs
60
- // with either 'socket' or '@socketsecurity/cli'.
61
- if (require(pkgJsonPath)?.name === '@socketsecurity/cli') {
62
- return currPath;
63
- }
64
- } catch {}
65
- }
66
- oldPath = currPath;
67
- currPath = _nodePath.dirname(currPath);
68
- }
69
- throw new TypeError(`Socket CLI initialization error: rootPath cannot be resolved.\n\nPlease report to ${SOCKET_CLI_ISSUES_URL}.`);
70
- })();
71
- const rootDistPath = constants.rootDistPath = _nodePath.join(rootPath, 'dist');
72
- constants.rootBinPath = _nodePath.join(rootPath, 'bin');
73
- constants.rootPkgJsonPath = _nodePath.join(rootPath, PACKAGE_JSON);
74
- const nmBinPath = constants.nmBinPath = _nodePath.join(rootPath, 'node_modules/.bin');
75
- constants.cdxgenBinPath = _nodePath.join(nmBinPath, 'cdxgen');
76
- constants.distPath = _nodePath.join(rootDistPath, DIST_TYPE);
77
- constants.shadowBinPath = _nodePath.join(rootPath, 'shadow', DIST_TYPE);
78
- constants.synpBinPath = _nodePath.join(nmBinPath, 'synp');
79
-
80
- exports.constants = constants;
3
+ module.exports = require('../constants.js')