socket 0.14.34 → 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.
@@ -4,288 +4,44 @@ function _socketInterop(e) {
4
4
  let c = 0
5
5
  for (const k in e ?? {}) {
6
6
  c = c === 0 && k === 'default' ? 1 : 0
7
- if (!c) break
7
+ if (!c && k !== '__esModule') break
8
8
  }
9
9
  return c ? e.default : e
10
10
  }
11
11
 
12
+ var events = require('node:events');
13
+ var fs = require('node:fs');
14
+ var https = require('node:https');
15
+ var path = require('node:path');
16
+ var readline = require('node:readline');
17
+ var promises = require('node:timers/promises');
18
+ var prompts = require('@socketsecurity/registry/lib/prompts');
19
+ var yoctoSpinner = require('@socketregistry/yocto-spinner');
12
20
  var vendor = require('./vendor.js');
13
- var constants = require('./constants.js');
14
- var require$$1$4 = require('node:events');
15
- var require$$0 = require('node:fs');
16
- var require$$3$3 = require('node:https');
17
- var require$$1$1 = require('node:path');
18
- var require$$3 = require('node:readline');
19
- var require$$6$2 = require('node:timers/promises');
20
- var require$$1$3 = require('@socketsecurity/registry/lib/prompts');
21
- var require$$3$2 = require('@socketregistry/yocto-spinner');
22
- var require$$5$1 = _socketInterop(require('npm-package-arg'));
23
- var require$$3$1 = _socketInterop(require('semver'));
24
- var require$$6$1 = require('@socketsecurity/config');
25
- var require$$7 = require('@socketsecurity/registry/lib/objects');
26
- var require$$8 = require('@socketsecurity/registry/lib/packages');
27
- var require$$1$2 = require('node:net');
28
- var require$$1 = require('node:os');
29
- var require$$5 = require('node:stream');
21
+ var npa = _socketInterop(require('npm-package-arg'));
22
+ var semver = _socketInterop(require('semver'));
23
+ var config = require('@socketsecurity/config');
24
+ var objects = require('@socketsecurity/registry/lib/objects');
25
+ var packages = require('@socketsecurity/registry/lib/packages');
26
+ var net = require('node:net');
27
+ var os = require('node:os');
28
+ var node_stream = require('node:stream');
30
29
  var sdk = require('./sdk.js');
30
+ var constants = require('./constants.js');
31
31
  var pathResolve = require('./path-resolve.js');
32
- var link = require('./link.js');
33
-
34
- var npmInjection$2 = {};
35
-
36
- var npmInjection$1 = {};
37
32
 
38
- var arborist = {};
39
-
40
- var ttyServer$1 = {};
41
-
42
- var name = "socket";
43
- var version = "0.14.34";
44
- var description = "CLI tool for Socket.dev";
45
- var homepage = "http://github.com/SocketDev/socket-cli";
46
- var license = "MIT";
47
- var repository = {
48
- type: "git",
49
- url: "git+https://github.com/SocketDev/socket-cli.git"
50
- };
51
- var author = {
52
- name: "Socket Inc",
53
- email: "eng@socket.dev",
54
- url: "https://socket.dev"
55
- };
56
- var bin = {
57
- socket: "./bin/cli.js",
58
- "socket-npm": "./bin/npm-cli.js",
59
- "socket-npx": "./bin/npx-cli.js"
60
- };
61
- var exports$1 = {
62
- "./bin/cli.js": {
63
- types: "./dist/module-sync/cli.d.ts",
64
- "module-sync": "./dist/module-sync/cli.js",
65
- require: "./dist/require/cli.js"
66
- },
67
- "./bin/npm-cli.js": {
68
- types: "./dist/module-sync/npm-cli.d.ts",
69
- "module-sync": "./dist/module-sync/npm-cli.js",
70
- require: "./dist/require/npm-cli.js"
71
- },
72
- "./bin/npx-cli.js": {
73
- types: "./dist/module-sync/npx-cli.d.ts",
74
- "module-sync": "./dist/module-sync/npx-cli.js",
75
- require: "./dist/require/npx-cli.js"
76
- },
77
- "./package.json": "./package.json",
78
- "./translations.json": "./translations.json"
79
- };
80
- var scripts = {
81
- build: "run-s build:*",
82
- "build:dist": "rollup -c .config/rollup.dist.config.mjs",
83
- "build:test": "rollup -c .config/rollup.test.config.mjs",
84
- check: "run-p -c --aggregate-output check:*",
85
- "check:lint": "eslint --report-unused-disable-directives .",
86
- "check:tsc": "tsc",
87
- "check:type-coverage": "type-coverage --detail --strict --at-least 95 --ignore-files 'test/*'",
88
- "knip:dependencies": "knip --dependencies",
89
- "knip:exports": "knip --include exports,duplicates",
90
- lint: "oxlint -c=./.oxlintrc.json --ignore-path=./.prettierignore --tsconfig=./tsconfig.json .",
91
- "lint:fix": "npm run lint -- --fix && npm run lint:fix:fast",
92
- "lint:fix:fast": "prettier --cache --log-level warn --write .",
93
- prepare: "husky && custompatch",
94
- test: "run-s check build:* test:* test:coverage:*",
95
- "test-ci": "run-s build:* test:*",
96
- "test:unit": "tap-run",
97
- "test:coverage:c8": "c8 --reporter=none node --test 'test/socket-npm.test.cjs'",
98
- "test:coverage:merge": "cp -r .tap/coverage/*.json coverage/tmp && c8 --reporter=lcov --reporter=text --include 'dist/{module-sync,require}/*.js' --exclude 'dist/require/vendor.js' report"
99
- };
100
- var dependencies = {
101
- "@apideck/better-ajv-errors": "^0.3.6",
102
- "@cyclonedx/cdxgen": "^11.0.5",
103
- "@npmcli/promise-spawn": "^8.0.2",
104
- "@socketregistry/hyrious__bun.lockb": "1.0.5",
105
- "@socketregistry/yocto-spinner": "^1.0.1",
106
- "@socketsecurity/config": "^2.1.3",
107
- "@socketsecurity/registry": "^1.0.51",
108
- "@socketsecurity/sdk": "^1.3.0",
109
- blessed: "^0.1.81",
110
- "blessed-contrib": "^4.11.0",
111
- browserslist: "4.24.2",
112
- "chalk-table": "^1.0.2",
113
- "has-flag": "^4.0.0",
114
- hpagent: "^1.2.0",
115
- ignore: "^6.0.2",
116
- micromatch: "^4.0.8",
117
- "npm-package-arg": "^12.0.0",
118
- "pony-cause": "^2.1.11",
119
- semver: "^7.6.3",
120
- synp: "^1.9.14",
121
- tinyglobby: "^0.2.10",
122
- which: "^5.0.0",
123
- yaml: "^2.6.1",
124
- "yargs-parser": "^21.1.1",
125
- "yoctocolors-cjs": "^2.1.2"
126
- };
127
- var devDependencies = {
128
- "@babel/core": "^7.26.0",
129
- "@babel/plugin-proposal-export-default-from": "^7.25.9",
130
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
131
- "@babel/plugin-transform-export-namespace-from": "^7.25.9",
132
- "@babel/plugin-transform-modules-commonjs": "^7.26.3",
133
- "@babel/plugin-transform-runtime": "^7.25.9",
134
- "@babel/preset-env": "^7.26.0",
135
- "@babel/preset-typescript": "^7.26.0",
136
- "@babel/runtime": "^7.26.0",
137
- "@eslint/compat": "^1.2.4",
138
- "@eslint/js": "^9.16.0",
139
- "@rollup/plugin-commonjs": "^28.0.1",
140
- "@rollup/plugin-json": "^6.1.0",
141
- "@rollup/plugin-node-resolve": "^15.3.0",
142
- "@rollup/plugin-replace": "^6.0.1",
143
- "@rollup/pluginutils": "^5.1.3",
144
- "@tapjs/run": "^4.0.1",
145
- "@types/blessed": "^0.1.25",
146
- "@types/micromatch": "^4.0.9",
147
- "@types/mocha": "^10.0.10",
148
- "@types/mock-fs": "^4.13.4",
149
- "@types/node": "^22.10.1",
150
- "@types/npmcli__arborist": "^5.6.11",
151
- "@types/npmcli__promise-spawn": "^6.0.3",
152
- "@types/proc-log": "^3.0.4",
153
- "@types/semver": "^7.5.8",
154
- "@types/update-notifier": "^6.0.8",
155
- "@types/which": "^3.0.4",
156
- "@types/yargs-parser": "^21.0.3",
157
- "@typescript-eslint/eslint-plugin": "^8.17.0",
158
- "@typescript-eslint/parser": "^8.17.0",
159
- c8: "^10.1.2",
160
- custompatch: "^1.0.28",
161
- eslint: "^9.16.0",
162
- "eslint-import-resolver-oxc": "^0.6.0",
163
- "eslint-plugin-depend": "^0.12.0",
164
- "eslint-plugin-import-x": "^4.5.0",
165
- "eslint-plugin-n": "^17.14.0",
166
- "eslint-plugin-sort-destructure-keys": "^2.0.0",
167
- "eslint-plugin-unicorn": "^56.0.1",
168
- husky: "^9.1.7",
169
- "is-interactive": "^2.0.0",
170
- "is-unicode-supported": "^2.1.0",
171
- knip: "^5.39.2",
172
- "magic-string": "^0.30.14",
173
- meow: "^13.2.0",
174
- "mock-fs": "^5.4.1",
175
- nock: "^13.5.6",
176
- "npm-run-all2": "^7.0.1",
177
- open: "^10.1.0",
178
- oxlint: "0.14.1",
179
- prettier: "3.4.2",
180
- "read-package-up": "^11.0.0",
181
- rollup: "4.28.1",
182
- "rollup-plugin-ts": "^3.4.5",
183
- "terminal-link": "^3.0.0",
184
- "tiny-updater": "^3.5.2",
185
- "type-coverage": "^2.29.7",
186
- typescript: "5.4.5",
187
- "typescript-eslint": "^8.17.0",
188
- "unplugin-purge-polyfills": "^0.0.7"
189
- };
190
- var overrides = {
191
- "aggregate-error": "npm:@socketregistry/aggregate-error@^1",
192
- "es-define-property": "npm:@socketregistry/es-define-property@^1",
193
- "function-bind": "npm:@socketregistry/function-bind@^1",
194
- globalthis: "npm:@socketregistry/globalthis@^1",
195
- gopd: "npm:@socketregistry/gopd@^1",
196
- "has-property-descriptors": "npm:@socketregistry/has-property-descriptors@^1",
197
- "has-proto": "npm:@socketregistry/has-proto@^1",
198
- "has-symbols": "npm:@socketregistry/has-symbols@^1",
199
- hasown: "npm:@socketregistry/hasown@^1",
200
- "indent-string": "npm:@socketregistry/indent-string@^1",
201
- "is-core-module": "npm:@socketregistry/is-core-module@^1",
202
- isarray: "npm:@socketregistry/isarray@^1",
203
- "npm-package-arg": "$npm-package-arg",
204
- "packageurl-js": "npm:@socketregistry/packageurl-js@^1",
205
- "path-parse": "npm:@socketregistry/path-parse@^1",
206
- "safe-buffer": "npm:@socketregistry/safe-buffer@^1",
207
- "safer-buffer": "npm:@socketregistry/safer-buffer@^1",
208
- semver: "$semver",
209
- "set-function-length": "npm:@socketregistry/set-function-length@^1",
210
- "side-channel": "npm:@socketregistry/side-channel@^1",
211
- "tiny-colors": "$yoctocolors-cjs",
212
- typedarray: "npm:@socketregistry/typedarray@^1",
213
- yaml: "$yaml"
214
- };
215
- var resolutions = {
216
- "aggregate-error": "npm:@socketregistry/aggregate-error@^1",
217
- "es-define-property": "npm:@socketregistry/es-define-property@^1",
218
- "function-bind": "npm:@socketregistry/function-bind@^1",
219
- globalthis: "npm:@socketregistry/globalthis@^1",
220
- gopd: "npm:@socketregistry/gopd@^1",
221
- "has-property-descriptors": "npm:@socketregistry/has-property-descriptors@^1",
222
- "has-proto": "npm:@socketregistry/has-proto@^1",
223
- "has-symbols": "npm:@socketregistry/has-symbols@^1",
224
- hasown: "npm:@socketregistry/hasown@^1",
225
- "indent-string": "npm:@socketregistry/indent-string@^1",
226
- "is-core-module": "npm:@socketregistry/is-core-module@^1",
227
- isarray: "npm:@socketregistry/isarray@^1",
228
- "npm-package-arg": "^12.0.0",
229
- "packageurl-js": "npm:@socketregistry/packageurl-js@^1",
230
- "path-parse": "npm:@socketregistry/path-parse@^1",
231
- "safe-buffer": "npm:@socketregistry/safe-buffer@^1",
232
- "safer-buffer": "npm:@socketregistry/safer-buffer@^1",
233
- semver: "^7.6.3",
234
- "set-function-length": "npm:@socketregistry/set-function-length@^1",
235
- "side-channel": "npm:@socketregistry/side-channel@^1",
236
- "tiny-colors": "npm:yoctocolors-cjs@^2.1.2",
237
- typedarray: "npm:@socketregistry/typedarray@^1",
238
- yaml: "^2.6.0"
239
- };
240
- var engines = {
241
- node: "^18.20.4 || ^20.9.0 || >=22.0.0"
242
- };
243
- var files = [
244
- "bin/**",
245
- "dist/**",
246
- "translations.json"
247
- ];
248
- var require$$6 = {
249
- name: name,
250
- version: version,
251
- description: description,
252
- homepage: homepage,
253
- license: license,
254
- repository: repository,
255
- author: author,
256
- bin: bin,
257
- exports: exports$1,
258
- scripts: scripts,
259
- dependencies: dependencies,
260
- devDependencies: devDependencies,
261
- overrides: overrides,
262
- resolutions: resolutions,
263
- engines: engines,
264
- files: files
265
- };
33
+ var version = "0.14.35";
266
34
 
267
- Object.defineProperty(ttyServer$1, "__esModule", {
268
- value: true
269
- });
270
- ttyServer$1.createTTYServer = createTTYServer;
271
- var _nodeFs$1 = require$$0;
272
- var _nodeNet = require$$1$2;
273
- var _nodeOs = require$$1;
274
- var _nodePath$1 = require$$1$1;
275
- var _nodeReadline$1 = require$$3;
276
- var _nodeStream = require$$5;
277
- var _package = require$$6;
278
- var _misc$1 = sdk.misc;
279
35
  const NEWLINE_CHAR_CODE = 10; /*'\n'*/
280
36
 
281
37
  const TTY_IPC = process.env['SOCKET_SECURITY_TTY_IPC'];
282
- const sock = _nodePath$1.join(_nodeOs.tmpdir(), `socket-security-tty-${process.pid}.sock`);
38
+ const sock = path.join(os.tmpdir(), `socket-security-tty-${process.pid}.sock`);
283
39
  process.env['SOCKET_SECURITY_TTY_IPC'] = sock;
284
40
  function createNonStandardTTYServer() {
285
41
  return {
286
42
  async captureTTY(mutexFn) {
287
43
  return await new Promise((resolve, reject) => {
288
- const conn = _nodeNet.createConnection({
44
+ const conn = net.createConnection({
289
45
  path: TTY_IPC
290
46
  }).on('error', reject);
291
47
  let captured = false;
@@ -308,23 +64,23 @@ function createNonStandardTTYServer() {
308
64
  } = JSON.parse(lineBuff.subarray(0, eolIndex).toString('utf8'));
309
65
  lineBuff = null;
310
66
  captured = true;
311
- if (remote_ipc_version !== _package.version) {
67
+ if (remote_ipc_version !== version) {
312
68
  throw new Error('Mismatched STDIO tunnel IPC version, ensure you only have 1 version of socket CLI being called.');
313
69
  }
314
- const input = hasInput ? new _nodeStream.PassThrough() : null;
70
+ const input = hasInput ? new node_stream.PassThrough() : null;
315
71
  input?.pause();
316
72
  if (input) conn.pipe(input);
317
- const output = hasOutput ? new _nodeStream.PassThrough() : null;
73
+ const output = hasOutput ? new node_stream.PassThrough() : null;
318
74
  if (output) {
319
75
  output.pipe(conn)
320
76
  // Make ora happy
321
77
  ;
322
78
  output.isTTY = true;
323
79
  output.cursorTo = function cursorTo(x, y, callback) {
324
- _nodeReadline$1.cursorTo(this, x, y, callback);
80
+ readline.cursorTo(this, x, y, callback);
325
81
  };
326
82
  output.clearLine = function clearLine(dir, callback) {
327
- _nodeReadline$1.clearLine(this, dir, callback);
83
+ readline.clearLine(this, dir, callback);
328
84
  };
329
85
  }
330
86
  mutexFn(hasInput ? input : undefined, hasOutput ? output : undefined).then(resolve, reject).finally(() => {
@@ -347,7 +103,7 @@ function createIPCServer(captureState, npmlog) {
347
103
  const input = process.stdin;
348
104
  const output = process.stderr;
349
105
  return new Promise((resolve, reject) => {
350
- const server = _nodeNet
106
+ const server = net
351
107
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
352
108
  .createServer(async conn => {
353
109
  if (captureState.captured) {
@@ -367,7 +123,7 @@ function createIPCServer(captureState, npmlog) {
367
123
  npmlog.disableProgress();
368
124
  }
369
125
  conn.write(`${JSON.stringify({
370
- ipc_version: _package.version,
126
+ ipc_version: version,
371
127
  capabilities: {
372
128
  input: Boolean(input),
373
129
  output: true
@@ -452,9 +208,9 @@ function createStandardTTYServer(isInteractive, npmlog) {
452
208
  }
453
209
  function tryUnlinkSync(filepath) {
454
210
  try {
455
- (0, _nodeFs$1.unlinkSync)(filepath);
211
+ fs.unlinkSync(filepath);
456
212
  } catch (e) {
457
- if ((0, _misc$1.isErrnoException)(e) && e.code !== 'ENOENT') {
213
+ if (sdk.isErrnoException(e) && e.code !== 'ENOENT') {
458
214
  throw e;
459
215
  }
460
216
  }
@@ -463,12 +219,6 @@ function createTTYServer(isInteractive, npmlog) {
463
219
  return !isInteractive && TTY_IPC ? createNonStandardTTYServer() : createStandardTTYServer(isInteractive, npmlog);
464
220
  }
465
221
 
466
- var alertRules = {};
467
-
468
- Object.defineProperty(alertRules, "__esModule", {
469
- value: true
470
- });
471
- alertRules.createAlertUXLookup = createAlertUXLookup;
472
222
  //#region UX Constants
473
223
 
474
224
  const IGNORE_UX = {
@@ -612,35 +362,8 @@ function createAlertUXLookup(settings) {
612
362
  return ux;
613
363
  };
614
364
  }
365
+ //#endregion
615
366
 
616
- var _interopRequireDefault = vendor.interopRequireDefault.default;
617
- Object.defineProperty(arborist, "__esModule", {
618
- value: true
619
- });
620
- arborist.SafeArborist = void 0;
621
- arborist.installSafeArborist = installSafeArborist;
622
- var _nodeEvents = require$$1$4;
623
- var _nodeFs = require$$0;
624
- var _nodeHttps = require$$3$3;
625
- var _nodePath = require$$1$1;
626
- var _nodeReadline = require$$3;
627
- var _promises = require$$6$2;
628
- var _prompts = require$$1$3;
629
- var _yoctoSpinner = require$$3$2;
630
- var _isInteractive = _interopRequireDefault(vendor.isInteractive);
631
- var _npmPackageArg = require$$5$1;
632
- var _semver = require$$3$1;
633
- var _config = require$$6$1;
634
- var _objects = require$$7;
635
- var _packages = require$$8;
636
- var _ttyServer = ttyServer$1;
637
- var _constants$1 = constants.constants;
638
- var _colorOrMarkdown = sdk.colorOrMarkdown;
639
- var _alertRules = alertRules;
640
- var _misc = sdk.misc;
641
- var _pathResolve = pathResolve.pathResolve;
642
- var _sdk = sdk.sdk;
643
- var _settings = sdk.settings;
644
367
  const {
645
368
  API_V0_URL,
646
369
  ENV,
@@ -649,11 +372,12 @@ const {
649
372
  SOCKET_CLI_ISSUES_URL,
650
373
  SOCKET_PUBLIC_API_KEY,
651
374
  UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE,
375
+ abortSignal,
652
376
  rootPath
653
- } = _constants$1;
377
+ } = constants;
654
378
  const POTENTIAL_BUG_ERROR_MESSAGE = `This is may be a bug with socket-npm related to changes to the npm CLI.\nPlease report to ${SOCKET_CLI_ISSUES_URL}.`;
655
- const npmEntrypoint = (0, _nodeFs.realpathSync)(process.argv[1]);
656
- const npmRootPath = (0, _pathResolve.findRoot)(_nodePath.dirname(npmEntrypoint));
379
+ const npmEntrypoint = fs.realpathSync(process.argv[1]);
380
+ const npmRootPath = pathResolve.findRoot(path.dirname(npmEntrypoint));
657
381
  function tryRequire(...ids) {
658
382
  for (const data of ids) {
659
383
  let id;
@@ -678,32 +402,32 @@ function tryRequire(...ids) {
678
402
  }
679
403
  if (npmRootPath === undefined) {
680
404
  console.error(`Unable to find npm CLI install directory.\nSearched parent directories of ${npmEntrypoint}.\n\n${POTENTIAL_BUG_ERROR_MESSAGE}`);
405
+ // The exit code 127 indicates that the command or binary being executed
406
+ // could not be found.
681
407
  process.exit(127);
682
408
  }
683
- const npmNmPath = _nodePath.join(npmRootPath, 'node_modules');
684
- const arboristPkgPath = _nodePath.join(npmNmPath, '@npmcli/arborist');
685
- const arboristClassPath = _nodePath.join(arboristPkgPath, 'lib/arborist/index.js');
686
- const arboristDepValidPath = _nodePath.join(arboristPkgPath, 'lib/dep-valid.js');
687
- const arboristEdgeClassPath = _nodePath.join(arboristPkgPath, 'lib/edge.js');
688
- const arboristNodeClassPath = _nodePath.join(arboristPkgPath, 'lib/node.js');
689
- const arboristOverrideSetClassPatch = _nodePath.join(arboristPkgPath, 'lib/override-set.js');
690
- const log = tryRequire([_nodePath.join(npmNmPath, 'proc-log/lib/index.js'),
409
+ const npmNmPath = path.join(npmRootPath, 'node_modules');
410
+ const arboristPkgPath = path.join(npmNmPath, '@npmcli/arborist');
411
+ const arboristClassPath = path.join(arboristPkgPath, 'lib/arborist/index.js');
412
+ const arboristDepValidPath = path.join(arboristPkgPath, 'lib/dep-valid.js');
413
+ const arboristEdgeClassPath = path.join(arboristPkgPath, 'lib/edge.js');
414
+ const arboristNodeClassPath = path.join(arboristPkgPath, 'lib/node.js');
415
+ const arboristOverrideSetClassPatch = path.join(arboristPkgPath, 'lib/override-set.js');
416
+ const log = tryRequire([path.join(npmNmPath, 'proc-log/lib/index.js'),
691
417
  // The proc-log DefinitelyTyped definition is incorrect. The type definition
692
418
  // is really that of its export log.
693
- mod => mod.log], _nodePath.join(npmNmPath, 'npmlog/lib/log.js'));
419
+ mod => mod.log], path.join(npmNmPath, 'npmlog/lib/log.js'));
694
420
  if (log === undefined) {
695
421
  console.error(`Unable to integrate with npm CLI logging infrastructure.\n\n${POTENTIAL_BUG_ERROR_MESSAGE}.`);
422
+ // The exit code 127 indicates that the command or binary being executed
423
+ // could not be found.
696
424
  process.exit(127);
697
425
  }
698
- const pacote = tryRequire(_nodePath.join(npmNmPath, 'pacote'), 'pacote');
426
+ const pacote = tryRequire(path.join(npmNmPath, 'pacote'), 'pacote');
699
427
  const {
700
428
  tarball
701
429
  } = pacote;
702
- const translations = require(_nodePath.join(rootPath, 'translations.json'));
703
- const abortController = new AbortController();
704
- const {
705
- signal: abortSignal
706
- } = abortController;
430
+ const translations = require(path.join(rootPath, 'translations.json'));
707
431
  const Arborist = require(arboristClassPath);
708
432
  const depValid = require(arboristDepValidPath);
709
433
  const Edge = require(arboristEdgeClassPath);
@@ -711,23 +435,23 @@ const Node = require(arboristNodeClassPath);
711
435
  const OverrideSet = require(arboristOverrideSetClassPatch);
712
436
  const kCtorArgs = Symbol('ctorArgs');
713
437
  const kRiskyReify = Symbol('riskyReify');
714
- const formatter = new _colorOrMarkdown.ColorOrMarkdown(false);
715
- const pubToken = (0, _sdk.getDefaultKey)() ?? SOCKET_PUBLIC_API_KEY;
716
- const ttyServer = (0, _ttyServer.createTTYServer)((0, _isInteractive.default)({
438
+ const formatter = new sdk.ColorOrMarkdown(false);
439
+ const pubToken = sdk.getDefaultKey() ?? SOCKET_PUBLIC_API_KEY;
440
+ const ttyServer = createTTYServer(vendor.isInteractive({
717
441
  stream: process.stdin
718
442
  }), log);
719
443
  let _uxLookup;
720
444
  async function uxLookup(settings) {
721
445
  while (_uxLookup === undefined) {
722
446
  // eslint-disable-next-line no-await-in-loop
723
- await (0, _promises.setTimeout)(1, {
447
+ await promises.setTimeout(1, {
724
448
  signal: abortSignal
725
449
  });
726
450
  }
727
451
  return _uxLookup(settings);
728
452
  }
729
453
  async function* batchScan(pkgIds) {
730
- const req = _nodeHttps.request(`${API_V0_URL}/purl?alerts=true`, {
454
+ const req = https.request(`${API_V0_URL}/purl?alerts=true`, {
731
455
  method: 'POST',
732
456
  headers: {
733
457
  Authorization: `Basic ${Buffer.from(`${pubToken}:`).toString('base64url')}`
@@ -740,12 +464,12 @@ async function* batchScan(pkgIds) {
740
464
  }));
741
465
  const {
742
466
  0: res
743
- } = await _nodeEvents.once(req, 'response');
467
+ } = await events.once(req, 'response');
744
468
  const ok = res.statusCode >= 200 && res.statusCode <= 299;
745
469
  if (!ok) {
746
470
  throw new Error(`Socket API Error: ${res.statusCode}`);
747
471
  }
748
- const rli = _nodeReadline.createInterface(res);
472
+ const rli = readline.createInterface(res);
749
473
  for await (const line of rli) {
750
474
  yield JSON.parse(line);
751
475
  }
@@ -763,24 +487,24 @@ function findSocketYmlSync() {
763
487
  let prevDir = null;
764
488
  let dir = process.cwd();
765
489
  while (dir !== prevDir) {
766
- let ymlPath = _nodePath.join(dir, 'socket.yml');
490
+ let ymlPath = path.join(dir, 'socket.yml');
767
491
  let yml = maybeReadfileSync(ymlPath);
768
492
  if (yml === undefined) {
769
- ymlPath = _nodePath.join(dir, 'socket.yaml');
493
+ ymlPath = path.join(dir, 'socket.yaml');
770
494
  yml = maybeReadfileSync(ymlPath);
771
495
  }
772
496
  if (typeof yml === 'string') {
773
497
  try {
774
498
  return {
775
499
  path: ymlPath,
776
- parsed: _config.parseSocketConfig(yml)
500
+ parsed: config.parseSocketConfig(yml)
777
501
  };
778
502
  } catch {
779
503
  throw new Error(`Found file but was unable to parse ${ymlPath}`);
780
504
  }
781
505
  }
782
506
  prevDir = dir;
783
- dir = _nodePath.join(dir, '..');
507
+ dir = path.join(dir, '..');
784
508
  }
785
509
  return null;
786
510
  }
@@ -817,12 +541,12 @@ function isAlertFixable(alert) {
817
541
  }
818
542
  function maybeReadfileSync(filepath) {
819
543
  try {
820
- return (0, _nodeFs.readFileSync)(filepath, 'utf8');
544
+ return fs.readFileSync(filepath, 'utf8');
821
545
  } catch {}
822
546
  return undefined;
823
547
  }
824
548
  async function getPackagesAlerts(safeArb, _registry, pkgs, output) {
825
- const spinner = _yoctoSpinner({
549
+ const spinner = yoctoSpinner({
826
550
  stream: output
827
551
  });
828
552
  let {
@@ -843,7 +567,7 @@ async function getPackagesAlerts(safeArb, _registry, pkgs, output) {
843
567
  const {
844
568
  version
845
569
  } = artifact;
846
- const name = (0, _packages.resolvePackageName)(artifact);
570
+ const name = packages.resolvePackageName(artifact);
847
571
  const id = `${name}@${artifact.version}`;
848
572
  let blocked = false;
849
573
  let displayWarning = false;
@@ -1280,12 +1004,12 @@ class SafeNode extends Node {
1280
1004
  // is based on https://github.com/npm/cli/pull/7025.
1281
1005
  //
1282
1006
  // If we prefer dedupe, or if the version is equal, take the other.
1283
- if (preferDedupe || _semver.eq(other.version, this.version)) {
1007
+ if (preferDedupe || semver.eq(other.version, this.version)) {
1284
1008
  return true;
1285
1009
  }
1286
1010
  // If our current version isn't the result of an override, then prefer to
1287
1011
  // take the greater version.
1288
- if (!this.overridden && _semver.gt(other.version, this.version)) {
1012
+ if (!this.overridden && semver.gt(other.version, this.version)) {
1289
1013
  return true;
1290
1014
  }
1291
1015
  return false;
@@ -1566,18 +1290,18 @@ class SafeOverrideSet extends OverrideSet {
1566
1290
  //
1567
1291
  // We need to use the rawSpec here, because the spec has the overrides
1568
1292
  // applied to it already.
1569
- let spec = _npmPackageArg(`${edge.name}@${edge.rawSpec}`);
1293
+ let spec = npa(`${edge.name}@${edge.rawSpec}`);
1570
1294
  if (spec.type === 'alias') {
1571
1295
  spec = spec.subSpec;
1572
1296
  }
1573
1297
  if (spec.type === 'git') {
1574
- if (spec.gitRange && rule.keySpec && _semver.intersects(spec.gitRange, rule.keySpec)) {
1298
+ if (spec.gitRange && rule.keySpec && semver.intersects(spec.gitRange, rule.keySpec)) {
1575
1299
  return rule;
1576
1300
  }
1577
1301
  continue;
1578
1302
  }
1579
1303
  if (spec.type === 'range' || spec.type === 'version') {
1580
- if (rule.keySpec && _semver.intersects(spec.fetchSpec, rule.keySpec)) {
1304
+ if (rule.keySpec && semver.intersects(spec.fetchSpec, rule.keySpec)) {
1581
1305
  return rule;
1582
1306
  }
1583
1307
  continue;
@@ -1674,7 +1398,7 @@ class SafeArborist extends Arborist {
1674
1398
  if (!alerts.length) {
1675
1399
  return true;
1676
1400
  }
1677
- return await (0, _prompts.confirm)({
1401
+ return await prompts.confirm({
1678
1402
  message: 'Accept risks of installing these packages?',
1679
1403
  default: false
1680
1404
  }, {
@@ -1695,7 +1419,6 @@ class SafeArborist extends Arborist {
1695
1419
  }
1696
1420
  }
1697
1421
  }
1698
- arborist.SafeArborist = SafeArborist;
1699
1422
  function installSafeArborist() {
1700
1423
  const cache = require.cache;
1701
1424
  cache[arboristClassPath] = {
@@ -1714,7 +1437,7 @@ function installSafeArborist() {
1714
1437
  void (async () => {
1715
1438
  const remoteSettings = await (async () => {
1716
1439
  try {
1717
- const socketSdk = await (0, _sdk.setupSdk)(pubToken);
1440
+ const socketSdk = await sdk.setupSdk(pubToken);
1718
1441
  const orgResult = await socketSdk.getOrganizations();
1719
1442
  if (!orgResult.success) {
1720
1443
  throw new Error(`Failed to fetch Socket organization info: ${orgResult.error.message}`);
@@ -1736,11 +1459,11 @@ void (async () => {
1736
1459
  settings: result.data
1737
1460
  };
1738
1461
  } catch (e) {
1739
- if ((0, _objects.isObject)(e) && 'cause' in e) {
1462
+ if (objects.isObject(e) && 'cause' in e) {
1740
1463
  const {
1741
1464
  cause
1742
1465
  } = e;
1743
- if ((0, _misc.isErrnoException)(cause)) {
1466
+ if (sdk.isErrnoException(cause)) {
1744
1467
  if (cause.code === 'ENOTFOUND' || cause.code === 'ECONNREFUSED') {
1745
1468
  throw new Error('Unable to connect to socket.dev, ensure internet connectivity before retrying', {
1746
1469
  cause: e
@@ -1755,7 +1478,7 @@ void (async () => {
1755
1478
  orgs,
1756
1479
  settings
1757
1480
  } = remoteSettings;
1758
- const enforcedOrgs = (0, _settings.getSetting)('enforcedOrgs') ?? [];
1481
+ const enforcedOrgs = sdk.getSetting('enforcedOrgs') ?? [];
1759
1482
 
1760
1483
  // Remove any organizations not being enforced.
1761
1484
  for (const {
@@ -1783,47 +1506,7 @@ void (async () => {
1783
1506
  }
1784
1507
  });
1785
1508
  }
1786
- _uxLookup = (0, _alertRules.createAlertUXLookup)(settings);
1509
+ _uxLookup = createAlertUXLookup(settings);
1787
1510
  })();
1788
1511
 
1789
- var _constants = constants.constants;
1790
- var _arborist = arborist;
1791
- var _link = link.link;
1792
- const {
1793
- shadowBinPath
1794
- } = _constants;
1795
-
1796
- // Shadow `npm` and `npx` to mitigate subshells.
1797
- (0, _link.installLinks)(shadowBinPath, 'npm');
1798
- (0, _arborist.installSafeArborist)();
1799
-
1800
- (function (exports) {
1801
-
1802
- var _interopRequireWildcard = vendor.interopRequireWildcard.default;
1803
- Object.defineProperty(exports, "__esModule", {
1804
- value: true
1805
- });
1806
- var _exportNames = {};
1807
- Object.defineProperty(exports, "default", {
1808
- enumerable: true,
1809
- get: function () {
1810
- return _npmInjection.default;
1811
- }
1812
- });
1813
- var _npmInjection = _interopRequireWildcard(npmInjection$1, true);
1814
- Object.keys(_npmInjection).forEach(function (key) {
1815
- if (key === "default" || key === "__esModule") return;
1816
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
1817
- if (key in exports && exports[key] === _npmInjection[key]) return;
1818
- Object.defineProperty(exports, key, {
1819
- enumerable: true,
1820
- get: function () {
1821
- return _npmInjection[key];
1822
- }
1823
- });
1824
- });
1825
- } (npmInjection$2));
1826
-
1827
- var npmInjection = /*@__PURE__*/vendor.getDefaultExportFromCjs(npmInjection$2);
1828
-
1829
- module.exports = npmInjection;
1512
+ installSafeArborist();