@socketsecurity/cli 0.14.34 → 0.14.36

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 (37) hide show
  1. package/bin/cli.js +37 -1
  2. package/bin/npm-cli.js +2 -1
  3. package/bin/npx-cli.js +2 -1
  4. package/dist/constants.js +69 -38
  5. package/dist/module-sync/cli.js +773 -1555
  6. package/dist/module-sync/constants.d.ts +16 -79
  7. package/dist/module-sync/constants.d.ts.map +1 -0
  8. package/dist/module-sync/npm-injection.js +77 -396
  9. package/dist/module-sync/path-resolve.d.ts +6 -1
  10. package/dist/module-sync/path-resolve.js +47 -38
  11. package/dist/module-sync/sdk.js +60 -110
  12. package/dist/module-sync/shadow-bin.d.ts +2 -0
  13. package/dist/module-sync/shadow-bin.js +103 -0
  14. package/dist/require/cli.js +768 -1549
  15. package/dist/require/constants.d.ts.map +1 -0
  16. package/dist/require/npm-injection.js +76 -394
  17. package/dist/require/path-resolve.js +47 -38
  18. package/dist/require/sdk.js +57 -106
  19. package/dist/require/shadow-bin.js +103 -0
  20. package/dist/require/vendor.js +8295 -8708
  21. package/package.json +30 -31
  22. package/shadow-bin/npm +4 -0
  23. package/shadow-bin/npx +4 -0
  24. package/bin/shadow/module-sync/npm +0 -3
  25. package/bin/shadow/module-sync/npx +0 -3
  26. package/bin/shadow/require/npm +0 -3
  27. package/bin/shadow/require/npx +0 -3
  28. package/dist/module-sync/link.d.ts +0 -2
  29. package/dist/module-sync/link.js +0 -54
  30. package/dist/module-sync/npm-cli.d.ts +0 -2
  31. package/dist/module-sync/npm-cli.js +0 -101
  32. package/dist/module-sync/npx-cli.d.ts +0 -2
  33. package/dist/module-sync/npx-cli.js +0 -77
  34. package/dist/module-sync/vendor.js +0 -70
  35. package/dist/require/link.js +0 -54
  36. package/dist/require/npm-cli.js +0 -101
  37. package/dist/require/npx-cli.js +0 -77
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@socketsecurity/cli",
3
- "version": "0.14.34",
3
+ "version": "0.14.36",
4
4
  "description": "CLI tool for Socket.dev",
5
5
  "homepage": "http://github.com/SocketDev/socket-cli",
6
6
  "license": "MIT",
@@ -22,18 +22,15 @@
22
22
  "exports": {
23
23
  "./bin/cli.js": {
24
24
  "types": "./dist/module-sync/cli.d.ts",
25
- "module-sync": "./dist/module-sync/cli.js",
26
- "require": "./dist/require/cli.js"
25
+ "default": "./dist/cli.js"
27
26
  },
28
27
  "./bin/npm-cli.js": {
29
28
  "types": "./dist/module-sync/npm-cli.d.ts",
30
- "module-sync": "./dist/module-sync/npm-cli.js",
31
- "require": "./dist/require/npm-cli.js"
29
+ "default": "./dist/npm-cli.js"
32
30
  },
33
31
  "./bin/npx-cli.js": {
34
32
  "types": "./dist/module-sync/npx-cli.d.ts",
35
- "module-sync": "./dist/module-sync/npx-cli.js",
36
- "require": "./dist/require/npx-cli.js"
33
+ "default": "./dist/npx-cli.js"
37
34
  },
38
35
  "./package.json": "./package.json",
39
36
  "./translations.json": "./translations.json"
@@ -60,22 +57,23 @@
60
57
  },
61
58
  "dependencies": {
62
59
  "@apideck/better-ajv-errors": "^0.3.6",
63
- "@cyclonedx/cdxgen": "^11.0.5",
60
+ "@cyclonedx/cdxgen": "^11.0.7",
64
61
  "@npmcli/promise-spawn": "^8.0.2",
65
- "@socketregistry/hyrious__bun.lockb": "1.0.5",
66
- "@socketregistry/yocto-spinner": "^1.0.1",
62
+ "@socketregistry/hyrious__bun.lockb": "1.0.6",
63
+ "@socketregistry/yocto-spinner": "^1.0.2",
67
64
  "@socketsecurity/config": "^2.1.3",
68
- "@socketsecurity/registry": "^1.0.51",
65
+ "@socketsecurity/registry": "^1.0.56",
69
66
  "@socketsecurity/sdk": "^1.3.0",
70
67
  "blessed": "^0.1.81",
71
68
  "blessed-contrib": "^4.11.0",
72
- "browserslist": "4.24.2",
69
+ "browserslist": "4.24.3",
73
70
  "chalk-table": "^1.0.2",
71
+ "cmd-shim": "^7.0.0",
74
72
  "has-flag": "^4.0.0",
75
73
  "hpagent": "^1.2.0",
76
74
  "ignore": "^6.0.2",
77
75
  "micromatch": "^4.0.8",
78
- "npm-package-arg": "^12.0.0",
76
+ "npm-package-arg": "^12.0.1",
79
77
  "pony-cause": "^2.1.11",
80
78
  "semver": "^7.6.3",
81
79
  "synp": "^1.9.14",
@@ -90,24 +88,24 @@
90
88
  "@babel/plugin-proposal-export-default-from": "^7.25.9",
91
89
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
92
90
  "@babel/plugin-transform-export-namespace-from": "^7.25.9",
93
- "@babel/plugin-transform-modules-commonjs": "^7.26.3",
94
91
  "@babel/plugin-transform-runtime": "^7.25.9",
95
92
  "@babel/preset-env": "^7.26.0",
96
93
  "@babel/preset-typescript": "^7.26.0",
97
94
  "@babel/runtime": "^7.26.0",
98
95
  "@eslint/compat": "^1.2.4",
99
- "@eslint/js": "^9.16.0",
100
- "@rollup/plugin-commonjs": "^28.0.1",
96
+ "@eslint/js": "^9.17.0",
97
+ "@rollup/plugin-commonjs": "^28.0.2",
101
98
  "@rollup/plugin-json": "^6.1.0",
102
- "@rollup/plugin-node-resolve": "^15.3.0",
103
- "@rollup/plugin-replace": "^6.0.1",
104
- "@rollup/pluginutils": "^5.1.3",
99
+ "@rollup/plugin-node-resolve": "^16.0.0",
100
+ "@rollup/plugin-replace": "^6.0.2",
101
+ "@rollup/pluginutils": "^5.1.4",
105
102
  "@tapjs/run": "^4.0.1",
106
103
  "@types/blessed": "^0.1.25",
104
+ "@types/cmd-shim": "^5.0.2",
107
105
  "@types/micromatch": "^4.0.9",
108
106
  "@types/mocha": "^10.0.10",
109
107
  "@types/mock-fs": "^4.13.4",
110
- "@types/node": "^22.10.1",
108
+ "@types/node": "^22.10.2",
111
109
  "@types/npmcli__arborist": "^5.6.11",
112
110
  "@types/npmcli__promise-spawn": "^6.0.3",
113
111
  "@types/proc-log": "^3.0.4",
@@ -115,28 +113,28 @@
115
113
  "@types/update-notifier": "^6.0.8",
116
114
  "@types/which": "^3.0.4",
117
115
  "@types/yargs-parser": "^21.0.3",
118
- "@typescript-eslint/eslint-plugin": "^8.17.0",
119
- "@typescript-eslint/parser": "^8.17.0",
120
- "c8": "^10.1.2",
116
+ "@typescript-eslint/eslint-plugin": "^8.18.1",
117
+ "@typescript-eslint/parser": "^8.18.1",
118
+ "c8": "^10.1.3",
121
119
  "custompatch": "^1.0.28",
122
- "eslint": "^9.16.0",
120
+ "eslint": "^9.17.0",
123
121
  "eslint-import-resolver-oxc": "^0.6.0",
124
122
  "eslint-plugin-depend": "^0.12.0",
125
- "eslint-plugin-import-x": "^4.5.0",
126
- "eslint-plugin-n": "^17.14.0",
123
+ "eslint-plugin-import-x": "^4.6.1",
124
+ "eslint-plugin-n": "^17.15.0",
127
125
  "eslint-plugin-sort-destructure-keys": "^2.0.0",
128
126
  "eslint-plugin-unicorn": "^56.0.1",
129
127
  "husky": "^9.1.7",
130
128
  "is-interactive": "^2.0.0",
131
129
  "is-unicode-supported": "^2.1.0",
132
- "knip": "^5.39.2",
133
- "magic-string": "^0.30.14",
130
+ "knip": "^5.41.1",
131
+ "magic-string": "^0.30.17",
134
132
  "meow": "^13.2.0",
135
133
  "mock-fs": "^5.4.1",
136
134
  "nock": "^13.5.6",
137
- "npm-run-all2": "^7.0.1",
135
+ "npm-run-all2": "^7.0.2",
138
136
  "open": "^10.1.0",
139
- "oxlint": "0.14.1",
137
+ "oxlint": "0.15.3",
140
138
  "prettier": "3.4.2",
141
139
  "read-package-up": "^11.0.0",
142
140
  "rollup": "4.28.1",
@@ -145,7 +143,7 @@
145
143
  "tiny-updater": "^3.5.2",
146
144
  "type-coverage": "^2.29.7",
147
145
  "typescript": "5.4.5",
148
- "typescript-eslint": "^8.17.0",
146
+ "typescript-eslint": "^8.18.1",
149
147
  "unplugin-purge-polyfills": "^0.0.7"
150
148
  },
151
149
  "overrides": {
@@ -204,6 +202,7 @@
204
202
  "files": [
205
203
  "bin/**",
206
204
  "dist/**",
205
+ "shadow-bin/**",
207
206
  "translations.json"
208
207
  ]
209
208
  }
package/shadow-bin/npm ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ 'use strict'
3
+
4
+ require(`../bin/npm-cli.js`)
package/shadow-bin/npx ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ 'use strict'
3
+
4
+ require(`../bin/npx-cli.js`)
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict'
3
- require('../../dist/module-sync/npm-cli.js')
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict'
3
- require('../../dist/module-sync/npx-cli.js')
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict'
3
- require('../../dist/require/npm-cli.js')
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict'
3
- require('../../dist/require/npx-cli.js')
@@ -1,2 +0,0 @@
1
- declare function installLinks(realDirname: string, binName: 'npm' | 'npx'): string;
2
- export { installLinks };
@@ -1,54 +0,0 @@
1
- 'use strict';
2
-
3
- function _socketInterop(e) {
4
- let c = 0
5
- for (const k in e ?? {}) {
6
- c = c === 0 && k === 'default' ? 1 : 0
7
- if (!c) break
8
- }
9
- return c ? e.default : e
10
- }
11
-
12
- var require$$0 = require('node:fs');
13
- var require$$1 = require('node:path');
14
- var require$$4 = _socketInterop(require('which'));
15
-
16
- var link = {};
17
-
18
- Object.defineProperty(link, "__esModule", {
19
- value: true
20
- });
21
- link.installLinks = installLinks;
22
- var _nodeFs = require$$0;
23
- var _nodePath = require$$1;
24
- var _which = require$$4;
25
- function installLinks(realDirname, binName) {
26
- const realShadowBinDir = realDirname;
27
- // find package manager being shadowed by this process
28
- const bins = _which.sync(binName, {
29
- all: true
30
- });
31
- let shadowIndex = -1;
32
- const binPath = bins.find((binPath, i) => {
33
- if ((0, _nodeFs.realpathSync)(_nodePath.dirname(binPath)) === realShadowBinDir) {
34
- shadowIndex = i;
35
- return false;
36
- }
37
- return true;
38
- });
39
- const isWin = process.platform === 'win32';
40
- if (isWin && binPath) {
41
- return binPath;
42
- }
43
- if (!binPath) {
44
- console.error(`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable`);
45
- process.exit(127);
46
- }
47
- if (shadowIndex === -1) {
48
- const binDir = _nodePath.join(realDirname);
49
- process.env['PATH'] = `${binDir}${isWin ? ';' : ':'}${process.env['PATH']}`;
50
- }
51
- return binPath;
52
- }
53
-
54
- exports.link = link;
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,101 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- function _socketInterop(e) {
5
- let c = 0
6
- for (const k in e ?? {}) {
7
- c = c === 0 && k === 'default' ? 1 : 0
8
- if (!c) break
9
- }
10
- return c ? e.default : e
11
- }
12
-
13
- var vendor = require('./vendor.js');
14
- var require$$0 = require('node:fs');
15
- var require$$1 = require('node:path');
16
- var require$$1$1 = _socketInterop(require('@npmcli/promise-spawn'));
17
- var constants = require('./constants.js');
18
- var link = require('./link.js');
19
- var pathResolve = require('./path-resolve.js');
20
-
21
- var npmCli$2 = {};
22
-
23
- var npmCli$1 = {};
24
-
25
- var _nodeFs = require$$0;
26
- var _nodePath = require$$1;
27
- var _promiseSpawn = require$$1$1;
28
- var _constants = constants.constants;
29
- var _link = link.link;
30
- var _pathResolve = pathResolve.pathResolve;
31
- const {
32
- distPath,
33
- execPath,
34
- shadowBinPath
35
- } = _constants;
36
- const npmPath = (0, _link.installLinks)(shadowBinPath, 'npm');
37
- const injectionPath = _nodePath.join(distPath, 'npm-injection.js');
38
-
39
- // Adding the `--quiet` and `--no-progress` flags when the `proc-log` module
40
- // is found to fix a UX issue when running the command with recent versions of
41
- // npm (input swallowed by the standard npm spinner)
42
- const npmArgs = process.argv.slice(2);
43
- if (npmArgs.includes('install') && !npmArgs.includes('--no-progress') && !npmArgs.includes('--quiet')) {
44
- const npmEntrypoint = (0, _nodeFs.realpathSync)(npmPath);
45
- const npmRootPath = (0, _pathResolve.findRoot)(_nodePath.dirname(npmEntrypoint));
46
- if (npmRootPath === undefined) {
47
- process.exit(127);
48
- }
49
- const npmDepPath = _nodePath.join(npmRootPath, 'node_modules');
50
- let procLog;
51
- try {
52
- procLog = require(_nodePath.join(npmDepPath, 'proc-log/lib/index.js')).log;
53
- } catch {}
54
- if (procLog) {
55
- npmArgs.push('--no-progress', '--quiet');
56
- }
57
- }
58
- process.exitCode = 1;
59
- const spawnPromise = _promiseSpawn(execPath, [
60
- // Lazily access constants.nodeNoWarningsFlags.
61
- ..._constants.nodeNoWarningsFlags, '--require', injectionPath, npmPath, ...npmArgs], {
62
- stdio: 'inherit'
63
- });
64
- spawnPromise.process.on('exit', (code, signal) => {
65
- if (signal) {
66
- process.kill(process.pid, signal);
67
- } else if (code !== null) {
68
- process.exit(code);
69
- }
70
- });
71
-
72
- (function (exports) {
73
-
74
- var _interopRequireWildcard = vendor.interopRequireWildcard.default;
75
- Object.defineProperty(exports, "__esModule", {
76
- value: true
77
- });
78
- var _exportNames = {};
79
- Object.defineProperty(exports, "default", {
80
- enumerable: true,
81
- get: function () {
82
- return _npmCli.default;
83
- }
84
- });
85
- var _npmCli = _interopRequireWildcard(npmCli$1, true);
86
- Object.keys(_npmCli).forEach(function (key) {
87
- if (key === "default" || key === "__esModule") return;
88
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
89
- if (key in exports && exports[key] === _npmCli[key]) return;
90
- Object.defineProperty(exports, key, {
91
- enumerable: true,
92
- get: function () {
93
- return _npmCli[key];
94
- }
95
- });
96
- });
97
- } (npmCli$2));
98
-
99
- var npmCli = /*@__PURE__*/vendor.getDefaultExportFromCjs(npmCli$2);
100
-
101
- module.exports = npmCli;
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- function _socketInterop(e) {
5
- let c = 0
6
- for (const k in e ?? {}) {
7
- c = c === 0 && k === 'default' ? 1 : 0
8
- if (!c) break
9
- }
10
- return c ? e.default : e
11
- }
12
-
13
- var vendor = require('./vendor.js');
14
- var require$$1 = require('node:path');
15
- var require$$1$1 = _socketInterop(require('@npmcli/promise-spawn'));
16
- var constants = require('./constants.js');
17
- var link = require('./link.js');
18
-
19
- var npxCli$2 = {};
20
-
21
- var npxCli$1 = {};
22
-
23
- var _nodePath = require$$1;
24
- var _promiseSpawn = require$$1$1;
25
- var _constants = constants.constants;
26
- var _link = link.link;
27
- const {
28
- distPath,
29
- execPath,
30
- shadowBinPath
31
- } = _constants;
32
- const npxPath = (0, _link.installLinks)(shadowBinPath, 'npx');
33
- const injectionPath = _nodePath.join(distPath, 'npm-injection.js');
34
- process.exitCode = 1;
35
- const spawnPromise = _promiseSpawn(execPath, [
36
- // Lazily access constants.nodeNoWarningsFlags.
37
- ..._constants.nodeNoWarningsFlags, '--require', injectionPath, npxPath, ...process.argv.slice(2)], {
38
- stdio: 'inherit'
39
- });
40
- spawnPromise.process.on('exit', (code, signal) => {
41
- if (signal) {
42
- process.kill(process.pid, signal);
43
- } else if (code !== null) {
44
- process.exit(code);
45
- }
46
- });
47
-
48
- (function (exports) {
49
-
50
- var _interopRequireWildcard = vendor.interopRequireWildcard.default;
51
- Object.defineProperty(exports, "__esModule", {
52
- value: true
53
- });
54
- var _exportNames = {};
55
- Object.defineProperty(exports, "default", {
56
- enumerable: true,
57
- get: function () {
58
- return _npxCli.default;
59
- }
60
- });
61
- var _npxCli = _interopRequireWildcard(npxCli$1, true);
62
- Object.keys(_npxCli).forEach(function (key) {
63
- if (key === "default" || key === "__esModule") return;
64
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
65
- if (key in exports && exports[key] === _npxCli[key]) return;
66
- Object.defineProperty(exports, key, {
67
- enumerable: true,
68
- get: function () {
69
- return _npxCli[key];
70
- }
71
- });
72
- });
73
- } (npxCli$2));
74
-
75
- var npxCli = /*@__PURE__*/vendor.getDefaultExportFromCjs(npxCli$2);
76
-
77
- module.exports = npxCli;
@@ -1,70 +0,0 @@
1
- 'use strict';
2
-
3
- function getDefaultExportFromCjs (x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
- }
6
-
7
- var interopRequireWildcard = {};
8
-
9
- var _typeof$1 = {};
10
-
11
- Object.defineProperty(_typeof$1, "__esModule", {
12
- value: true
13
- });
14
- _typeof$1.default = _typeof;
15
- function _typeof(o) {
16
- "@babel/helpers - typeof";
17
-
18
- return _typeof$1.default = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
19
- return typeof o;
20
- } : function (o) {
21
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
22
- }, _typeof(o);
23
- }
24
-
25
- Object.defineProperty(interopRequireWildcard, "__esModule", {
26
- value: true
27
- });
28
- interopRequireWildcard.default = _interopRequireWildcard;
29
- var _typeof2 = _typeof$1;
30
- function _getRequireWildcardCache(e) {
31
- if ("function" != typeof WeakMap) return null;
32
- var r = new WeakMap(),
33
- t = new WeakMap();
34
- return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
35
- return e ? t : r;
36
- })(e);
37
- }
38
- function _interopRequireWildcard(e, r) {
39
- if (!r && e && e.__esModule) return e;
40
- if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return {
41
- "default": e
42
- };
43
- var t = _getRequireWildcardCache(r);
44
- if (t && t.has(e)) return t.get(e);
45
- var n = {
46
- __proto__: null
47
- },
48
- a = Object.defineProperty && Object.getOwnPropertyDescriptor;
49
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
50
- var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
51
- i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
52
- }
53
- return n["default"] = e, t && t.set(e, n), n;
54
- }
55
-
56
- var interopRequireDefault = {};
57
-
58
- Object.defineProperty(interopRequireDefault, "__esModule", {
59
- value: true
60
- });
61
- interopRequireDefault.default = _interopRequireDefault;
62
- function _interopRequireDefault(e) {
63
- return e && e.__esModule ? e : {
64
- "default": e
65
- };
66
- }
67
-
68
- exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
69
- exports.interopRequireDefault = interopRequireDefault;
70
- exports.interopRequireWildcard = interopRequireWildcard;
@@ -1,54 +0,0 @@
1
- 'use strict';
2
-
3
- function _socketInterop(e) {
4
- let c = 0
5
- for (const k in e ?? {}) {
6
- c = c === 0 && k === 'default' ? 1 : 0
7
- if (!c) break
8
- }
9
- return c ? e.default : e
10
- }
11
-
12
- var require$$0 = require('node:fs');
13
- var require$$1 = require('node:path');
14
- var require$$4 = _socketInterop(require('which'));
15
-
16
- var link = {};
17
-
18
- Object.defineProperty(link, "__esModule", {
19
- value: true
20
- });
21
- link.installLinks = installLinks;
22
- var _nodeFs = require$$0;
23
- var _nodePath = require$$1;
24
- var _which = require$$4;
25
- function installLinks(realDirname, binName) {
26
- const realShadowBinDir = realDirname;
27
- // find package manager being shadowed by this process
28
- const bins = _which.sync(binName, {
29
- all: true
30
- });
31
- let shadowIndex = -1;
32
- const binPath = bins.find((binPath, i) => {
33
- if ((0, _nodeFs.realpathSync)(_nodePath.dirname(binPath)) === realShadowBinDir) {
34
- shadowIndex = i;
35
- return false;
36
- }
37
- return true;
38
- });
39
- const isWin = process.platform === 'win32';
40
- if (isWin && binPath) {
41
- return binPath;
42
- }
43
- if (!binPath) {
44
- console.error(`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable`);
45
- process.exit(127);
46
- }
47
- if (shadowIndex === -1) {
48
- const binDir = _nodePath.join(realDirname);
49
- process.env['PATH'] = `${binDir}${isWin ? ';' : ':'}${process.env['PATH']}`;
50
- }
51
- return binPath;
52
- }
53
-
54
- exports.link = link;
@@ -1,101 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- function _socketInterop(e) {
5
- let c = 0
6
- for (const k in e ?? {}) {
7
- c = c === 0 && k === 'default' ? 1 : 0
8
- if (!c) break
9
- }
10
- return c ? e.default : e
11
- }
12
-
13
- var vendor = require('./vendor.js');
14
- var require$$0 = require('node:fs');
15
- var require$$1 = require('node:path');
16
- var require$$1$1 = _socketInterop(require('@npmcli/promise-spawn'));
17
- var constants = require('./constants.js');
18
- var link = require('./link.js');
19
- var pathResolve = require('./path-resolve.js');
20
-
21
- var npmCli$2 = {};
22
-
23
- var npmCli$1 = {};
24
-
25
- var _nodeFs = require$$0;
26
- var _nodePath = require$$1;
27
- var _promiseSpawn = require$$1$1;
28
- var _constants = constants.constants;
29
- var _link = link.link;
30
- var _pathResolve = pathResolve.pathResolve;
31
- const {
32
- distPath,
33
- execPath,
34
- shadowBinPath
35
- } = _constants;
36
- const npmPath = (0, _link.installLinks)(shadowBinPath, 'npm');
37
- const injectionPath = _nodePath.join(distPath, 'npm-injection.js');
38
-
39
- // Adding the `--quiet` and `--no-progress` flags when the `proc-log` module
40
- // is found to fix a UX issue when running the command with recent versions of
41
- // npm (input swallowed by the standard npm spinner)
42
- const npmArgs = process.argv.slice(2);
43
- if (npmArgs.includes('install') && !npmArgs.includes('--no-progress') && !npmArgs.includes('--quiet')) {
44
- const npmEntrypoint = (0, _nodeFs.realpathSync)(npmPath);
45
- const npmRootPath = (0, _pathResolve.findRoot)(_nodePath.dirname(npmEntrypoint));
46
- if (npmRootPath === undefined) {
47
- process.exit(127);
48
- }
49
- const npmDepPath = _nodePath.join(npmRootPath, 'node_modules');
50
- let procLog;
51
- try {
52
- procLog = require(_nodePath.join(npmDepPath, 'proc-log/lib/index.js')).log;
53
- } catch {}
54
- if (procLog) {
55
- npmArgs.push('--no-progress', '--quiet');
56
- }
57
- }
58
- process.exitCode = 1;
59
- const spawnPromise = _promiseSpawn(execPath, [
60
- // Lazily access constants.nodeNoWarningsFlags.
61
- ..._constants.nodeNoWarningsFlags, '--require', injectionPath, npmPath, ...npmArgs], {
62
- stdio: 'inherit'
63
- });
64
- spawnPromise.process.on('exit', (code, signal) => {
65
- if (signal) {
66
- process.kill(process.pid, signal);
67
- } else if (code !== null) {
68
- process.exit(code);
69
- }
70
- });
71
-
72
- (function (exports) {
73
-
74
- var _interopRequireWildcard = vendor.interopRequireWildcard.default;
75
- Object.defineProperty(exports, "__esModule", {
76
- value: true
77
- });
78
- var _exportNames = {};
79
- Object.defineProperty(exports, "default", {
80
- enumerable: true,
81
- get: function () {
82
- return _npmCli.default;
83
- }
84
- });
85
- var _npmCli = _interopRequireWildcard(npmCli$1, true);
86
- Object.keys(_npmCli).forEach(function (key) {
87
- if (key === "default" || key === "__esModule") return;
88
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
89
- if (key in exports && exports[key] === _npmCli[key]) return;
90
- Object.defineProperty(exports, key, {
91
- enumerable: true,
92
- get: function () {
93
- return _npmCli[key];
94
- }
95
- });
96
- });
97
- } (npmCli$2));
98
-
99
- var npmCli = /*@__PURE__*/vendor.getDefaultExportFromCjs(npmCli$2);
100
-
101
- module.exports = npmCli;