@socketsecurity/cli-with-sentry 1.1.15 → 1.1.18
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/CHANGELOG.md +15 -0
- package/dist/cli.js +14 -15
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +35 -37
- package/dist/constants.js.map +1 -1
- package/dist/shadow-npm-bin.js +6 -6
- package/dist/shadow-npm-bin.js.map +1 -1
- package/dist/shadow-pnpm-bin.js +3 -5
- package/dist/shadow-pnpm-bin.js.map +1 -1
- package/dist/shadow-yarn-bin.js +2 -2
- package/dist/shadow-yarn-bin.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
- package/dist/types/commands/optimize/apply-optimization.d.mts.map +1 -1
- package/dist/types/commands/optimize/update-lockfile.d.mts.map +1 -1
- package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -1
- package/dist/types/commands/patch/handle-patch.d.mts.map +1 -1
- package/dist/types/commands/yarn/cmd-yarn.d.mts +1 -1
- package/dist/types/commands/yarn/cmd-yarn.d.mts.map +1 -1
- package/dist/types/constants.d.mts +15 -19
- package/dist/types/constants.d.mts.map +1 -1
- package/dist/types/shadow/pnpm/bin.d.mts.map +1 -1
- package/dist/types/utils/agent.d.mts.map +1 -1
- package/dist/types/utils/dlx.d.mts.map +1 -1
- package/dist/types/utils/package-environment.d.mts.map +1 -1
- package/dist/types/utils/path-resolve.d.mts.map +1 -1
- package/dist/utils.js +65 -27
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +522 -524
- package/external/@socketsecurity/registry/external/@inquirer/confirm.js +45 -205
- package/external/@socketsecurity/registry/external/@inquirer/input.js +45 -205
- package/external/@socketsecurity/registry/external/@inquirer/password.js +181 -205
- package/external/@socketsecurity/registry/external/@inquirer/search.js +47 -207
- package/external/@socketsecurity/registry/external/@inquirer/select.js +183 -207
- package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +388 -2280
- package/external/@socketsecurity/registry/external/browserslist.js +11534 -567
- package/external/@socketsecurity/registry/external/cacache.js +2575 -4914
- package/external/@socketsecurity/registry/external/libnpmpack.js +64667 -166061
- package/external/@socketsecurity/registry/external/make-fetch-happen.js +384 -4044
- package/external/@socketsecurity/registry/external/normalize-package-data.js +30 -278
- package/external/@socketsecurity/registry/external/npm-package-arg.js +28 -9
- package/external/@socketsecurity/registry/external/pacote.js +46680 -66482
- package/external/@socketsecurity/registry/external/spdx-correct.js +19 -0
- package/external/@socketsecurity/registry/external/spdx-expression-parse.js +19 -0
- package/external/@socketsecurity/registry/lib/agent.js +390 -0
- package/external/@socketsecurity/registry/lib/arrays.js +31 -0
- package/external/@socketsecurity/registry/lib/bin.js +650 -0
- package/external/@socketsecurity/registry/lib/constants/bun-lock.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/bun-lockb.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/bun.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/dot-git-dir.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/dot-socket-dir.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/empty-value.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/env.js +17 -3
- package/external/@socketsecurity/registry/lib/constants/ext-yaml.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/ext-yml.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/index.js +20 -11
- package/external/@socketsecurity/registry/lib/constants/npm-exec-path.js +2 -2
- package/external/@socketsecurity/registry/lib/constants/npm-real-exec-path.js +1 -1
- package/external/@socketsecurity/registry/lib/constants/npm-shrinkwrap-json.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/pnpm-exec-path.js +5 -0
- package/external/@socketsecurity/registry/lib/constants/pnpm-lock-yaml.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/unknown-error.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/unknown-value.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/vlt-lock-json.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/vlt.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/yarn-berry.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/yarn-classic.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/yarn-exec-path.js +5 -0
- package/external/@socketsecurity/registry/lib/constants/yarn.js +3 -0
- package/external/@socketsecurity/registry/lib/debug.js +53 -0
- package/external/@socketsecurity/registry/lib/env.js +18 -0
- package/external/@socketsecurity/registry/lib/fs.js +218 -2
- package/external/@socketsecurity/registry/lib/functions.js +5 -0
- package/external/@socketsecurity/registry/lib/globs.js +22 -1
- package/external/@socketsecurity/registry/lib/json.js +16 -0
- package/external/@socketsecurity/registry/lib/logger.js +157 -0
- package/external/@socketsecurity/registry/lib/objects.js +103 -0
- package/external/@socketsecurity/registry/lib/packages.js +88 -0
- package/external/@socketsecurity/registry/lib/path.js +51 -1
- package/external/@socketsecurity/registry/lib/promises.js +55 -0
- package/external/@socketsecurity/registry/lib/regexps.js +5 -0
- package/external/@socketsecurity/registry/lib/sorts.js +17 -0
- package/external/@socketsecurity/registry/lib/spawn.js +105 -7
- package/external/@socketsecurity/registry/lib/streams.js +26 -0
- package/external/@socketsecurity/registry/lib/strings.js +123 -9
- package/external/@socketsecurity/registry/lib/url.js +21 -0
- package/external/@socketsecurity/registry/lib/words.js +16 -0
- package/external/@socketsecurity/registry/manifest.json +5 -4
- package/package.json +6 -5
- package/external/@socketsecurity/registry/external/ansi-regex.js +0 -13
- package/external/@socketsecurity/registry/lib/constants/node-workspaces.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/parse-args-config.js +0 -14
- package/external/@socketsecurity/registry/lib/constants/skip-tests-by-ecosystem.js +0 -43
- package/external/@socketsecurity/registry/lib/constants/template-cjs-browser.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/template-cjs-esm.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/template-cjs.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/template-es-shim-constructor.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/template-es-shim-prototype-method.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/template-es-shim-static-method.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/win32-ensure-tests-by-ecosystem.js +0 -3
- package/external/@socketsecurity/registry/lib/npm.js +0 -404
- /package/external/@socketsecurity/registry/lib/constants/{hidden-package-lock-json.js → dot-package-lock-json.js} +0 -0
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { isDebug } = /*@__PURE__*/ require('./debug')
|
|
4
|
-
const { readJsonSync } = /*@__PURE__*/ require('./fs')
|
|
5
|
-
const { isPath } = /*@__PURE__*/ require('./path')
|
|
6
|
-
const { spawn } = /*@__PURE__*/ require('./spawn')
|
|
7
|
-
|
|
8
|
-
let _fs
|
|
9
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
10
|
-
function getFs() {
|
|
11
|
-
if (_fs === undefined) {
|
|
12
|
-
// Use non-'node:' prefixed require to avoid Webpack errors.
|
|
13
|
-
// eslint-disable-next-line n/prefer-node-protocol
|
|
14
|
-
_fs = /*@__PURE__*/ require('fs')
|
|
15
|
-
}
|
|
16
|
-
return _fs
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let _path
|
|
20
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
21
|
-
function getPath() {
|
|
22
|
-
if (_path === undefined) {
|
|
23
|
-
// Use non-'node:' prefixed require to avoid Webpack errors.
|
|
24
|
-
// eslint-disable-next-line n/prefer-node-protocol
|
|
25
|
-
_path = /*@__PURE__*/ require('path')
|
|
26
|
-
}
|
|
27
|
-
return _path
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let _which
|
|
31
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
32
|
-
function getWhich() {
|
|
33
|
-
if (_which === undefined) {
|
|
34
|
-
_which = /*@__PURE__*/ require('../external/which')
|
|
35
|
-
}
|
|
36
|
-
return _which
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const auditFlags = new Set(['--audit', '--no-audit'])
|
|
40
|
-
|
|
41
|
-
const fundFlags = new Set(['--fund', '--no-fund'])
|
|
42
|
-
|
|
43
|
-
// https://docs.npmjs.com/cli/v11/using-npm/logging#aliases
|
|
44
|
-
const logFlags = new Set([
|
|
45
|
-
'--loglevel',
|
|
46
|
-
'-d',
|
|
47
|
-
'--dd',
|
|
48
|
-
'--ddd',
|
|
49
|
-
'-q',
|
|
50
|
-
'--quiet',
|
|
51
|
-
'-s',
|
|
52
|
-
'--silent'
|
|
53
|
-
])
|
|
54
|
-
|
|
55
|
-
const progressFlags = new Set(['--progress', '--no-progress'])
|
|
56
|
-
|
|
57
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
58
|
-
function execNpm(args, options) {
|
|
59
|
-
const useDebug = isDebug()
|
|
60
|
-
const terminatorPos = args.indexOf('--')
|
|
61
|
-
const npmArgs = (
|
|
62
|
-
terminatorPos === -1 ? args : args.slice(0, terminatorPos)
|
|
63
|
-
).filter(
|
|
64
|
-
a => !isNpmAuditFlag(a) && !isNpmFundFlag(a) && !isNpmProgressFlag(a)
|
|
65
|
-
)
|
|
66
|
-
const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos)
|
|
67
|
-
const logLevelArgs =
|
|
68
|
-
// The default value of loglevel is "notice". We default to "warn" which is
|
|
69
|
-
// one level quieter.
|
|
70
|
-
useDebug || npmArgs.some(isNpmLoglevelFlag) ? [] : ['--loglevel', 'warn']
|
|
71
|
-
return spawn(
|
|
72
|
-
/*@__PURE__*/ require('./constants/exec-path'),
|
|
73
|
-
[
|
|
74
|
-
.../*@__PURE__*/ require('./constants/node-harden-flags'),
|
|
75
|
-
.../*@__PURE__*/ require('./constants/node-no-warnings-flags'),
|
|
76
|
-
/*@__PURE__*/ require('./constants/npm-real-exec-path'),
|
|
77
|
-
// Even though '--loglevel=error' is passed npm will still run through
|
|
78
|
-
// code paths for 'audit' and 'fund' unless '--no-audit' and '--no-fund'
|
|
79
|
-
// flags are passed.
|
|
80
|
-
'--no-audit',
|
|
81
|
-
'--no-fund',
|
|
82
|
-
// Add `--no-progress` and `--silent` flags to fix input being swallowed
|
|
83
|
-
// by the spinner when running the command with recent versions of npm.
|
|
84
|
-
'--no-progress',
|
|
85
|
-
// Add '--loglevel=error' if a loglevel flag is not provided and the
|
|
86
|
-
// SOCKET_CLI_DEBUG environment variable is not truthy.
|
|
87
|
-
...logLevelArgs,
|
|
88
|
-
...npmArgs,
|
|
89
|
-
...otherArgs
|
|
90
|
-
],
|
|
91
|
-
{
|
|
92
|
-
__proto__: null,
|
|
93
|
-
...options
|
|
94
|
-
}
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
99
|
-
function getNotResolvedError(binPath, source = '') {
|
|
100
|
-
// Based on node-which:
|
|
101
|
-
// ISC License
|
|
102
|
-
// Copyright (c) Isaac Z. Schlueter and Contributors
|
|
103
|
-
// https://github.com/npm/node-which/blob/v5.0.0/lib/index.js#L15
|
|
104
|
-
const error = new Error(
|
|
105
|
-
`not resolved: ${binPath}${source ? `:\n\n${source}` : ''}`
|
|
106
|
-
)
|
|
107
|
-
error.code = 'ENOENT'
|
|
108
|
-
return error
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
112
|
-
function isNpmAuditFlag(cmdArg) {
|
|
113
|
-
return auditFlags.has(cmdArg)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
117
|
-
function isNpmFundFlag(cmdArg) {
|
|
118
|
-
return fundFlags.has(cmdArg)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
122
|
-
function isNpmLoglevelFlag(cmdArg) {
|
|
123
|
-
// https://docs.npmjs.com/cli/v11/using-npm/logging#setting-log-levels
|
|
124
|
-
return cmdArg.startsWith('--loglevel=') || logFlags.has(cmdArg)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
128
|
-
function isNpmNodeOptionsFlag(cmdArg) {
|
|
129
|
-
// https://docs.npmjs.com/cli/v9/using-npm/config#node-options
|
|
130
|
-
return cmdArg.startsWith('--node-options=')
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
134
|
-
function isNpmProgressFlag(cmdArg) {
|
|
135
|
-
return progressFlags.has(cmdArg)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
139
|
-
function resolveBinPathSync(binPath) {
|
|
140
|
-
const fs = getFs()
|
|
141
|
-
const path = getPath()
|
|
142
|
-
const ext = path.extname(binPath)
|
|
143
|
-
const extLowered = ext.toLowerCase()
|
|
144
|
-
const basename = path.basename(binPath, ext)
|
|
145
|
-
const voltaIndex =
|
|
146
|
-
basename === 'node'
|
|
147
|
-
? -1
|
|
148
|
-
: (/(?<=[\\/]\.volta[\\/])/i.exec(binPath)?.index ?? -1)
|
|
149
|
-
|
|
150
|
-
if (voltaIndex !== -1) {
|
|
151
|
-
const voltaPath = binPath.slice(0, voltaIndex)
|
|
152
|
-
const voltaToolsPath = path.join(voltaPath, 'tools')
|
|
153
|
-
const voltaImagePath = path.join(voltaToolsPath, 'image')
|
|
154
|
-
const voltaUserPath = path.join(voltaToolsPath, 'user')
|
|
155
|
-
const voltaPlatform = readJsonSync(
|
|
156
|
-
path.join(voltaUserPath, 'platform.json'),
|
|
157
|
-
{ throws: false }
|
|
158
|
-
)
|
|
159
|
-
const voltaNodeVersion = voltaPlatform?.node?.runtime
|
|
160
|
-
const voltaNpmVersion = voltaPlatform?.node?.npm
|
|
161
|
-
let voltaBinPath = ''
|
|
162
|
-
if (basename === 'npm' || basename === 'npx') {
|
|
163
|
-
if (voltaNpmVersion) {
|
|
164
|
-
const relCliPath = `bin/${basename}-cli.js`
|
|
165
|
-
voltaBinPath = path.join(
|
|
166
|
-
voltaImagePath,
|
|
167
|
-
`npm/${voltaNpmVersion}/${relCliPath}`
|
|
168
|
-
)
|
|
169
|
-
if (voltaNodeVersion && !fs.existsSync(voltaBinPath)) {
|
|
170
|
-
voltaBinPath = path.join(
|
|
171
|
-
voltaImagePath,
|
|
172
|
-
`node/${voltaNodeVersion}/lib/node_modules/npm/${relCliPath}`
|
|
173
|
-
)
|
|
174
|
-
if (!fs.existsSync(voltaBinPath)) {
|
|
175
|
-
voltaBinPath = ''
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
} else {
|
|
180
|
-
const voltaUserBinPath = path.join(voltaUserPath, 'bin')
|
|
181
|
-
const binInfo = readJsonSync(
|
|
182
|
-
path.join(voltaUserBinPath, `${basename}.json`),
|
|
183
|
-
{ throws: false }
|
|
184
|
-
)
|
|
185
|
-
const binPackage = binInfo?.package
|
|
186
|
-
if (binPackage) {
|
|
187
|
-
voltaBinPath = path.join(
|
|
188
|
-
voltaImagePath,
|
|
189
|
-
`packages/${binPackage}/bin/${basename}`
|
|
190
|
-
)
|
|
191
|
-
if (!fs.existsSync(voltaBinPath)) {
|
|
192
|
-
voltaBinPath = `${voltaBinPath}.cmd`
|
|
193
|
-
if (!fs.existsSync(voltaBinPath)) {
|
|
194
|
-
voltaBinPath = ''
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
if (voltaBinPath) {
|
|
200
|
-
return fs.realpathSync.native(voltaBinPath)
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const WIN32 = /*@__PURE__*/ require('./constants/win32')
|
|
205
|
-
if (WIN32) {
|
|
206
|
-
const hasKnownExt =
|
|
207
|
-
extLowered === '' || extLowered === '.cmd' || extLowered === '.ps1'
|
|
208
|
-
const isNpmOrNpx = basename === 'npm' || basename === 'npx'
|
|
209
|
-
if (hasKnownExt && isNpmOrNpx) {
|
|
210
|
-
// The quick route assumes a bin path like: C:\Program Files\nodejs\npm.cmd
|
|
211
|
-
const quickPath = path.join(
|
|
212
|
-
path.dirname(binPath),
|
|
213
|
-
`node_modules/npm/bin/${basename}-cli.js`
|
|
214
|
-
)
|
|
215
|
-
if (fs.existsSync(quickPath)) {
|
|
216
|
-
return fs.realpathSync.native(quickPath)
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
let relPath = ''
|
|
221
|
-
if (hasKnownExt) {
|
|
222
|
-
const source = fs.readFileSync(binPath, 'utf8')
|
|
223
|
-
if (isNpmOrNpx) {
|
|
224
|
-
if (extLowered === '.cmd') {
|
|
225
|
-
// "npm.cmd" and "npx.cmd" defined by
|
|
226
|
-
// https://github.com/npm/cli/blob/v11.4.2/bin/npm.cmd
|
|
227
|
-
// https://github.com/npm/cli/blob/v11.4.2/bin/npx.cmd
|
|
228
|
-
relPath =
|
|
229
|
-
basename === 'npm'
|
|
230
|
-
? /(?<="NPM_CLI_JS=%~dp0\\).*(?=")/.exec(source)?.[0]
|
|
231
|
-
: /(?<="NPX_CLI_JS=%~dp0\\).*(?=")/.exec(source)?.[0]
|
|
232
|
-
} else if (extLowered === '') {
|
|
233
|
-
// Extensionless "npm" and "npx" defined by
|
|
234
|
-
// https://github.com/npm/cli/blob/v11.4.2/bin/npm
|
|
235
|
-
// https://github.com/npm/cli/blob/v11.4.2/bin/npx
|
|
236
|
-
relPath =
|
|
237
|
-
basename === 'npm'
|
|
238
|
-
? /(?<=NPM_CLI_JS="\$CLI_BASEDIR\/).*(?=")/.exec(source)?.[0]
|
|
239
|
-
: /(?<=NPX_CLI_JS="\$CLI_BASEDIR\/).*(?=")/.exec(source)?.[0]
|
|
240
|
-
} else if (extLowered === '.ps1') {
|
|
241
|
-
// "npm.ps1" and "npx.ps1" defined by
|
|
242
|
-
// https://github.com/npm/cli/blob/v11.4.2/bin/npm.ps1
|
|
243
|
-
// https://github.com/npm/cli/blob/v11.4.2/bin/npx.ps1
|
|
244
|
-
relPath =
|
|
245
|
-
basename === 'npm'
|
|
246
|
-
? /(?<=\$NPM_CLI_JS="\$PSScriptRoot\/).*(?=")/.exec(source)?.[0]
|
|
247
|
-
: /(?<=\$NPX_CLI_JS="\$PSScriptRoot\/).*(?=")/.exec(source)?.[0]
|
|
248
|
-
}
|
|
249
|
-
} else if (extLowered === '.cmd') {
|
|
250
|
-
// "bin.CMD" generated by
|
|
251
|
-
// https://github.com/npm/cmd-shim/blob/v7.0.0/lib/index.js#L98:
|
|
252
|
-
//
|
|
253
|
-
// @ECHO off
|
|
254
|
-
// GOTO start
|
|
255
|
-
// :find_dp0
|
|
256
|
-
// SET dp0=%~dp0
|
|
257
|
-
// EXIT /b
|
|
258
|
-
// :start
|
|
259
|
-
// SETLOCAL
|
|
260
|
-
// CALL :find_dp0
|
|
261
|
-
//
|
|
262
|
-
// IF EXIST "%dp0%\node.exe" (
|
|
263
|
-
// SET "_prog=%dp0%\node.exe"
|
|
264
|
-
// ) ELSE (
|
|
265
|
-
// SET "_prog=node"
|
|
266
|
-
// SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
267
|
-
// )
|
|
268
|
-
//
|
|
269
|
-
// endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\<PACKAGE_NAME>\path\to\bin.js" %*
|
|
270
|
-
relPath = /(?<="%dp0%\\).*(?=" %\*\r\n)/.exec(source)?.[0]
|
|
271
|
-
} else if (extLowered === '') {
|
|
272
|
-
// Extensionless "bin" generated by
|
|
273
|
-
// https://github.com/npm/cmd-shim/blob/v7.0.0/lib/index.js#L138:
|
|
274
|
-
//
|
|
275
|
-
// #!/bin/sh
|
|
276
|
-
// basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
277
|
-
//
|
|
278
|
-
// case `uname` in
|
|
279
|
-
// *CYGWIN*|*MINGW*|*MSYS*)
|
|
280
|
-
// if command -v cygpath > /dev/null 2>&1; then
|
|
281
|
-
// basedir=`cygpath -w "$basedir"`
|
|
282
|
-
// fi
|
|
283
|
-
// ;;
|
|
284
|
-
// esac
|
|
285
|
-
//
|
|
286
|
-
// if [ -x "$basedir/node" ]; then
|
|
287
|
-
// exec "$basedir/node" "$basedir/../<PACKAGE_NAME>/path/to/bin.js" "$@"
|
|
288
|
-
// else
|
|
289
|
-
// exec node "$basedir/../<PACKAGE_NAME>/path/to/bin.js" "$@"
|
|
290
|
-
// fi
|
|
291
|
-
relPath = /(?<="$basedir\/).*(?=" "\$@"\n)/.exec(source)?.[0]
|
|
292
|
-
} else if (extLowered === '.ps1') {
|
|
293
|
-
// "bin.PS1" generated by
|
|
294
|
-
// https://github.com/npm/cmd-shim/blob/v7.0.0/lib/index.js#L192:
|
|
295
|
-
//
|
|
296
|
-
// #!/usr/bin/env pwsh
|
|
297
|
-
// $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
298
|
-
//
|
|
299
|
-
// $exe=""
|
|
300
|
-
// if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
301
|
-
// # Fix case when both the Windows and Linux builds of Node
|
|
302
|
-
// # are installed in the same directory
|
|
303
|
-
// $exe=".exe"
|
|
304
|
-
// }
|
|
305
|
-
// $ret=0
|
|
306
|
-
// if (Test-Path "$basedir/node$exe") {
|
|
307
|
-
// # Support pipeline input
|
|
308
|
-
// if ($MyInvocation.ExpectingInput) {
|
|
309
|
-
// $input | & "$basedir/node$exe" "$basedir/../<PACKAGE_NAME>/path/to/bin.js" $args
|
|
310
|
-
// } else {
|
|
311
|
-
// & "$basedir/node$exe" "$basedir/../<PACKAGE_NAME>/path/to/bin.js" $args
|
|
312
|
-
// }
|
|
313
|
-
// $ret=$LASTEXITCODE
|
|
314
|
-
// } else {
|
|
315
|
-
// # Support pipeline input
|
|
316
|
-
// if ($MyInvocation.ExpectingInput) {
|
|
317
|
-
// $input | & "node$exe" "$basedir/../<PACKAGE_NAME>/path/to/bin.js" $args
|
|
318
|
-
// } else {
|
|
319
|
-
// & "node$exe" "$basedir/../<PACKAGE_NAME>/path/to/bin.js" $args
|
|
320
|
-
// }
|
|
321
|
-
// $ret=$LASTEXITCODE
|
|
322
|
-
// }
|
|
323
|
-
// exit $ret
|
|
324
|
-
relPath = /(?<="\$basedir\/).*(?=" $args\n)/.exec(source)?.[0]
|
|
325
|
-
}
|
|
326
|
-
if (!relPath) {
|
|
327
|
-
throw getNotResolvedError(binPath, source)
|
|
328
|
-
}
|
|
329
|
-
binPath = path.join(path.dirname(binPath), relPath)
|
|
330
|
-
} else if (
|
|
331
|
-
extLowered !== '.js' &&
|
|
332
|
-
extLowered !== '.cjs' &&
|
|
333
|
-
extLowered !== '.mjs' &&
|
|
334
|
-
extLowered !== '.ts' &&
|
|
335
|
-
extLowered !== '.cts' &&
|
|
336
|
-
extLowered !== '.mts'
|
|
337
|
-
) {
|
|
338
|
-
throw getNotResolvedError(binPath)
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
return fs.realpathSync.native(binPath)
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
345
|
-
function runBin(binPath, args, options) {
|
|
346
|
-
return spawn(
|
|
347
|
-
/*@__PURE__*/ require('./constants/exec-path'),
|
|
348
|
-
[
|
|
349
|
-
.../*@__PURE__*/ require('./constants/node-no-warnings-flags'),
|
|
350
|
-
isPath(binPath) ? resolveBinPathSync(binPath) : whichBinSync(binPath),
|
|
351
|
-
...args
|
|
352
|
-
],
|
|
353
|
-
options
|
|
354
|
-
)
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
358
|
-
function runNpmScript(scriptName, args, options) {
|
|
359
|
-
const { prepost, ...spawnOptions } = { __proto__: null, ...options }
|
|
360
|
-
const useNodeRun =
|
|
361
|
-
!prepost && /*@__PURE__*/ require('./constants/supports-node-run')
|
|
362
|
-
return spawn(
|
|
363
|
-
/*@__PURE__*/ require('./constants/exec-path'),
|
|
364
|
-
[
|
|
365
|
-
.../*@__PURE__*/ require('./constants/node-no-warnings-flags'),
|
|
366
|
-
...(useNodeRun
|
|
367
|
-
? ['--run']
|
|
368
|
-
: [/*@__PURE__*/ require('./constants/npm-real-exec-path'), 'run']),
|
|
369
|
-
scriptName,
|
|
370
|
-
...args
|
|
371
|
-
],
|
|
372
|
-
{
|
|
373
|
-
__proto__: null,
|
|
374
|
-
...spawnOptions
|
|
375
|
-
}
|
|
376
|
-
)
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
async function whichBin(binName, options) {
|
|
380
|
-
const which = getWhich()
|
|
381
|
-
// Depending on options `which` may throw if `binName` is not found.
|
|
382
|
-
// The default behavior is to throw when `binName` is not found.
|
|
383
|
-
return resolveBinPathSync(await which(binName, options))
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
function whichBinSync(binName, options) {
|
|
387
|
-
// Depending on options `which` may throw if `binName` is not found.
|
|
388
|
-
// The default behavior is to throw when `binName` is not found.
|
|
389
|
-
return resolveBinPathSync(getWhich().sync(binName, options))
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
module.exports = {
|
|
393
|
-
execNpm,
|
|
394
|
-
isNpmAuditFlag,
|
|
395
|
-
isNpmFundFlag,
|
|
396
|
-
isNpmLoglevelFlag,
|
|
397
|
-
isNpmNodeOptionsFlag,
|
|
398
|
-
isNpmProgressFlag,
|
|
399
|
-
resolveBinPathSync,
|
|
400
|
-
runBin,
|
|
401
|
-
runNpmScript,
|
|
402
|
-
whichBin,
|
|
403
|
-
whichBinSync
|
|
404
|
-
}
|
|
File without changes
|