@socketsecurity/cli-with-sentry 0.14.52 → 0.14.55

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@socketsecurity/cli-with-sentry",
3
- "version": "0.14.52",
3
+ "version": "0.14.55",
4
4
  "description": "CLI tool for Socket.dev, includes Sentry error handling, otherwise identical to the regular `socket` package",
5
5
  "homepage": "http://github.com/SocketDev/socket-cli",
6
6
  "license": "MIT",
@@ -61,17 +61,16 @@
61
61
  "test": "run-s check test:*",
62
62
  "test:prepare": "cross-env VITEST=1 npm run build",
63
63
  "test:unit": "vitest --run",
64
- "test:unit:update": "vitest --update",
64
+ "test:unit:update": "vitest --run --update",
65
65
  "test:unit:coverage": "vitest run --coverage",
66
66
  "test-ci": "run-s test:*",
67
- "testu": "cross-env SOCKET_CLI_NO_API_TOKEN=1 run-s test:prepare test:unit:update",
67
+ "testu": "cross-env SOCKET_CLI_NO_API_TOKEN=1 run-s test:prepare; npm run test:unit:update --",
68
68
  "update": "run-p --aggregate-output update:**",
69
69
  "update:deps": "npx --yes npm-check-updates"
70
70
  },
71
71
  "dependencies": {
72
72
  "@apideck/better-ajv-errors": "^0.3.6",
73
73
  "@cyclonedx/cdxgen": "^11.2.0",
74
- "@npmcli/promise-spawn": "^8.0.2",
75
74
  "@octokit/rest": "^21.1.1",
76
75
  "@sentry/node": "9.3.0",
77
76
  "@socketregistry/hyrious__bun.lockb": "^1.0.13",
@@ -80,13 +79,14 @@
80
79
  "@socketregistry/is-unicode-supported": "^1.0.1",
81
80
  "@socketregistry/packageurl-js": "^1.0.2",
82
81
  "@socketsecurity/config": "^2.1.3",
83
- "@socketsecurity/registry": "^1.0.110",
82
+ "@socketsecurity/registry": "^1.0.113",
84
83
  "@socketsecurity/sdk": "^1.4.5",
85
84
  "blessed": "^0.1.81",
86
85
  "blessed-contrib": "^4.11.0",
87
86
  "browserslist": "4.24.4",
88
87
  "chalk-table": "^1.0.2",
89
88
  "cmd-shim": "^7.0.0",
89
+ "common-tags": "^1.8.2",
90
90
  "fast-content-type-parse": "^2.0.1",
91
91
  "has-flag": "4.0.0",
92
92
  "hpagent": "^1.2.0",
@@ -127,11 +127,12 @@
127
127
  "@rollup/pluginutils": "^5.1.4",
128
128
  "@types/blessed": "^0.1.25",
129
129
  "@types/cmd-shim": "^5.0.2",
130
+ "@types/common-tags": "^1.8.4",
130
131
  "@types/micromatch": "^4.0.9",
131
132
  "@types/mocha": "^10.0.10",
132
133
  "@types/mock-fs": "^4.13.4",
133
134
  "@types/ndjson": "^2.0.4",
134
- "@types/node": "^22.13.8",
135
+ "@types/node": "^22.13.9",
135
136
  "@types/npmcli__arborist": "^6.3.0",
136
137
  "@types/npmcli__promise-spawn": "^6.0.3",
137
138
  "@types/proc-log": "^3.0.4",
@@ -139,8 +140,8 @@
139
140
  "@types/update-notifier": "^6.0.8",
140
141
  "@types/which": "^3.0.4",
141
142
  "@types/yargs-parser": "^21.0.3",
142
- "@typescript-eslint/eslint-plugin": "^8.25.0",
143
- "@typescript-eslint/parser": "^8.25.0",
143
+ "@typescript-eslint/eslint-plugin": "^8.26.0",
144
+ "@typescript-eslint/parser": "^8.26.0",
144
145
  "@vitest/coverage-v8": "3.0.7",
145
146
  "cross-env": "^7.0.3",
146
147
  "del-cli": "^6.0.0",
@@ -158,13 +159,13 @@
158
159
  "mock-fs": "^5.5.0",
159
160
  "nock": "^14.0.1",
160
161
  "npm-run-all2": "^7.0.2",
161
- "oxlint": "0.15.12",
162
+ "oxlint": "0.15.13",
162
163
  "read-package-up": "^11.0.0",
163
164
  "rollup": "4.34.9",
164
165
  "rollup-plugin-ts": "^3.4.5",
165
166
  "type-coverage": "^2.29.7",
166
167
  "typescript": "5.4.5",
167
- "typescript-eslint": "^8.25.0",
168
+ "typescript-eslint": "^8.26.0",
168
169
  "unplugin-purge-polyfills": "^0.0.7",
169
170
  "vitest": "3.0.7"
170
171
  },
@@ -1,26 +0,0 @@
1
- /// <reference types="npmcli__promise-spawn" />
2
- /// <reference types="node" />
3
- import spawn from '@npmcli/promise-spawn';
4
- import { Spinner } from '@socketsecurity/registry/lib/spinner';
5
- declare function isAuditFlag(cmdArg: string): boolean;
6
- declare function isFundFlag(cmdArg: string): boolean;
7
- declare function isLoglevelFlag(cmdArg: string): boolean;
8
- declare function isProgressFlag(cmdArg: string): boolean;
9
- type SpawnOption = Exclude<Parameters<typeof spawn>[2], undefined>;
10
- type SafeNpmInstallOptions = SpawnOption & {
11
- args?: string[] | undefined;
12
- ipc?: object | undefined;
13
- spinner?: Spinner | undefined;
14
- };
15
- declare function safeNpmInstall(options?: SafeNpmInstallOptions): Promise<{
16
- cmd: string;
17
- args: string[];
18
- code: number;
19
- signal: NodeJS.Signals | null;
20
- stdout: string;
21
- stderr: string;
22
- } & Record<any, any>> & {
23
- process: import("child_process").ChildProcess;
24
- stdio: [import("stream").Writable | null, import("stream").Readable | null, import("stream").Readable | null, import("stream").Writable | import("stream").Readable | null | undefined, import("stream").Writable | import("stream").Readable | null | undefined];
25
- };
26
- export { isAuditFlag, isFundFlag, isLoglevelFlag, isProgressFlag, safeNpmInstall };
@@ -1,114 +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 && k !== '__esModule') break
8
- }
9
- return c ? e.default : e
10
- }
11
-
12
- var process = require('node:process');
13
- var spawn = _socketInterop(require('@npmcli/promise-spawn'));
14
- var debug = require('@socketsecurity/registry/lib/debug');
15
- var objects = require('@socketsecurity/registry/lib/objects');
16
- var constants = require('./constants.js');
17
- var npmPaths = require('./npm-paths.js');
18
-
19
- const {
20
- SOCKET_IPC_HANDSHAKE,
21
- abortSignal
22
- } = constants;
23
- const auditFlags = new Set(['--audit', '--no-audit']);
24
- const fundFlags = new Set(['--fund', '--no-fund']);
25
-
26
- // https://docs.npmjs.com/cli/v11/using-npm/logging#aliases
27
- const logFlags = new Set(['--loglevel', '-d', '--dd', '--ddd', '-q', '--quiet', '-s', '--silent']);
28
- const progressFlags = new Set(['--progress', '--no-progress']);
29
- function isAuditFlag(cmdArg) {
30
- return auditFlags.has(cmdArg);
31
- }
32
- function isFundFlag(cmdArg) {
33
- return fundFlags.has(cmdArg);
34
- }
35
- function isLoglevelFlag(cmdArg) {
36
- // https://docs.npmjs.com/cli/v11/using-npm/logging#setting-log-levels
37
- return cmdArg.startsWith('--loglevel=') || logFlags.has(cmdArg);
38
- }
39
- function isProgressFlag(cmdArg) {
40
- return progressFlags.has(cmdArg);
41
- }
42
- function safeNpmInstall(options) {
43
- const {
44
- args = [],
45
- ipc,
46
- spinner,
47
- ...spawnOptions
48
- } = {
49
- __proto__: null,
50
- ...options
51
- };
52
- const terminatorPos = args.indexOf('--');
53
- const npmArgs = (terminatorPos === -1 ? args : args.slice(0, terminatorPos)).filter(a => !isAuditFlag(a) && !isFundFlag(a) && !isProgressFlag(a));
54
- const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos);
55
- const useIpc = objects.isObject(ipc);
56
- const useDebug = debug.isDebug();
57
- const isSilent = !useDebug && !npmArgs.some(isLoglevelFlag);
58
- const isSpinning = spinner?.isSpinning ?? false;
59
- if (!isSilent) {
60
- spinner?.stop();
61
- }
62
- let spawnPromise = spawn(
63
- // Lazily access constants.execPath.
64
- constants.execPath, [
65
- // Lazily access constants.nodeNoWarningsFlags.
66
- ...constants.nodeNoWarningsFlags, '--require',
67
- // Lazily access constants.npmInjectionPath.
68
- constants.npmInjectionPath, npmPaths.getNpmBinPath(), 'install',
69
- // Even though the '--silent' flag is passed npm will still run through
70
- // code paths for 'audit' and 'fund' unless '--no-audit' and '--no-fund'
71
- // flags are passed.
72
- '--no-audit', '--no-fund',
73
- // Add `--no-progress` and `--silent` flags to fix input being swallowed
74
- // by the spinner when running the command with recent versions of npm.
75
- '--no-progress',
76
- // Add the '--silent' flag if a loglevel flag is not provided and the
77
- // SOCKET_CLI_DEBUG environment variable is not truthy.
78
- ...(isSilent ? ['--silent'] : []), ...npmArgs, ...otherArgs], {
79
- signal: abortSignal,
80
- // Set stdio to include 'ipc'.
81
- // See https://github.com/nodejs/node/blob/v23.6.0/lib/child_process.js#L161-L166
82
- // and https://github.com/nodejs/node/blob/v23.6.0/lib/internal/child_process.js#L238.
83
- stdio: isSilent ?
84
- // 'ignore'
85
- useIpc ? ['ignore', 'ignore', 'ignore', 'ipc'] : 'ignore' :
86
- // 'inherit'
87
- useIpc ? [0, 1, 2, 'ipc'] : 'inherit',
88
- ...spawnOptions,
89
- env: {
90
- ...process.env,
91
- ...spawnOptions.env
92
- }
93
- });
94
- if (useIpc) {
95
- spawnPromise.process.send({
96
- [SOCKET_IPC_HANDSHAKE]: ipc
97
- });
98
- }
99
- if (!isSilent && isSpinning) {
100
- const oldSpawnPromise = spawnPromise;
101
- spawnPromise = spawnPromise.finally(() => {
102
- spinner?.start();
103
- });
104
- spawnPromise.process = oldSpawnPromise.process;
105
- spawnPromise.stdin = spawnPromise.stdin;
106
- }
107
- return spawnPromise;
108
- }
109
-
110
- exports.isLoglevelFlag = isLoglevelFlag;
111
- exports.isProgressFlag = isProgressFlag;
112
- exports.safeNpmInstall = safeNpmInstall;
113
- //# debugId=79449a74-d3b7-490e-9985-e47598ab588d
114
- //# sourceMappingURL=npm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"npm.js","sources":["../../src/utils/npm.ts"],"sourcesContent":["import process from 'node:process'\n\nimport spawn from '@npmcli/promise-spawn'\n\nimport { isDebug } from '@socketsecurity/registry/lib/debug'\nimport { isObject } from '@socketsecurity/registry/lib/objects'\n\nimport constants from '../constants'\nimport { getNpmBinPath } from '../shadow/npm-paths'\n\nimport type { Spinner } from '@socketsecurity/registry/lib/spinner'\n\nconst { SOCKET_IPC_HANDSHAKE, abortSignal } = constants\n\nconst auditFlags = new Set(['--audit', '--no-audit'])\n\nconst fundFlags = new Set(['--fund', '--no-fund'])\n\n// https://docs.npmjs.com/cli/v11/using-npm/logging#aliases\nconst logFlags = new Set([\n '--loglevel',\n '-d',\n '--dd',\n '--ddd',\n '-q',\n '--quiet',\n '-s',\n '--silent'\n])\n\nconst progressFlags = new Set(['--progress', '--no-progress'])\n\nexport function isAuditFlag(cmdArg: string) {\n return auditFlags.has(cmdArg)\n}\n\nexport function isFundFlag(cmdArg: string) {\n return fundFlags.has(cmdArg)\n}\n\nexport function isLoglevelFlag(cmdArg: string) {\n // https://docs.npmjs.com/cli/v11/using-npm/logging#setting-log-levels\n return cmdArg.startsWith('--loglevel=') || logFlags.has(cmdArg)\n}\n\nexport function isProgressFlag(cmdArg: string) {\n return progressFlags.has(cmdArg)\n}\n\ntype SpawnOption = Exclude<Parameters<typeof spawn>[2], undefined>\n\ntype SafeNpmInstallOptions = SpawnOption & {\n args?: string[] | undefined\n ipc?: object | undefined\n spinner?: Spinner | undefined\n}\n\nexport function safeNpmInstall(options?: SafeNpmInstallOptions) {\n const {\n args = [],\n ipc,\n spinner,\n ...spawnOptions\n } = <SafeNpmInstallOptions>{ __proto__: null, ...options }\n const terminatorPos = args.indexOf('--')\n const npmArgs = (\n terminatorPos === -1 ? args : args.slice(0, terminatorPos)\n ).filter(a => !isAuditFlag(a) && !isFundFlag(a) && !isProgressFlag(a))\n const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos)\n const useIpc = isObject(ipc)\n const useDebug = isDebug()\n const isSilent = !useDebug && !npmArgs.some(isLoglevelFlag)\n const isSpinning = spinner?.isSpinning ?? false\n if (!isSilent) {\n spinner?.stop()\n }\n let spawnPromise = spawn(\n // Lazily access constants.execPath.\n constants.execPath,\n [\n // Lazily access constants.nodeNoWarningsFlags.\n ...constants.nodeNoWarningsFlags,\n '--require',\n // Lazily access constants.npmInjectionPath.\n constants.npmInjectionPath,\n getNpmBinPath(),\n 'install',\n // Even though the '--silent' flag is passed npm will still run through\n // code paths for 'audit' and 'fund' unless '--no-audit' and '--no-fund'\n // flags are passed.\n '--no-audit',\n '--no-fund',\n // Add `--no-progress` and `--silent` flags to fix input being swallowed\n // by the spinner when running the command with recent versions of npm.\n '--no-progress',\n // Add the '--silent' flag if a loglevel flag is not provided and the\n // SOCKET_CLI_DEBUG environment variable is not truthy.\n ...(isSilent ? ['--silent'] : []),\n ...npmArgs,\n ...otherArgs\n ],\n {\n signal: abortSignal,\n // Set stdio to include 'ipc'.\n // See https://github.com/nodejs/node/blob/v23.6.0/lib/child_process.js#L161-L166\n // and https://github.com/nodejs/node/blob/v23.6.0/lib/internal/child_process.js#L238.\n stdio: isSilent\n ? // 'ignore'\n useIpc\n ? ['ignore', 'ignore', 'ignore', 'ipc']\n : 'ignore'\n : // 'inherit'\n useIpc\n ? [0, 1, 2, 'ipc']\n : 'inherit',\n ...spawnOptions,\n env: {\n ...process.env,\n ...spawnOptions.env\n }\n }\n )\n if (useIpc) {\n spawnPromise.process.send({ [SOCKET_IPC_HANDSHAKE]: ipc })\n }\n if (!isSilent && isSpinning) {\n const oldSpawnPromise = spawnPromise\n spawnPromise = <typeof oldSpawnPromise>spawnPromise.finally(() => {\n spinner?.start()\n })\n spawnPromise.process = oldSpawnPromise.process\n ;(spawnPromise as any).stdin = (spawnPromise as any).stdin\n }\n return spawnPromise\n}\n"],"names":["abortSignal","args","__proto__","constants","signal","stdio","env","spawnPromise"],"mappings":";;;;;;;;;;;;;;;;;;AAYA;;AAA8BA;AAAY;AAE1C;AAEA;;AAEA;AACA;AAWA;AAEO;AACL;AACF;AAEO;AACL;AACF;AAEO;AACL;AACA;AACF;AAEO;AACL;AACF;AAUO;;AAEHC;;;;AAIF;AAA6BC;;;AAC7B;AACA;AAGA;AACA;AACA;;AAEA;;;AAGA;;AAEE;;AAGE;AACA;AAEA;AACAC;AAGA;AACA;AACA;AACA;AAEA;AACA;;AAEA;AACA;AACA;AAKAC;AACA;AACA;AACA;AACAC;AACI;;AAIA;;AAIJ;AACAC;;AAEE;AACF;AACF;AAEF;AACEC;AAA4B;AAA4B;AAC1D;AACA;;AAEEA;;AAEA;AACAA;AACEA;AACJ;AACA;AACF;;;;","debugId":"79449a74-d3b7-490e-9985-e47598ab588d"}
@@ -1,3 +0,0 @@
1
- 'use strict'
2
-
3
- module.exports = require('../module-sync/npm.js')