socket 1.1.14 → 1.1.17
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 +19 -0
- package/dist/cli.js +114 -32
- 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/cmd-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/env-helpers.d.mts +13 -0
- package/dist/types/commands/fix/env-helpers.d.mts.map +1 -1
- package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +1 -1
- package/dist/types/commands/manifest/run-cdxgen.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/package/fetch-purls-shallow-score.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/threat-feed/cmd-threat-feed.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/api.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 +70 -29
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +514 -517
- 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 +5 -4
- 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
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## [1.1.17](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.17) - 2025-09-18
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Enhanced Windows compatibility for package manager detection and execution
|
|
11
|
+
|
|
12
|
+
## [1.1.16](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.16) - 2025-09-16
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Enhanced pnpm wrapper compatibility with dlx commands for better package execution support
|
|
16
|
+
|
|
17
|
+
## [1.1.15](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.15) - 2025-09-16
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- Improved `socket fix` environment variable detection with clearer error messages when required variables are missing
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- Resolved path handling issue in `socket optimize` command
|
|
24
|
+
- Command flag parsing now correctly detects subsequent arguments
|
|
25
|
+
|
|
7
26
|
## [1.1.14](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.14) - 2025-09-17
|
|
8
27
|
|
|
9
28
|
### Changed
|
package/dist/cli.js
CHANGED
|
@@ -25,7 +25,6 @@ var packages = require('../external/@socketsecurity/registry/lib/packages');
|
|
|
25
25
|
var require$$12 = require('../external/@socketsecurity/registry/lib/promises');
|
|
26
26
|
var regexps = require('../external/@socketsecurity/registry/lib/regexps');
|
|
27
27
|
var require$$0$1 = require('node:crypto');
|
|
28
|
-
var registryConstants = require('../external/@socketsecurity/registry/lib/constants');
|
|
29
28
|
var require$$1 = require('node:util');
|
|
30
29
|
var os = require('node:os');
|
|
31
30
|
var promises = require('node:stream/promises');
|
|
@@ -230,10 +229,10 @@ function formatDataOrg(data) {
|
|
|
230
229
|
const topFiveAlertTypes = entry['top_five_alert_types'];
|
|
231
230
|
for (const type of Object.keys(topFiveAlertTypes)) {
|
|
232
231
|
const count = topFiveAlertTypes[type] ?? 0;
|
|
233
|
-
if (
|
|
234
|
-
totalTopAlerts[type] = count;
|
|
235
|
-
} else {
|
|
232
|
+
if (totalTopAlerts[type]) {
|
|
236
233
|
totalTopAlerts[type] += count;
|
|
234
|
+
} else {
|
|
235
|
+
totalTopAlerts[type] = count;
|
|
237
236
|
}
|
|
238
237
|
}
|
|
239
238
|
}
|
|
@@ -241,10 +240,10 @@ function formatDataOrg(data) {
|
|
|
241
240
|
const formatted = formattedData[metric];
|
|
242
241
|
for (const entry of data) {
|
|
243
242
|
const date = formatDate(entry['created_at']);
|
|
244
|
-
if (
|
|
245
|
-
formatted[date] = entry[metric];
|
|
246
|
-
} else {
|
|
243
|
+
if (formatted[date]) {
|
|
247
244
|
formatted[date] += entry[metric];
|
|
245
|
+
} else {
|
|
246
|
+
formatted[date] = entry[metric];
|
|
248
247
|
}
|
|
249
248
|
}
|
|
250
249
|
}
|
|
@@ -3394,21 +3393,72 @@ function ciRepoInfo() {
|
|
|
3394
3393
|
repo: ownerSlashRepo.slice(slashIndex + 1)
|
|
3395
3394
|
};
|
|
3396
3395
|
}
|
|
3396
|
+
/**
|
|
3397
|
+
* Get formatted instructions for setting CI environment variables.
|
|
3398
|
+
*/
|
|
3399
|
+
function getCiEnvInstructions() {
|
|
3400
|
+
return 'To enable automatic pull request creation, run in CI with these environment variables:\n' + ' - CI=1\n' + ' - SOCKET_CLI_GITHUB_TOKEN=<your-github-token>\n' + ' - SOCKET_CLI_GIT_USER_NAME=<git-username>\n' + ' - SOCKET_CLI_GIT_USER_EMAIL=<git-email>';
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3403
|
+
/**
|
|
3404
|
+
* Check which required CI environment variables are missing.
|
|
3405
|
+
* Returns lists of missing and present variables.
|
|
3406
|
+
*/
|
|
3407
|
+
function checkCiEnvVars() {
|
|
3408
|
+
const {
|
|
3409
|
+
CI,
|
|
3410
|
+
SOCKET_CLI_GIT_USER_EMAIL,
|
|
3411
|
+
SOCKET_CLI_GIT_USER_NAME,
|
|
3412
|
+
SOCKET_CLI_GITHUB_TOKEN
|
|
3413
|
+
} = constants.default.ENV;
|
|
3414
|
+
const missing = [];
|
|
3415
|
+
const present = [];
|
|
3416
|
+
if (CI) {
|
|
3417
|
+
present.push('CI');
|
|
3418
|
+
} else {
|
|
3419
|
+
missing.push('CI');
|
|
3420
|
+
}
|
|
3421
|
+
if (SOCKET_CLI_GIT_USER_EMAIL) {
|
|
3422
|
+
present.push('SOCKET_CLI_GIT_USER_EMAIL');
|
|
3423
|
+
} else {
|
|
3424
|
+
missing.push('SOCKET_CLI_GIT_USER_EMAIL');
|
|
3425
|
+
}
|
|
3426
|
+
if (SOCKET_CLI_GIT_USER_NAME) {
|
|
3427
|
+
present.push('SOCKET_CLI_GIT_USER_NAME');
|
|
3428
|
+
} else {
|
|
3429
|
+
missing.push('SOCKET_CLI_GIT_USER_NAME');
|
|
3430
|
+
}
|
|
3431
|
+
if (SOCKET_CLI_GITHUB_TOKEN) {
|
|
3432
|
+
present.push('SOCKET_CLI_GITHUB_TOKEN');
|
|
3433
|
+
} else {
|
|
3434
|
+
missing.push('SOCKET_CLI_GITHUB_TOKEN (or GITHUB_TOKEN)');
|
|
3435
|
+
}
|
|
3436
|
+
return {
|
|
3437
|
+
missing,
|
|
3438
|
+
present
|
|
3439
|
+
};
|
|
3440
|
+
}
|
|
3397
3441
|
async function getFixEnv() {
|
|
3398
3442
|
const baseBranch = await utils.getBaseBranch();
|
|
3399
3443
|
const gitEmail = constants.default.ENV.SOCKET_CLI_GIT_USER_EMAIL;
|
|
3400
3444
|
const gitUser = constants.default.ENV.SOCKET_CLI_GIT_USER_NAME;
|
|
3401
3445
|
const githubToken = constants.default.ENV.SOCKET_CLI_GITHUB_TOKEN;
|
|
3402
3446
|
const isCi = !!(constants.default.ENV.CI && gitEmail && gitUser && githubToken);
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3447
|
+
const envCheck = checkCiEnvVars();
|
|
3448
|
+
|
|
3449
|
+
// Provide clear feedback about missing environment variables.
|
|
3450
|
+
if (constants.default.ENV.CI && envCheck.missing.length > 1) {
|
|
3451
|
+
// CI is set but other required vars are missing.
|
|
3452
|
+
const missingExceptCi = envCheck.missing.filter(v => v !== 'CI');
|
|
3453
|
+
if (missingExceptCi.length) {
|
|
3454
|
+
logger.logger.warn(`CI mode detected, but pull request creation is disabled due to missing environment variables:\n` + ` Missing: ${arrays.joinAnd(missingExceptCi)}\n` + ` Set these variables to enable automatic pull request creation.`);
|
|
3455
|
+
}
|
|
3456
|
+
} else if (
|
|
3457
|
+
// If not in CI but some CI-related env vars are set.
|
|
3458
|
+
!constants.default.ENV.CI && envCheck.present.length &&
|
|
3408
3459
|
// then log about it when in debug mode.
|
|
3409
3460
|
require$$9.isDebug('notice')) {
|
|
3410
|
-
|
|
3411
|
-
require$$9.debugFn('notice', `miss: fixEnv.isCi is false, expected ${arrays.joinAnd(envVars)} to be set`);
|
|
3461
|
+
require$$9.debugFn('notice', `miss: fixEnv.isCi is false, expected ${arrays.joinAnd(envCheck.missing)} to be set`);
|
|
3412
3462
|
}
|
|
3413
3463
|
let repoInfo;
|
|
3414
3464
|
if (isCi) {
|
|
@@ -3486,6 +3536,19 @@ async function coanaFix(fixConfig) {
|
|
|
3486
3536
|
const isAll = !ghsas.length || ghsas.length === 1 && (ghsas[0] === 'all' || ghsas[0] === 'auto');
|
|
3487
3537
|
const shouldOpenPrs = fixEnv.isCi && fixEnv.repoInfo;
|
|
3488
3538
|
if (!shouldOpenPrs) {
|
|
3539
|
+
// Inform user about local mode when fixes will be applied.
|
|
3540
|
+
if (!onlyCompute && ghsas.length) {
|
|
3541
|
+
const envCheck = checkCiEnvVars();
|
|
3542
|
+
if (envCheck.present.length) {
|
|
3543
|
+
// Some CI vars are set but not all - show what's missing.
|
|
3544
|
+
if (envCheck.missing.length) {
|
|
3545
|
+
logger.logger.info('Running in local mode - fixes will be applied directly to your working directory.\n' + `Missing environment variables for PR creation: ${arrays.joinAnd(envCheck.missing)}`);
|
|
3546
|
+
}
|
|
3547
|
+
} else {
|
|
3548
|
+
// No CI vars are present - show general local mode message.
|
|
3549
|
+
logger.logger.info('Running in local mode - fixes will be applied directly to your working directory.\n' + getCiEnvInstructions());
|
|
3550
|
+
}
|
|
3551
|
+
}
|
|
3489
3552
|
const ids = isAll ? ['all'] : ghsas.slice(0, limit);
|
|
3490
3553
|
if (!ids.length) {
|
|
3491
3554
|
spinner?.stop();
|
|
@@ -3496,7 +3559,7 @@ async function coanaFix(fixConfig) {
|
|
|
3496
3559
|
}
|
|
3497
3560
|
};
|
|
3498
3561
|
}
|
|
3499
|
-
const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...(isAll ? ['all'] : ghsas), ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(glob ? ['--glob', glob] : []), ...(onlyCompute ? [
|
|
3562
|
+
const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...(isAll ? ['all'] : ghsas), ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(glob ? ['--glob', glob] : []), ...(onlyCompute ? [constants.FLAG_DRY_RUN] : []), ...(outputFile ? ['--output-file', outputFile] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3500
3563
|
cwd,
|
|
3501
3564
|
spinner,
|
|
3502
3565
|
stdio: 'inherit'
|
|
@@ -3630,6 +3693,16 @@ async function coanaFix(fixConfig) {
|
|
|
3630
3693
|
}
|
|
3631
3694
|
|
|
3632
3695
|
// Set up git remote.
|
|
3696
|
+
if (!fixEnv.githubToken) {
|
|
3697
|
+
logger.logger.error('Cannot create pull request: SOCKET_CLI_GITHUB_TOKEN environment variable is not set.\n' + 'Set SOCKET_CLI_GITHUB_TOKEN or GITHUB_TOKEN to enable PR creation.');
|
|
3698
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3699
|
+
await utils.gitResetAndClean(fixEnv.baseBranch, cwd);
|
|
3700
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3701
|
+
await utils.gitCheckoutBranch(fixEnv.baseBranch, cwd);
|
|
3702
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3703
|
+
await utils.gitDeleteBranch(branch, cwd);
|
|
3704
|
+
continue ghsaLoop;
|
|
3705
|
+
}
|
|
3633
3706
|
// eslint-disable-next-line no-await-in-loop
|
|
3634
3707
|
await utils.setGitRemoteGithubRepoUrl(fixEnv.repoInfo.owner, fixEnv.repoInfo.repo, fixEnv.githubToken, cwd);
|
|
3635
3708
|
|
|
@@ -3751,7 +3824,7 @@ async function convertIdsToGhsas(ids) {
|
|
|
3751
3824
|
const conversionResult = await utils.convertPurlToGhsas(trimmedId);
|
|
3752
3825
|
if (conversionResult.ok && conversionResult.data.length) {
|
|
3753
3826
|
validGhsas.push(...conversionResult.data);
|
|
3754
|
-
logger.logger.info(`Converted ${trimmedId} to ${conversionResult.data.length} GHSA(s): ${conversionResult.data
|
|
3827
|
+
logger.logger.info(`Converted ${trimmedId} to ${conversionResult.data.length} GHSA(s): ${arrays.joinAnd(conversionResult.data)}`);
|
|
3755
3828
|
} else {
|
|
3756
3829
|
errors.push(`${trimmedId}: ${conversionResult.message || 'No GHSAs found'}`);
|
|
3757
3830
|
}
|
|
@@ -3925,8 +3998,15 @@ async function run$K(argv, importMeta, {
|
|
|
3925
3998
|
Options
|
|
3926
3999
|
${utils.getFlagListOutput(config.flags)}
|
|
3927
4000
|
|
|
4001
|
+
Environment Variables (for CI/PR mode)
|
|
4002
|
+
CI Set to enable CI mode
|
|
4003
|
+
SOCKET_CLI_GITHUB_TOKEN GitHub token for PR creation (or GITHUB_TOKEN)
|
|
4004
|
+
SOCKET_CLI_GIT_USER_NAME Git username for commits
|
|
4005
|
+
SOCKET_CLI_GIT_USER_EMAIL Git email for commits
|
|
4006
|
+
|
|
3928
4007
|
Examples
|
|
3929
4008
|
$ ${command}
|
|
4009
|
+
$ ${command} --id CVE-2021-23337
|
|
3930
4010
|
$ ${command} ./path/to/project --range-style pin
|
|
3931
4011
|
`
|
|
3932
4012
|
};
|
|
@@ -4530,7 +4610,7 @@ const {
|
|
|
4530
4610
|
const nodejsPlatformTypes = new Set(['javascript', 'js', 'nodejs', constants.NPM, constants.PNPM, 'ts', 'tsx', 'typescript']);
|
|
4531
4611
|
function argvToArray(argvObj) {
|
|
4532
4612
|
if (argvObj['help']) {
|
|
4533
|
-
return [
|
|
4613
|
+
return [constants.FLAG_HELP];
|
|
4534
4614
|
}
|
|
4535
4615
|
const result = [];
|
|
4536
4616
|
for (const {
|
|
@@ -4614,6 +4694,8 @@ async function runCdxgen(argvObj) {
|
|
|
4614
4694
|
shadowResult.spawnPromise.process.on('exit', () => {
|
|
4615
4695
|
if (cleanupPackageLock) {
|
|
4616
4696
|
try {
|
|
4697
|
+
// TODO: Consider using trash instead of rmSync for safer deletion.
|
|
4698
|
+
// This removes the temporary package-lock.json we created for cdxgen.
|
|
4617
4699
|
fs$1.rmSync(`./${PACKAGE_LOCK_JSON}`);
|
|
4618
4700
|
} catch {}
|
|
4619
4701
|
}
|
|
@@ -4857,7 +4939,7 @@ async function run$F(argv, importMeta, context) {
|
|
|
4857
4939
|
const argsToProcess = utils.filterFlags(argv, {
|
|
4858
4940
|
...flags.commonFlags,
|
|
4859
4941
|
...flags.outputFlags
|
|
4860
|
-
}, ['--no-banner',
|
|
4942
|
+
}, ['--no-banner', constants.FLAG_HELP, '-h']);
|
|
4861
4943
|
const yargv = {
|
|
4862
4944
|
...vendor.yargsParser(argsToProcess, yargsConfig)
|
|
4863
4945
|
};
|
|
@@ -4879,7 +4961,7 @@ async function run$F(argv, importMeta, context) {
|
|
|
4879
4961
|
// options or missing arguments.
|
|
4880
4962
|
// https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html
|
|
4881
4963
|
process.exitCode = 2;
|
|
4882
|
-
logger.logger.fail(`Unknown ${words.pluralize('argument', unknownsCount)}: ${
|
|
4964
|
+
logger.logger.fail(`Unknown ${words.pluralize('argument', unknownsCount)}: ${arrays.joinAnd(unknowns)}`);
|
|
4883
4965
|
return;
|
|
4884
4966
|
}
|
|
4885
4967
|
if (dryRun) {
|
|
@@ -6676,7 +6758,7 @@ async function lsPnpm(pkgEnvDetails, options) {
|
|
|
6676
6758
|
stdout = (await spawn.spawn(pkgEnvDetails.agentExecPath,
|
|
6677
6759
|
// Pnpm uses the alternative spelling of parsable.
|
|
6678
6760
|
// https://en.wiktionary.org/wiki/parsable
|
|
6679
|
-
['ls', '--parseable',
|
|
6761
|
+
['ls', '--parseable', constants.FLAG_PROD, '--depth', 'Infinity'], {
|
|
6680
6762
|
cwd,
|
|
6681
6763
|
shell: constants.default.WIN32
|
|
6682
6764
|
})).stdout;
|
|
@@ -6729,7 +6811,7 @@ async function lsYarnClassic(pkgEnvDetails, options) {
|
|
|
6729
6811
|
// https://github.com/yarnpkg/yarn/releases/tag/v1.0.0
|
|
6730
6812
|
// > Fix: Excludes dev dependencies from the yarn list output when the
|
|
6731
6813
|
// environment is production
|
|
6732
|
-
return (await spawn.spawn(pkgEnvDetails.agentExecPath, ['list',
|
|
6814
|
+
return (await spawn.spawn(pkgEnvDetails.agentExecPath, ['list', constants.FLAG_PROD], {
|
|
6733
6815
|
cwd,
|
|
6734
6816
|
shell: constants.default.WIN32
|
|
6735
6817
|
})).stdout;
|
|
@@ -8405,7 +8487,7 @@ async function fetchPurlsShallowScore(purls, options) {
|
|
|
8405
8487
|
return sockSdkCResult;
|
|
8406
8488
|
}
|
|
8407
8489
|
const sockSdk = sockSdkCResult.data;
|
|
8408
|
-
logger.logger.info(`Requesting shallow score data for ${purls.length} package urls (purl): ${
|
|
8490
|
+
logger.logger.info(`Requesting shallow score data for ${purls.length} package urls (purl): ${arrays.joinAnd(purls)}`);
|
|
8409
8491
|
const batchPackageCResult = await utils.handleApiCall(sockSdk.batchPackageFetch({
|
|
8410
8492
|
components: purls.map(purl => ({
|
|
8411
8493
|
purl
|
|
@@ -8969,7 +9051,7 @@ async function computeSHA256(filepath) {
|
|
|
8969
9051
|
return {
|
|
8970
9052
|
ok: false,
|
|
8971
9053
|
message: 'Failed to compute file hash',
|
|
8972
|
-
cause: `Unable to read file ${filepath}: ${e instanceof Error ? e.message :
|
|
9054
|
+
cause: `Unable to read file ${filepath}: ${e instanceof Error ? e.message : constants.UNKNOWN_ERROR}`
|
|
8973
9055
|
};
|
|
8974
9056
|
}
|
|
8975
9057
|
}
|
|
@@ -9089,9 +9171,9 @@ async function handlePatch({
|
|
|
9089
9171
|
spinner
|
|
9090
9172
|
}) {
|
|
9091
9173
|
try {
|
|
9092
|
-
const dotSocketDirPath = path.join(cwd, constants.
|
|
9093
|
-
const manifestPath = path.join(dotSocketDirPath,
|
|
9094
|
-
const manifestContent = await fs$1.promises.readFile(manifestPath,
|
|
9174
|
+
const dotSocketDirPath = path.join(cwd, constants.DOT_SOCKET_DIR);
|
|
9175
|
+
const manifestPath = path.join(dotSocketDirPath, constants.MANIFEST_JSON);
|
|
9176
|
+
const manifestContent = await fs$1.promises.readFile(manifestPath, constants.UTF8);
|
|
9095
9177
|
const manifestData = JSON.parse(manifestContent);
|
|
9096
9178
|
const purls = purlObjs.map(String);
|
|
9097
9179
|
const validated = PatchManifestSchema.parse(manifestData);
|
|
@@ -9152,7 +9234,7 @@ async function handlePatch({
|
|
|
9152
9234
|
let message = 'Failed to apply patches';
|
|
9153
9235
|
let cause = e?.message || constants.UNKNOWN_ERROR;
|
|
9154
9236
|
if (e instanceof SyntaxError) {
|
|
9155
|
-
message = `Invalid JSON in ${
|
|
9237
|
+
message = `Invalid JSON in ${constants.MANIFEST_JSON}`;
|
|
9156
9238
|
cause = e.message;
|
|
9157
9239
|
} else if (e instanceof Error && 'issues' in e) {
|
|
9158
9240
|
message = 'Schema validation failed';
|
|
@@ -9235,13 +9317,13 @@ async function run$m(argv, importMeta, {
|
|
|
9235
9317
|
// Note: path.resolve vs .join:
|
|
9236
9318
|
// If given path is absolute then cwd should not affect it.
|
|
9237
9319
|
cwd = path.resolve(process.cwd(), cwd);
|
|
9238
|
-
const dotSocketDirPath = path.join(cwd, constants.
|
|
9320
|
+
const dotSocketDirPath = path.join(cwd, constants.DOT_SOCKET_DIR);
|
|
9239
9321
|
if (!fs$1.existsSync(dotSocketDirPath)) {
|
|
9240
|
-
throw new utils.InputError(`No ${constants.
|
|
9322
|
+
throw new utils.InputError(`No ${constants.DOT_SOCKET_DIR} directory found in current directory`);
|
|
9241
9323
|
}
|
|
9242
9324
|
const manifestPath = path.join(dotSocketDirPath, constants.MANIFEST_JSON);
|
|
9243
9325
|
if (!fs$1.existsSync(manifestPath)) {
|
|
9244
|
-
throw new utils.InputError(`No ${constants.MANIFEST_JSON} found in ${constants.
|
|
9326
|
+
throw new utils.InputError(`No ${constants.MANIFEST_JSON} found in ${constants.DOT_SOCKET_DIR} directory`);
|
|
9245
9327
|
}
|
|
9246
9328
|
const {
|
|
9247
9329
|
spinner
|
|
@@ -13963,7 +14045,7 @@ async function run$3(argv, importMeta, {
|
|
|
13963
14045
|
}
|
|
13964
14046
|
});
|
|
13965
14047
|
if (argSet.size) {
|
|
13966
|
-
logger.logger.info(`Warning: ignoring these excessive args: ${Array.from(argSet)
|
|
14048
|
+
logger.logger.info(`Warning: ignoring these excessive args: ${arrays.joinAnd(Array.from(argSet))}`);
|
|
13967
14049
|
}
|
|
13968
14050
|
const hasApiToken = utils.hasDefaultApiToken();
|
|
13969
14051
|
const {
|
|
@@ -14652,5 +14734,5 @@ void (async () => {
|
|
|
14652
14734
|
await utils.captureException(e);
|
|
14653
14735
|
}
|
|
14654
14736
|
})();
|
|
14655
|
-
//# debugId=
|
|
14737
|
+
//# debugId=b2633ba4-7e32-440b-9581-735f53ff9fc8
|
|
14656
14738
|
//# sourceMappingURL=cli.js.map
|