@socketsecurity/cli-with-sentry 0.14.51 → 0.14.53
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/bin/cli.js +10 -15
- package/dist/constants.d.ts +29 -4
- package/dist/constants.js +8 -2
- package/dist/constants.js.map +1 -1
- package/dist/instrument-with-sentry.js +7 -10
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/module-sync/cli.js +670 -446
- package/dist/module-sync/cli.js.map +1 -1
- package/dist/module-sync/edge.d.ts +1 -1
- package/dist/module-sync/index.d.ts +22 -22
- package/dist/module-sync/index.js +5 -4
- package/dist/module-sync/index.js.map +1 -1
- package/dist/module-sync/npm-paths.js +12 -23
- package/dist/module-sync/npm-paths.js.map +1 -1
- package/dist/module-sync/path-resolve.d.ts +1 -2
- package/dist/module-sync/reify.d.ts +8 -8
- package/dist/module-sync/settings.d.ts +1 -1
- package/dist/module-sync/shadow-bin.js +5 -10
- package/dist/module-sync/shadow-bin.js.map +1 -1
- package/dist/require/cli.js +670 -446
- package/dist/require/cli.js.map +1 -1
- package/package.json +5 -5
- package/dist/module-sync/debug.d.ts +0 -3
- package/dist/module-sync/npm.d.ts +0 -26
- package/dist/module-sync/npm.js +0 -113
- package/dist/module-sync/npm.js.map +0 -1
- package/dist/require/npm.js +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/cli-with-sentry",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.53",
|
|
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,16 +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
65
|
"test:unit:coverage": "vitest run --coverage",
|
|
65
66
|
"test-ci": "run-s test:*",
|
|
66
|
-
"testu": "cross-env SOCKET_CLI_NO_API_TOKEN=1 run-s test:prepare test:unit
|
|
67
|
+
"testu": "cross-env SOCKET_CLI_NO_API_TOKEN=1 run-s test:prepare test:unit:update",
|
|
67
68
|
"update": "run-p --aggregate-output update:**",
|
|
68
69
|
"update:deps": "npx --yes npm-check-updates"
|
|
69
70
|
},
|
|
70
71
|
"dependencies": {
|
|
71
72
|
"@apideck/better-ajv-errors": "^0.3.6",
|
|
72
73
|
"@cyclonedx/cdxgen": "^11.2.0",
|
|
73
|
-
"@npmcli/promise-spawn": "^8.0.2",
|
|
74
74
|
"@octokit/rest": "^21.1.1",
|
|
75
75
|
"@sentry/node": "9.3.0",
|
|
76
76
|
"@socketregistry/hyrious__bun.lockb": "^1.0.13",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@socketregistry/is-unicode-supported": "^1.0.1",
|
|
80
80
|
"@socketregistry/packageurl-js": "^1.0.2",
|
|
81
81
|
"@socketsecurity/config": "^2.1.3",
|
|
82
|
-
"@socketsecurity/registry": "^1.0.
|
|
82
|
+
"@socketsecurity/registry": "^1.0.111",
|
|
83
83
|
"@socketsecurity/sdk": "^1.4.5",
|
|
84
84
|
"blessed": "^0.1.81",
|
|
85
85
|
"blessed-contrib": "^4.11.0",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"eslint-import-resolver-oxc": "^0.12.0",
|
|
148
148
|
"eslint-plugin-depend": "^0.12.0",
|
|
149
149
|
"eslint-plugin-import-x": "^4.6.1",
|
|
150
|
-
"eslint-plugin-n": "^17.
|
|
150
|
+
"eslint-plugin-n": "^17.16.1",
|
|
151
151
|
"eslint-plugin-sort-destructure-keys": "^2.0.0",
|
|
152
152
|
"eslint-plugin-unicorn": "^56.0.1",
|
|
153
153
|
"husky": "^9.1.7",
|
|
@@ -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 };
|
package/dist/module-sync/npm.js
DELETED
|
@@ -1,113 +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 objects = require('@socketsecurity/registry/lib/objects');
|
|
15
|
-
var npmPaths = require('./npm-paths.js');
|
|
16
|
-
var constants = require('./constants.js');
|
|
17
|
-
|
|
18
|
-
const {
|
|
19
|
-
SOCKET_IPC_HANDSHAKE,
|
|
20
|
-
abortSignal
|
|
21
|
-
} = constants;
|
|
22
|
-
const auditFlags = new Set(['--audit', '--no-audit']);
|
|
23
|
-
const fundFlags = new Set(['--fund', '--no-fund']);
|
|
24
|
-
|
|
25
|
-
// https://docs.npmjs.com/cli/v11/using-npm/logging#aliases
|
|
26
|
-
const logFlags = new Set(['--loglevel', '-d', '--dd', '--ddd', '-q', '--quiet', '-s', '--silent']);
|
|
27
|
-
const progressFlags = new Set(['--progress', '--no-progress']);
|
|
28
|
-
function isAuditFlag(cmdArg) {
|
|
29
|
-
return auditFlags.has(cmdArg);
|
|
30
|
-
}
|
|
31
|
-
function isFundFlag(cmdArg) {
|
|
32
|
-
return fundFlags.has(cmdArg);
|
|
33
|
-
}
|
|
34
|
-
function isLoglevelFlag(cmdArg) {
|
|
35
|
-
// https://docs.npmjs.com/cli/v11/using-npm/logging#setting-log-levels
|
|
36
|
-
return cmdArg.startsWith('--loglevel=') || logFlags.has(cmdArg);
|
|
37
|
-
}
|
|
38
|
-
function isProgressFlag(cmdArg) {
|
|
39
|
-
return progressFlags.has(cmdArg);
|
|
40
|
-
}
|
|
41
|
-
function safeNpmInstall(options) {
|
|
42
|
-
const {
|
|
43
|
-
args = [],
|
|
44
|
-
ipc,
|
|
45
|
-
spinner,
|
|
46
|
-
...spawnOptions
|
|
47
|
-
} = {
|
|
48
|
-
__proto__: null,
|
|
49
|
-
...options
|
|
50
|
-
};
|
|
51
|
-
const terminatorPos = args.indexOf('--');
|
|
52
|
-
const npmArgs = (terminatorPos === -1 ? args : args.slice(0, terminatorPos)).filter(a => !isAuditFlag(a) && !isFundFlag(a) && !isProgressFlag(a));
|
|
53
|
-
const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos);
|
|
54
|
-
const useIpc = objects.isObject(ipc);
|
|
55
|
-
const useDebug = npmPaths.isDebug();
|
|
56
|
-
const isSilent = !useDebug && !npmArgs.some(isLoglevelFlag);
|
|
57
|
-
const isSpinning = spinner?.isSpinning ?? false;
|
|
58
|
-
if (!isSilent) {
|
|
59
|
-
spinner?.stop();
|
|
60
|
-
}
|
|
61
|
-
let spawnPromise = spawn(
|
|
62
|
-
// Lazily access constants.execPath.
|
|
63
|
-
constants.execPath, [
|
|
64
|
-
// Lazily access constants.nodeNoWarningsFlags.
|
|
65
|
-
...constants.nodeNoWarningsFlags, '--require',
|
|
66
|
-
// Lazily access constants.npmInjectionPath.
|
|
67
|
-
constants.npmInjectionPath, npmPaths.getNpmBinPath(), 'install',
|
|
68
|
-
// Even though the '--silent' flag is passed npm will still run through
|
|
69
|
-
// code paths for 'audit' and 'fund' unless '--no-audit' and '--no-fund'
|
|
70
|
-
// flags are passed.
|
|
71
|
-
'--no-audit', '--no-fund',
|
|
72
|
-
// Add `--no-progress` and `--silent` flags to fix input being swallowed
|
|
73
|
-
// by the spinner when running the command with recent versions of npm.
|
|
74
|
-
'--no-progress',
|
|
75
|
-
// Add the '--silent' flag if a loglevel flag is not provided and the
|
|
76
|
-
// SOCKET_CLI_DEBUG environment variable is not truthy.
|
|
77
|
-
...(isSilent ? ['--silent'] : []), ...npmArgs, ...otherArgs], {
|
|
78
|
-
signal: abortSignal,
|
|
79
|
-
// Set stdio to include 'ipc'.
|
|
80
|
-
// See https://github.com/nodejs/node/blob/v23.6.0/lib/child_process.js#L161-L166
|
|
81
|
-
// and https://github.com/nodejs/node/blob/v23.6.0/lib/internal/child_process.js#L238.
|
|
82
|
-
stdio: isSilent ?
|
|
83
|
-
// 'ignore'
|
|
84
|
-
useIpc ? ['ignore', 'ignore', 'ignore', 'ipc'] : 'ignore' :
|
|
85
|
-
// 'inherit'
|
|
86
|
-
useIpc ? [0, 1, 2, 'ipc'] : 'inherit',
|
|
87
|
-
...spawnOptions,
|
|
88
|
-
env: {
|
|
89
|
-
...process.env,
|
|
90
|
-
...spawnOptions.env
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
if (useIpc) {
|
|
94
|
-
spawnPromise.process.send({
|
|
95
|
-
[SOCKET_IPC_HANDSHAKE]: ipc
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
if (!isSilent && isSpinning) {
|
|
99
|
-
const oldSpawnPromise = spawnPromise;
|
|
100
|
-
spawnPromise = spawnPromise.finally(() => {
|
|
101
|
-
spinner?.start();
|
|
102
|
-
});
|
|
103
|
-
spawnPromise.process = oldSpawnPromise.process;
|
|
104
|
-
spawnPromise.stdin = spawnPromise.stdin;
|
|
105
|
-
}
|
|
106
|
-
return spawnPromise;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
exports.isLoglevelFlag = isLoglevelFlag;
|
|
110
|
-
exports.isProgressFlag = isProgressFlag;
|
|
111
|
-
exports.safeNpmInstall = safeNpmInstall;
|
|
112
|
-
//# debugId=e284aad0-2f5e-4bba-a5e4-010813e648a3
|
|
113
|
-
//# 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 { isObject } from '@socketsecurity/registry/lib/objects'\n\nimport { isDebug } from './debug'\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":"e284aad0-2f5e-4bba-a5e4-010813e648a3"}
|
package/dist/require/npm.js
DELETED