@socketsecurity/cli-with-sentry 0.14.66 → 0.14.68
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/dist/blessed/lib/alias.js +521 -0
- package/dist/blessed/lib/blessed.js +34 -0
- package/dist/blessed/lib/colors.js +492 -0
- package/dist/blessed/lib/events.js +197 -0
- package/dist/blessed/lib/gpmclient.js +247 -0
- package/dist/blessed/lib/helpers.js +172 -0
- package/dist/blessed/lib/keys.js +514 -0
- package/dist/blessed/lib/program.js +4532 -0
- package/dist/blessed/lib/tput.js +3113 -0
- package/dist/blessed/lib/unicode.js +914 -0
- package/dist/blessed/lib/widget.js +62 -0
- package/dist/blessed/lib/widgets/ansiimage.js +175 -0
- package/dist/blessed/lib/widgets/bigtext.js +172 -0
- package/dist/blessed/lib/widgets/box.js +36 -0
- package/dist/blessed/lib/widgets/button.js +64 -0
- package/dist/blessed/lib/widgets/checkbox.js +97 -0
- package/dist/blessed/lib/widgets/element.js +2873 -0
- package/dist/blessed/lib/widgets/filemanager.js +225 -0
- package/dist/blessed/lib/widgets/form.js +303 -0
- package/dist/blessed/lib/widgets/image.js +73 -0
- package/dist/blessed/lib/widgets/input.js +36 -0
- package/dist/blessed/lib/widgets/layout.js +251 -0
- package/dist/blessed/lib/widgets/line.js +61 -0
- package/dist/blessed/lib/widgets/list.js +654 -0
- package/dist/blessed/lib/widgets/listbar.js +454 -0
- package/dist/blessed/lib/widgets/listtable.js +267 -0
- package/dist/blessed/lib/widgets/loading.js +90 -0
- package/dist/blessed/lib/widgets/log.js +84 -0
- package/dist/blessed/lib/widgets/message.js +147 -0
- package/dist/blessed/lib/widgets/node.js +316 -0
- package/dist/blessed/lib/widgets/overlayimage.js +796 -0
- package/dist/blessed/lib/widgets/progressbar.js +168 -0
- package/dist/blessed/lib/widgets/prompt.js +129 -0
- package/dist/blessed/lib/widgets/question.js +131 -0
- package/dist/blessed/lib/widgets/radiobutton.js +64 -0
- package/dist/blessed/lib/widgets/radioset.js +38 -0
- package/dist/blessed/lib/widgets/screen.js +2489 -0
- package/dist/blessed/lib/widgets/scrollablebox.js +417 -0
- package/dist/blessed/lib/widgets/scrollabletext.js +37 -0
- package/dist/blessed/lib/widgets/table.js +385 -0
- package/dist/blessed/lib/widgets/terminal.js +454 -0
- package/dist/blessed/lib/widgets/text.js +37 -0
- package/dist/blessed/lib/widgets/textarea.js +378 -0
- package/dist/blessed/lib/widgets/textbox.js +81 -0
- package/dist/blessed/lib/widgets/video.js +132 -0
- package/dist/blessed/usr/fonts/AUTHORS +1 -0
- package/dist/blessed/usr/fonts/LICENSE +94 -0
- package/dist/blessed/usr/fonts/README +340 -0
- package/dist/blessed/usr/fonts/ter-u14b.json +17826 -0
- package/dist/blessed/usr/fonts/ter-u14n.json +17826 -0
- package/dist/blessed/usr/linux +0 -0
- package/dist/blessed/usr/windows-ansi +0 -0
- package/dist/blessed/usr/xterm +0 -0
- package/dist/blessed/usr/xterm-256color +0 -0
- package/dist/blessed/usr/xterm.termcap +243 -0
- package/dist/blessed/usr/xterm.terminfo +1977 -0
- package/dist/blessed/vendor/tng.js +1878 -0
- package/dist/constants.d.ts +271 -205
- package/dist/constants.js +273 -221
- package/dist/constants.js.map +1 -1
- package/dist/instrument-with-sentry.d.ts +1 -1
- package/dist/instrument-with-sentry.js +27 -24
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/module-sync/artifact.d.ts +60 -26
- package/dist/module-sync/cli.d.ts +1 -1
- package/dist/module-sync/cli.js +6991 -4413
- package/dist/module-sync/cli.js.map +1 -1
- package/dist/module-sync/cmd.d.ts +4 -4
- package/dist/module-sync/config.d.ts +32 -0
- package/dist/module-sync/edge.d.ts +73 -60
- package/dist/module-sync/errors.d.ts +26 -11
- package/dist/module-sync/fs.d.ts +61 -0
- package/dist/module-sync/index.d.ts +31 -20
- package/dist/module-sync/node.d.ts +118 -83
- package/dist/module-sync/override-set.d.ts +39 -33
- package/dist/module-sync/package-environment.d.ts +83 -52
- package/dist/module-sync/path-resolve.d.ts +14 -9
- package/dist/module-sync/sdk.d.ts +9 -5
- package/dist/module-sync/shadow-bin.d.ts +5 -2
- package/dist/module-sync/shadow-bin.js +82 -66
- package/dist/module-sync/shadow-bin.js.map +1 -1
- package/dist/module-sync/shadow-npm-inject.d.ts +1 -1
- package/dist/module-sync/shadow-npm-inject.js +1209 -1006
- package/dist/module-sync/shadow-npm-inject.js.map +1 -1
- package/dist/module-sync/shadow-npm-paths.d.ts +28 -14
- package/dist/module-sync/shadow-npm-paths.js +286 -209
- package/dist/module-sync/shadow-npm-paths.js.map +1 -1
- package/dist/module-sync/socket-package-alert.d.ts +95 -39
- package/dist/module-sync/types.d.ts +75 -47
- package/dist/module-sync/vendor.js +11181 -0
- package/dist/{require → module-sync}/vendor.js.map +1 -1
- package/dist/require/cli.d.ts +1 -1
- package/dist/require/cli.js +6991 -4411
- package/dist/require/cli.js.map +1 -1
- package/dist/require/vendor.js +2 -9145
- package/package.json +49 -41
- package/dist/module-sync/settings.d.ts +0 -15
|
@@ -1,56 +1,87 @@
|
|
|
1
|
-
import { Logger } from '@socketsecurity/registry/lib/logger'
|
|
2
|
-
import { Remap } from '@socketsecurity/registry/lib/objects'
|
|
3
|
-
import { EditablePackageJson } from '@socketsecurity/registry/lib/packages'
|
|
4
|
-
import { SemVer } from 'semver'
|
|
5
|
-
declare const AGENTS: readonly [
|
|
6
|
-
|
|
1
|
+
import { Logger } from '@socketsecurity/registry/lib/logger'
|
|
2
|
+
import { Remap } from '@socketsecurity/registry/lib/objects'
|
|
3
|
+
import { EditablePackageJson } from '@socketsecurity/registry/lib/packages'
|
|
4
|
+
import { SemVer } from 'semver'
|
|
5
|
+
declare const AGENTS: readonly [
|
|
6
|
+
'bun',
|
|
7
|
+
'npm',
|
|
8
|
+
'pnpm',
|
|
9
|
+
'yarn/berry',
|
|
10
|
+
'yarn/classic',
|
|
11
|
+
'vlt'
|
|
12
|
+
]
|
|
13
|
+
type Agent = (typeof AGENTS)[number]
|
|
7
14
|
type StringKeyValueObject = {
|
|
8
|
-
|
|
9
|
-
}
|
|
15
|
+
[key: string]: string
|
|
16
|
+
}
|
|
10
17
|
type DetectOptions = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
18
|
+
cwd?: string | undefined
|
|
19
|
+
onUnknown?: (pkgManager: string | undefined) => void
|
|
20
|
+
}
|
|
14
21
|
type EnvBase = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
type EnvDetails = Readonly<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
22
|
+
agent: Agent
|
|
23
|
+
agentExecPath: string
|
|
24
|
+
agentSupported: boolean
|
|
25
|
+
features: {
|
|
26
|
+
npmBuggyOverrides: boolean
|
|
27
|
+
}
|
|
28
|
+
nodeSupported: boolean
|
|
29
|
+
nodeVersion: SemVer
|
|
30
|
+
npmExecPath: string
|
|
31
|
+
pkgRequirements: {
|
|
32
|
+
agent: string
|
|
33
|
+
node: string
|
|
34
|
+
}
|
|
35
|
+
pkgSupports: {
|
|
36
|
+
agent: boolean
|
|
37
|
+
node: boolean
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
type EnvDetails = Readonly<
|
|
41
|
+
Remap<
|
|
42
|
+
EnvBase & {
|
|
43
|
+
agentVersion: SemVer
|
|
44
|
+
lockName: string
|
|
45
|
+
lockPath: string
|
|
46
|
+
lockSrc: string
|
|
47
|
+
pkgJson: EditablePackageJson
|
|
48
|
+
pkgPath: string
|
|
49
|
+
}
|
|
50
|
+
>
|
|
51
|
+
>
|
|
52
|
+
type PartialEnvDetails = Readonly<
|
|
53
|
+
Remap<
|
|
54
|
+
EnvBase & {
|
|
55
|
+
agentVersion: SemVer | undefined
|
|
56
|
+
lockName: string | undefined
|
|
57
|
+
lockPath: string | undefined
|
|
58
|
+
lockSrc: string | undefined
|
|
59
|
+
pkgJson: EditablePackageJson | undefined
|
|
60
|
+
pkgPath: string | undefined
|
|
61
|
+
}
|
|
62
|
+
>
|
|
63
|
+
>
|
|
64
|
+
declare function detectPackageEnvironment({
|
|
65
|
+
cwd,
|
|
66
|
+
onUnknown
|
|
67
|
+
}?: DetectOptions): Promise<EnvDetails | PartialEnvDetails>
|
|
50
68
|
type DetectAndValidateOptions = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
declare function detectAndValidatePackageEnvironment(
|
|
56
|
-
|
|
69
|
+
cmdName?: string | undefined
|
|
70
|
+
logger?: Logger | undefined
|
|
71
|
+
prod?: boolean | undefined
|
|
72
|
+
}
|
|
73
|
+
declare function detectAndValidatePackageEnvironment(
|
|
74
|
+
cwd: string,
|
|
75
|
+
options?: DetectAndValidateOptions | undefined
|
|
76
|
+
): Promise<void | EnvDetails>
|
|
77
|
+
export {
|
|
78
|
+
AGENTS,
|
|
79
|
+
Agent,
|
|
80
|
+
StringKeyValueObject,
|
|
81
|
+
DetectOptions,
|
|
82
|
+
EnvDetails,
|
|
83
|
+
PartialEnvDetails,
|
|
84
|
+
detectPackageEnvironment,
|
|
85
|
+
DetectAndValidateOptions,
|
|
86
|
+
detectAndValidatePackageEnvironment
|
|
87
|
+
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { SocketYml } from '@socketsecurity/config'
|
|
2
|
-
import { SocketSdkReturnType } from '@socketsecurity/sdk'
|
|
1
|
+
import { SocketYml } from '@socketsecurity/config'
|
|
2
|
+
import { SocketSdkReturnType } from '@socketsecurity/sdk'
|
|
3
3
|
declare function findBinPathDetailsSync(binName: string): {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
declare function findNpmPathSync(npmBinPath: string): string | undefined
|
|
9
|
-
declare function
|
|
10
|
-
|
|
4
|
+
name: string
|
|
5
|
+
path: string | undefined
|
|
6
|
+
shadowed: boolean
|
|
7
|
+
}
|
|
8
|
+
declare function findNpmPathSync(npmBinPath: string): string | undefined
|
|
9
|
+
declare function getPackageFilesForScan(
|
|
10
|
+
cwd: string,
|
|
11
|
+
inputPaths: string[],
|
|
12
|
+
supportedFiles: SocketSdkReturnType<'getReportSupportedFiles'>['data'],
|
|
13
|
+
config?: SocketYml | undefined
|
|
14
|
+
): Promise<string[]>
|
|
15
|
+
export { findBinPathDetailsSync, findNpmPathSync, getPackageFilesForScan }
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { SocketSdk } from '@socketsecurity/sdk'
|
|
2
|
-
declare function getDefaultToken(): string | undefined
|
|
3
|
-
declare function getPublicToken(): string
|
|
4
|
-
declare function setupSdk(
|
|
5
|
-
|
|
1
|
+
import { SocketSdk } from '@socketsecurity/sdk'
|
|
2
|
+
declare function getDefaultToken(): string | undefined
|
|
3
|
+
declare function getPublicToken(): string
|
|
4
|
+
declare function setupSdk(
|
|
5
|
+
apiToken?: string | undefined,
|
|
6
|
+
apiBaseUrl?: string | undefined,
|
|
7
|
+
proxy?: string | undefined
|
|
8
|
+
): Promise<SocketSdk>
|
|
9
|
+
export { getDefaultToken, getPublicToken, setupSdk }
|
|
@@ -1,105 +1,121 @@
|
|
|
1
|
-
'use strict'
|
|
1
|
+
'use strict'
|
|
2
2
|
|
|
3
3
|
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 && k !== '__esModule')
|
|
7
|
+
if (!c && k !== '__esModule') {
|
|
8
|
+
break
|
|
9
|
+
}
|
|
8
10
|
}
|
|
9
11
|
return c ? e.default : e
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const process = require('node:process')
|
|
15
|
+
const debug = require('@socketsecurity/registry/lib/debug')
|
|
16
|
+
const npm = require('@socketsecurity/registry/lib/npm')
|
|
17
|
+
const spawn = require('@socketsecurity/registry/lib/spawn')
|
|
18
|
+
const path = require('node:path')
|
|
19
|
+
const cmdShim = _socketInterop(require('cmd-shim'))
|
|
20
|
+
const shadowNpmPaths = require('./shadow-npm-paths.js')
|
|
21
|
+
const constants = require('./constants.js')
|
|
20
22
|
|
|
21
|
-
const {
|
|
22
|
-
CLI,
|
|
23
|
-
NPX
|
|
24
|
-
} = constants;
|
|
23
|
+
const { CLI, NPX } = constants
|
|
25
24
|
async function installLinks(realBinPath, binName) {
|
|
26
|
-
const isNpx = binName === NPX
|
|
25
|
+
const isNpx = binName === NPX
|
|
27
26
|
// Find package manager being shadowed by this process.
|
|
28
|
-
const binPath = isNpx
|
|
27
|
+
const binPath = isNpx
|
|
28
|
+
? shadowNpmPaths.getNpxBinPath()
|
|
29
|
+
: shadowNpmPaths.getNpmBinPath()
|
|
29
30
|
// Lazily access constants.WIN32.
|
|
30
|
-
const {
|
|
31
|
-
WIN32
|
|
32
|
-
} = constants;
|
|
31
|
+
const { WIN32 } = constants
|
|
33
32
|
// TODO: Is this early exit needed?
|
|
34
33
|
if (WIN32 && binPath) {
|
|
35
|
-
return binPath
|
|
34
|
+
return binPath
|
|
36
35
|
}
|
|
37
|
-
const shadowed = isNpx
|
|
36
|
+
const shadowed = isNpx
|
|
37
|
+
? shadowNpmPaths.isNpxBinPathShadowed()
|
|
38
|
+
: shadowNpmPaths.isNpmBinPathShadowed()
|
|
38
39
|
// Move our bin directory to front of PATH so its found first.
|
|
39
40
|
if (!shadowed) {
|
|
40
41
|
if (WIN32) {
|
|
41
42
|
await cmdShim(
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
// Lazily access constants.rootDistPath.
|
|
44
|
+
path.join(constants.rootDistPath, `${binName}-${CLI}.js`),
|
|
45
|
+
path.join(realBinPath, binName)
|
|
46
|
+
)
|
|
44
47
|
}
|
|
45
|
-
|
|
48
|
+
const { env } = process
|
|
49
|
+
env['PATH'] = `${realBinPath}${path.delimiter}${env['PATH']}`
|
|
46
50
|
}
|
|
47
|
-
return binPath
|
|
51
|
+
return binPath
|
|
48
52
|
}
|
|
49
53
|
|
|
50
|
-
const {
|
|
51
|
-
|
|
52
|
-
SOCKET_IPC_HANDSHAKE
|
|
53
|
-
} = constants;
|
|
54
|
+
const { SOCKET_CLI_SAFE_BIN, SOCKET_CLI_SAFE_PROGRESS, SOCKET_IPC_HANDSHAKE } =
|
|
55
|
+
constants
|
|
54
56
|
async function shadowBin(binName, args = process.argv.slice(2)) {
|
|
55
|
-
process.exitCode = 1
|
|
56
|
-
const useDebug = debug.isDebug()
|
|
57
|
-
const terminatorPos = args.indexOf('--')
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
57
|
+
process.exitCode = 1
|
|
58
|
+
const useDebug = debug.isDebug()
|
|
59
|
+
const terminatorPos = args.indexOf('--')
|
|
60
|
+
const rawBinArgs = terminatorPos === -1 ? args : args.slice(0, terminatorPos)
|
|
61
|
+
const progressArg =
|
|
62
|
+
rawBinArgs.findLast(npm.isProgressFlag) !== '--no-progress'
|
|
63
|
+
const binArgs = rawBinArgs.filter(a => !npm.isProgressFlag(a))
|
|
64
|
+
const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos)
|
|
65
|
+
const isSilent = !useDebug && !binArgs.some(npm.isLoglevelFlag)
|
|
61
66
|
// The default value of loglevel is "notice". We default to "error" which is
|
|
62
67
|
// two levels quieter.
|
|
63
|
-
const logLevelArgs = isSilent ? ['--loglevel', 'error'] : []
|
|
68
|
+
const logLevelArgs = isSilent ? ['--loglevel', 'error'] : []
|
|
64
69
|
const spawnPromise = spawn.spawn(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
// Lazily access constants.execPath.
|
|
71
|
+
constants.execPath,
|
|
72
|
+
[
|
|
73
|
+
// Lazily access constants.nodeHardenFlags.
|
|
74
|
+
...constants.nodeHardenFlags,
|
|
75
|
+
// Lazily access constants.nodeNoWarningsFlags.
|
|
76
|
+
...constants.nodeNoWarningsFlags,
|
|
77
|
+
// Lazily access true.
|
|
78
|
+
...[
|
|
79
|
+
'--require',
|
|
80
|
+
// Lazily access constants.distInstrumentWithSentryPath.
|
|
81
|
+
constants.distInstrumentWithSentryPath
|
|
82
|
+
],
|
|
83
|
+
'--require',
|
|
84
|
+
// Lazily access constants.distShadowNpmInjectPath.
|
|
85
|
+
constants.distShadowNpmInjectPath,
|
|
86
|
+
// Lazily access constants.shadowBinPath.
|
|
87
|
+
await installLinks(constants.shadowBinPath, binName),
|
|
88
|
+
// Add '--no-progress' to fix input being swallowed by the npm spinner.
|
|
89
|
+
'--no-progress',
|
|
90
|
+
// Add '--loglevel=error' if a loglevel flag is not provided and the
|
|
91
|
+
// SOCKET_CLI_DEBUG environment variable is not truthy.
|
|
92
|
+
...logLevelArgs,
|
|
93
|
+
...binArgs,
|
|
94
|
+
...otherArgs
|
|
95
|
+
],
|
|
96
|
+
{
|
|
97
|
+
// 'inherit' + 'ipc'
|
|
98
|
+
stdio: [0, 1, 2, 'ipc']
|
|
99
|
+
}
|
|
100
|
+
)
|
|
87
101
|
// See https://nodejs.org/api/all.html#all_child_process_event-exit.
|
|
88
102
|
spawnPromise.process.on('exit', (code, signalName) => {
|
|
89
103
|
if (signalName) {
|
|
90
|
-
process.kill(process.pid, signalName)
|
|
104
|
+
process.kill(process.pid, signalName)
|
|
91
105
|
} else if (code !== null) {
|
|
92
|
-
process
|
|
106
|
+
// eslint-disable-next-line n/no-process-exit
|
|
107
|
+
process.exit(code)
|
|
93
108
|
}
|
|
94
|
-
})
|
|
109
|
+
})
|
|
95
110
|
spawnPromise.process.send({
|
|
96
111
|
[SOCKET_IPC_HANDSHAKE]: {
|
|
97
|
-
[
|
|
112
|
+
[SOCKET_CLI_SAFE_BIN]: binName,
|
|
113
|
+
[SOCKET_CLI_SAFE_PROGRESS]: progressArg
|
|
98
114
|
}
|
|
99
|
-
})
|
|
100
|
-
await spawnPromise
|
|
115
|
+
})
|
|
116
|
+
await spawnPromise
|
|
101
117
|
}
|
|
102
118
|
|
|
103
|
-
module.exports = shadowBin
|
|
104
|
-
//# debugId=
|
|
119
|
+
module.exports = shadowBin
|
|
120
|
+
//# debugId=3488d19d-a988-44e5-a63f-309d31b935be
|
|
105
121
|
//# sourceMappingURL=shadow-bin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadow-bin.js","sources":["../../src/shadow/npm/link.ts","../../src/shadow/npm/bin.ts"],"sourcesContent":["import path from 'node:path'\nimport process from 'node:process'\n\nimport cmdShim from 'cmd-shim'\n\nimport {\n getNpmBinPath,\n getNpxBinPath,\n isNpmBinPathShadowed,\n isNpxBinPathShadowed\n} from './paths'\nimport constants from '../../constants'\n\nconst { CLI, NPX } = constants\n\nexport async function installLinks(\n realBinPath: string,\n binName: 'npm' | 'npx'\n): Promise<string> {\n const isNpx = binName === NPX\n // Find package manager being shadowed by this process.\n const binPath = isNpx ? getNpxBinPath() : getNpmBinPath()\n // Lazily access constants.WIN32.\n const { WIN32 } = constants\n // TODO: Is this early exit needed?\n if (WIN32 && binPath) {\n return binPath\n }\n const shadowed = isNpx ? isNpxBinPathShadowed() : isNpmBinPathShadowed()\n // Move our bin directory to front of PATH so its found first.\n if (!shadowed) {\n if (WIN32) {\n await cmdShim(\n // Lazily access constants.rootDistPath.\n path.join(constants.rootDistPath, `${binName}-${CLI}.js`),\n path.join(realBinPath, binName)\n )\n }\n process
|
|
1
|
+
{"version":3,"file":"shadow-bin.js","sources":["../../src/shadow/npm/link.ts","../../src/shadow/npm/bin.ts"],"sourcesContent":["import path from 'node:path'\nimport process from 'node:process'\n\nimport cmdShim from 'cmd-shim'\n\nimport {\n getNpmBinPath,\n getNpxBinPath,\n isNpmBinPathShadowed,\n isNpxBinPathShadowed\n} from './paths'\nimport constants from '../../constants'\n\nconst { CLI, NPX } = constants\n\nexport async function installLinks(\n realBinPath: string,\n binName: 'npm' | 'npx'\n): Promise<string> {\n const isNpx = binName === NPX\n // Find package manager being shadowed by this process.\n const binPath = isNpx ? getNpxBinPath() : getNpmBinPath()\n // Lazily access constants.WIN32.\n const { WIN32 } = constants\n // TODO: Is this early exit needed?\n if (WIN32 && binPath) {\n return binPath\n }\n const shadowed = isNpx ? isNpxBinPathShadowed() : isNpmBinPathShadowed()\n // Move our bin directory to front of PATH so its found first.\n if (!shadowed) {\n if (WIN32) {\n await cmdShim(\n // Lazily access constants.rootDistPath.\n path.join(constants.rootDistPath, `${binName}-${CLI}.js`),\n path.join(realBinPath, binName)\n )\n }\n const { env } = process\n env['PATH'] = `${realBinPath}${path.delimiter}${env['PATH']}`\n }\n return binPath\n}\n","import process from 'node:process'\n\nimport { isDebug } from '@socketsecurity/registry/lib/debug'\nimport {\n isLoglevelFlag,\n isProgressFlag\n} from '@socketsecurity/registry/lib/npm'\nimport { spawn } from '@socketsecurity/registry/lib/spawn'\n\nimport { installLinks } from './link'\nimport constants from '../../constants'\n\nconst { SOCKET_CLI_SAFE_BIN, SOCKET_CLI_SAFE_PROGRESS, SOCKET_IPC_HANDSHAKE } =\n constants\n\nexport default async function shadowBin(\n binName: 'npm' | 'npx',\n args = process.argv.slice(2)\n) {\n process.exitCode = 1\n const useDebug = isDebug()\n const terminatorPos = args.indexOf('--')\n const rawBinArgs = terminatorPos === -1 ? args : args.slice(0, terminatorPos)\n const progressArg = rawBinArgs.findLast(isProgressFlag) !== '--no-progress'\n const binArgs = rawBinArgs.filter(a => !isProgressFlag(a))\n const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos)\n const isSilent = !useDebug && !binArgs.some(isLoglevelFlag)\n // The default value of loglevel is \"notice\". We default to \"error\" which is\n // two levels quieter.\n const logLevelArgs = isSilent ? ['--loglevel', 'error'] : []\n const spawnPromise = spawn(\n // Lazily access constants.execPath.\n constants.execPath,\n [\n // Lazily access constants.nodeHardenFlags.\n ...constants.nodeHardenFlags,\n // Lazily access constants.nodeNoWarningsFlags.\n ...constants.nodeNoWarningsFlags,\n // Lazily access process.env['INLINED_SOCKET_CLI_SENTRY_BUILD'].\n ...(process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']\n ? [\n '--require',\n // Lazily access constants.distInstrumentWithSentryPath.\n constants.distInstrumentWithSentryPath\n ]\n : []),\n '--require',\n // Lazily access constants.distShadowNpmInjectPath.\n constants.distShadowNpmInjectPath,\n // Lazily access constants.shadowBinPath.\n await installLinks(constants.shadowBinPath, binName),\n // Add '--no-progress' to fix input being swallowed by the npm spinner.\n '--no-progress',\n // Add '--loglevel=error' if a loglevel flag is not provided and the\n // SOCKET_CLI_DEBUG environment variable is not truthy.\n ...logLevelArgs,\n ...binArgs,\n ...otherArgs\n ],\n {\n // 'inherit' + 'ipc'\n stdio: [0, 1, 2, 'ipc']\n }\n )\n // See https://nodejs.org/api/all.html#all_child_process_event-exit.\n spawnPromise.process.on('exit', (code, signalName) => {\n if (signalName) {\n process.kill(process.pid, signalName)\n } else if (code !== null) {\n // eslint-disable-next-line n/no-process-exit\n process.exit(code)\n }\n })\n spawnPromise.process.send({\n [SOCKET_IPC_HANDSHAKE]: {\n [SOCKET_CLI_SAFE_BIN]: binName,\n [SOCKET_CLI_SAFE_PROGRESS]: progressArg\n }\n })\n await spawnPromise\n}\n"],"names":["NPX","WIN32","env","SOCKET_IPC_HANDSHAKE","constants","process","spawnPromise"],"mappings":";;;;;;;;;;;;;;;;;;;;AAaA;;AAAaA;AAAI;AAEV;AAIL;AACA;;AAEA;;AACQC;AAAM;AACd;;AAEE;AACF;;AAEA;;AAEE;AACE;AACE;;AAIJ;;AACQC;AAAI;AACZA;AACF;AACA;AACF;;AC9BA;;;AAAuDC;AAAqB;AAG7D;;AAKb;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGE;;AAGE;;AAEA;;AAEA;;AAIM;AACAC;AAIN;AACAA;AACA;AACA;AACA;;AAEA;AACA;;AAMA;;AAEF;AAEF;;AAEE;;AAEA;AACE;AACAC;AACF;AACF;AACAC;AACE;;AAEE;AACF;AACF;AACA;AACF;;","debugId":"3488d19d-a988-44e5-a63f-309d31b935be"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {}
|