@socketsecurity/cli-with-sentry 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/dist/utils.js
CHANGED
|
@@ -22,7 +22,8 @@ var shadowNpmBin = require('./shadow-npm-bin.js');
|
|
|
22
22
|
var fs$1 = require('node:fs');
|
|
23
23
|
var require$$13 = require('../external/@socketsecurity/registry/lib/url');
|
|
24
24
|
var promises = require('node:timers/promises');
|
|
25
|
-
var
|
|
25
|
+
var agent = require('../external/@socketsecurity/registry/lib/agent');
|
|
26
|
+
var bin = require('../external/@socketsecurity/registry/lib/bin');
|
|
26
27
|
var packages = require('../external/@socketsecurity/registry/lib/packages');
|
|
27
28
|
var globs = require('../external/@socketsecurity/registry/lib/globs');
|
|
28
29
|
var streams = require('../external/@socketsecurity/registry/lib/streams');
|
|
@@ -2082,7 +2083,7 @@ async function gitLocalBranchExists(branch, cwd = process.cwd()) {
|
|
|
2082
2083
|
require$$9.debugFn('stdio', `spawn: ${quotedCmd}`);
|
|
2083
2084
|
try {
|
|
2084
2085
|
// Will throw with exit code 1 if the branch does not exist.
|
|
2085
|
-
await spawn.spawn('git', ['show-ref',
|
|
2086
|
+
await spawn.spawn('git', ['show-ref', constants.FLAG_QUIET, `refs/heads/${branch}`], stdioIgnoreOptions);
|
|
2086
2087
|
return true;
|
|
2087
2088
|
} catch (e) {
|
|
2088
2089
|
if (require$$9.isDebug('stdio')) {
|
|
@@ -2523,10 +2524,13 @@ function pathsToGlobPatterns(paths) {
|
|
|
2523
2524
|
}
|
|
2524
2525
|
|
|
2525
2526
|
function findBinPathDetailsSync(binName) {
|
|
2526
|
-
const
|
|
2527
|
+
const rawBinPaths = bin.whichBinSync(binName, {
|
|
2527
2528
|
all: true,
|
|
2528
2529
|
nothrow: true
|
|
2529
2530
|
}) ?? [];
|
|
2531
|
+
// whichBinSync may return a string when only one result is found, even with all: true.
|
|
2532
|
+
// This handles both the current published version and future versions.
|
|
2533
|
+
const binPaths = Array.isArray(rawBinPaths) ? rawBinPaths : typeof rawBinPaths === 'string' ? [rawBinPaths] : [];
|
|
2530
2534
|
const {
|
|
2531
2535
|
shadowBinPath
|
|
2532
2536
|
} = constants.default;
|
|
@@ -2540,7 +2544,7 @@ function findBinPathDetailsSync(binName) {
|
|
|
2540
2544
|
if (path.dirname(binPath) === shadowBinPath) {
|
|
2541
2545
|
shadowIndex = i;
|
|
2542
2546
|
} else {
|
|
2543
|
-
theBinPath =
|
|
2547
|
+
theBinPath = bin.resolveBinPathSync(binPath);
|
|
2544
2548
|
break;
|
|
2545
2549
|
}
|
|
2546
2550
|
}
|
|
@@ -2745,7 +2749,7 @@ function isNpxBinPathShadowed() {
|
|
|
2745
2749
|
return getNpxBinPathDetails().shadowed;
|
|
2746
2750
|
}
|
|
2747
2751
|
|
|
2748
|
-
const helpFlags = new Set([
|
|
2752
|
+
const helpFlags = new Set([constants.FLAG_HELP, '-h']);
|
|
2749
2753
|
|
|
2750
2754
|
/**
|
|
2751
2755
|
* Convert command arguments to a properly formatted string representation.
|
|
@@ -2759,7 +2763,7 @@ function cmdFlagsToString(args) {
|
|
|
2759
2763
|
if (arg.startsWith('--')) {
|
|
2760
2764
|
const nextArg = i + 1 < length ? args[i + 1].trim() : undefined;
|
|
2761
2765
|
// Check if the next item exists and is NOT another flag.
|
|
2762
|
-
if (nextArg
|
|
2766
|
+
if (nextArg && !nextArg.startsWith('--')) {
|
|
2763
2767
|
result.push(`${arg}=${nextArg}`);
|
|
2764
2768
|
i += 1;
|
|
2765
2769
|
} else {
|
|
@@ -2939,7 +2943,7 @@ async function spawnDlx(packageSpec, args, options, spawnExtra) {
|
|
|
2939
2943
|
spawnArgs.push('--ignore-scripts');
|
|
2940
2944
|
}
|
|
2941
2945
|
if (silent) {
|
|
2942
|
-
spawnArgs.push(
|
|
2946
|
+
spawnArgs.push(constants.FLAG_SILENT);
|
|
2943
2947
|
}
|
|
2944
2948
|
spawnArgs.push(packageString, ...args);
|
|
2945
2949
|
const shadowPnpmBin = /*@__PURE__*/require$2(constants.default.shadowPnpmBinPath);
|
|
@@ -2949,7 +2953,7 @@ async function spawnDlx(packageSpec, args, options, spawnExtra) {
|
|
|
2949
2953
|
spawnArgs = ['dlx'];
|
|
2950
2954
|
// Yarn dlx runs in a temporary environment by design and should always fetch fresh.
|
|
2951
2955
|
if (silent) {
|
|
2952
|
-
spawnArgs.push(
|
|
2956
|
+
spawnArgs.push(constants.FLAG_QUIET);
|
|
2953
2957
|
}
|
|
2954
2958
|
spawnArgs.push(packageString, ...args);
|
|
2955
2959
|
const shadowYarnBin = /*@__PURE__*/require$2(constants.default.shadowYarnBinPath);
|
|
@@ -2964,7 +2968,7 @@ async function spawnDlx(packageSpec, args, options, spawnExtra) {
|
|
|
2964
2968
|
spawnArgs.push('--force');
|
|
2965
2969
|
}
|
|
2966
2970
|
if (silent) {
|
|
2967
|
-
spawnArgs.push(
|
|
2971
|
+
spawnArgs.push(constants.FLAG_SILENT);
|
|
2968
2972
|
}
|
|
2969
2973
|
spawnArgs.push(packageString, ...args);
|
|
2970
2974
|
return await shadowNpmBin(binName, spawnArgs, finalShadowOptions, spawnExtra);
|
|
@@ -3609,10 +3613,10 @@ function shadowNpmInstall(options) {
|
|
|
3609
3613
|
const useDebug = require$$9.isDebug('stdio');
|
|
3610
3614
|
const terminatorPos = args.indexOf('--');
|
|
3611
3615
|
const rawBinArgs = terminatorPos === -1 ? args : args.slice(0, terminatorPos);
|
|
3612
|
-
const binArgs = rawBinArgs.filter(a => !
|
|
3616
|
+
const binArgs = rawBinArgs.filter(a => !agent.isNpmAuditFlag(a) && !agent.isNpmFundFlag(a) && !agent.isNpmProgressFlag(a));
|
|
3613
3617
|
const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos);
|
|
3614
|
-
const progressArg = rawBinArgs.findLast(
|
|
3615
|
-
const isSilent = !useDebug && !binArgs.some(
|
|
3618
|
+
const progressArg = rawBinArgs.findLast(agent.isNpmProgressFlag) !== '--no-progress';
|
|
3619
|
+
const isSilent = !useDebug && !binArgs.some(agent.isNpmLoglevelFlag);
|
|
3616
3620
|
const logLevelArgs = isSilent ? ['--loglevel', 'silent'] : [];
|
|
3617
3621
|
const useIpc = require$$11.isObject(ipc);
|
|
3618
3622
|
|
|
@@ -3629,7 +3633,7 @@ function shadowNpmInstall(options) {
|
|
|
3629
3633
|
} else {
|
|
3630
3634
|
stdio = useIpc ? ['pipe', 'pipe', 'pipe', 'ipc'] : 'pipe';
|
|
3631
3635
|
}
|
|
3632
|
-
const spawnPromise = spawn.spawn(constants.default.execPath, [...constants.default.nodeNoWarningsFlags, ...constants.default.nodeDebugFlags, ...constants.default.nodeHardenFlags, ...constants.default.nodeMemoryFlags, ...(constants.default.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD ? ['--require', constants.default.instrumentWithSentryPath] : []), '--require', constants.default.shadowNpmInjectPath,
|
|
3636
|
+
const spawnPromise = spawn.spawn(constants.default.execPath, [...constants.default.nodeNoWarningsFlags, ...constants.default.nodeDebugFlags, ...constants.default.nodeHardenFlags, ...constants.default.nodeMemoryFlags, ...(constants.default.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD ? ['--require', constants.default.instrumentWithSentryPath] : []), '--require', constants.default.shadowNpmInjectPath, agent.resolveBinPathSync(agentExecPath), 'install',
|
|
3633
3637
|
// Avoid code paths for 'audit' and 'fund'.
|
|
3634
3638
|
'--no-audit', '--no-fund',
|
|
3635
3639
|
// Add '--no-progress' to fix input being swallowed by the npm spinner.
|
|
@@ -3661,7 +3665,8 @@ function shadowNpmInstall(options) {
|
|
|
3661
3665
|
function runAgentInstall(pkgEnvDetails, options) {
|
|
3662
3666
|
const {
|
|
3663
3667
|
agent,
|
|
3664
|
-
agentExecPath
|
|
3668
|
+
agentExecPath,
|
|
3669
|
+
pkgPath
|
|
3665
3670
|
} = pkgEnvDetails;
|
|
3666
3671
|
const isNpm = agent === constants.NPM;
|
|
3667
3672
|
const isPnpm = agent === constants.PNPM;
|
|
@@ -3669,6 +3674,7 @@ function runAgentInstall(pkgEnvDetails, options) {
|
|
|
3669
3674
|
if (isNpm) {
|
|
3670
3675
|
return shadowNpmInstall({
|
|
3671
3676
|
agentExecPath,
|
|
3677
|
+
cwd: pkgPath,
|
|
3672
3678
|
...options
|
|
3673
3679
|
});
|
|
3674
3680
|
}
|
|
@@ -3681,7 +3687,12 @@ function runAgentInstall(pkgEnvDetails, options) {
|
|
|
3681
3687
|
...options
|
|
3682
3688
|
};
|
|
3683
3689
|
const skipNodeHardenFlags = isPnpm && pkgEnvDetails.agentVersion.major < 11;
|
|
3684
|
-
|
|
3690
|
+
// In CI mode, pnpm uses --frozen-lockfile by default, which prevents lockfile updates.
|
|
3691
|
+
// We need to explicitly disable it when updating the lockfile with overrides.
|
|
3692
|
+
const isCi = constants.default.ENV['CI'];
|
|
3693
|
+
const installArgs = isPnpm && isCi ? ['install', '--no-frozen-lockfile', ...args] : ['install', ...args];
|
|
3694
|
+
return spawn.spawn(agentExecPath, installArgs, {
|
|
3695
|
+
cwd: pkgPath,
|
|
3685
3696
|
shell: constants.default.WIN32,
|
|
3686
3697
|
spinner,
|
|
3687
3698
|
stdio: 'inherit',
|
|
@@ -3697,15 +3708,19 @@ function runAgentInstall(pkgEnvDetails, options) {
|
|
|
3697
3708
|
|
|
3698
3709
|
const {
|
|
3699
3710
|
BUN,
|
|
3711
|
+
BUN_LOCK,
|
|
3712
|
+
BUN_LOCKB,
|
|
3713
|
+
DOT_PACKAGE_LOCK_JSON,
|
|
3700
3714
|
EXT_LOCK,
|
|
3701
3715
|
EXT_LOCKB,
|
|
3702
|
-
HIDDEN_PACKAGE_LOCK_JSON,
|
|
3703
3716
|
NODE_MODULES,
|
|
3704
3717
|
NPM,
|
|
3705
3718
|
NPM_BUGGY_OVERRIDES_PATCHED_VERSION,
|
|
3719
|
+
NPM_SHRINKWRAP_JSON,
|
|
3706
3720
|
PACKAGE_JSON,
|
|
3707
3721
|
PNPM,
|
|
3708
3722
|
VLT,
|
|
3723
|
+
VLT_LOCK_JSON,
|
|
3709
3724
|
YARN,
|
|
3710
3725
|
YARN_BERRY,
|
|
3711
3726
|
YARN_CLASSIC
|
|
@@ -3749,36 +3764,62 @@ const readLockFileByAgent = (() => {
|
|
|
3749
3764
|
|
|
3750
3765
|
// The order of LOCKS properties IS significant as it affects iteration order.
|
|
3751
3766
|
const LOCKS = {
|
|
3752
|
-
[
|
|
3753
|
-
[
|
|
3767
|
+
[BUN_LOCK]: BUN,
|
|
3768
|
+
[BUN_LOCKB]: BUN,
|
|
3754
3769
|
// If both package-lock.json and npm-shrinkwrap.json are present in the root
|
|
3755
3770
|
// of a project, npm-shrinkwrap.json will take precedence and package-lock.json
|
|
3756
3771
|
// will be ignored.
|
|
3757
3772
|
// https://docs.npmjs.com/cli/v10/configuring-npm/package-lock-json#package-lockjson-vs-npm-shrinkwrapjson
|
|
3758
|
-
|
|
3773
|
+
[NPM_SHRINKWRAP_JSON]: NPM,
|
|
3759
3774
|
[constants.PACKAGE_LOCK_JSON]: NPM,
|
|
3760
3775
|
[constants.PNPM_LOCK_YAML]: PNPM,
|
|
3761
3776
|
[constants.YARN_LOCK]: YARN_CLASSIC,
|
|
3762
|
-
|
|
3777
|
+
[VLT_LOCK_JSON]: VLT,
|
|
3763
3778
|
// Lastly, look for a hidden lock file which is present if .npmrc has package-lock=false:
|
|
3764
3779
|
// https://docs.npmjs.com/cli/v10/configuring-npm/package-lock-json#hidden-lockfiles
|
|
3765
3780
|
//
|
|
3766
3781
|
// Unlike the other LOCKS keys this key contains a directory AND filename so
|
|
3767
3782
|
// it has to be handled differently.
|
|
3768
|
-
[`${NODE_MODULES}
|
|
3783
|
+
[`${NODE_MODULES}/${DOT_PACKAGE_LOCK_JSON}`]: NPM
|
|
3769
3784
|
};
|
|
3770
3785
|
async function getAgentExecPath(agent) {
|
|
3771
3786
|
const binName = binByAgent.get(agent);
|
|
3772
3787
|
if (binName === NPM) {
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3788
|
+
// Try to use constants.npmExecPath first, but verify it exists.
|
|
3789
|
+
const npmPath = constants.default.npmExecPath;
|
|
3790
|
+
if (fs$1.existsSync(npmPath)) {
|
|
3791
|
+
return npmPath;
|
|
3792
|
+
}
|
|
3793
|
+
// If npmExecPath doesn't exist, try common locations.
|
|
3794
|
+
// Check npm in the same directory as node.
|
|
3795
|
+
const nodeDir = path.dirname(process.execPath);
|
|
3796
|
+
const npmInNodeDir = path.join(nodeDir, NPM);
|
|
3797
|
+
if (fs$1.existsSync(npmInNodeDir)) {
|
|
3798
|
+
return npmInNodeDir;
|
|
3799
|
+
}
|
|
3800
|
+
// Fall back to whichBin.
|
|
3801
|
+
return (await bin.whichBin(binName, {
|
|
3802
|
+
nothrow: true
|
|
3803
|
+
})) ?? binName;
|
|
3804
|
+
}
|
|
3805
|
+
if (binName === PNPM) {
|
|
3806
|
+
// Try to use constants.pnpmExecPath first, but verify it exists.
|
|
3807
|
+
const pnpmPath = constants.default.pnpmExecPath;
|
|
3808
|
+
if (fs$1.existsSync(pnpmPath)) {
|
|
3809
|
+
return pnpmPath;
|
|
3810
|
+
}
|
|
3811
|
+
// Fall back to whichBin.
|
|
3812
|
+
return (await bin.whichBin(binName, {
|
|
3813
|
+
nothrow: true
|
|
3814
|
+
})) ?? binName;
|
|
3815
|
+
}
|
|
3816
|
+
return (await bin.whichBin(binName, {
|
|
3776
3817
|
nothrow: true
|
|
3777
3818
|
})) ?? binName;
|
|
3778
3819
|
}
|
|
3779
3820
|
async function getAgentVersion(agent, agentExecPath, cwd) {
|
|
3780
3821
|
let result;
|
|
3781
|
-
const quotedCmd = `\`${agent}
|
|
3822
|
+
const quotedCmd = `\`${agent} ${constants.FLAG_VERSION}\``;
|
|
3782
3823
|
require$$9.debugFn('stdio', `spawn: ${quotedCmd}`);
|
|
3783
3824
|
try {
|
|
3784
3825
|
result =
|
|
@@ -3787,7 +3828,7 @@ async function getAgentVersion(agent, agentExecPath, cwd) {
|
|
|
3787
3828
|
// and tildes (~).
|
|
3788
3829
|
vendor.semverExports.coerce(
|
|
3789
3830
|
// All package managers support the "--version" flag.
|
|
3790
|
-
(await spawn.spawn(agentExecPath, [
|
|
3831
|
+
(await spawn.spawn(agentExecPath, [constants.FLAG_VERSION], {
|
|
3791
3832
|
cwd,
|
|
3792
3833
|
shell: constants.default.WIN32
|
|
3793
3834
|
})).stdout) ?? undefined;
|
|
@@ -3807,7 +3848,7 @@ async function detectPackageEnvironment({
|
|
|
3807
3848
|
cwd
|
|
3808
3849
|
});
|
|
3809
3850
|
let lockName = lockPath ? path.basename(lockPath) : undefined;
|
|
3810
|
-
const isHiddenLockFile = lockName ===
|
|
3851
|
+
const isHiddenLockFile = lockName === DOT_PACKAGE_LOCK_JSON;
|
|
3811
3852
|
const pkgJsonPath = lockPath ? path.resolve(lockPath, `${isHiddenLockFile ? '../' : ''}../${PACKAGE_JSON}`) : await findUp(PACKAGE_JSON, {
|
|
3812
3853
|
cwd
|
|
3813
3854
|
});
|
|
@@ -3946,7 +3987,7 @@ async function detectAndValidatePackageEnvironment(cwd, options) {
|
|
|
3946
3987
|
const details = await detectPackageEnvironment({
|
|
3947
3988
|
cwd,
|
|
3948
3989
|
onUnknown(pkgManager) {
|
|
3949
|
-
logger?.warn(cmdPrefixMessage(cmdName, `Unknown package manager${pkgManager ? ` ${pkgManager}` : ''}, defaulting to
|
|
3990
|
+
logger?.warn(cmdPrefixMessage(cmdName, `Unknown package manager${pkgManager ? ` ${pkgManager}` : ''}, defaulting to ${NPM}`));
|
|
3950
3991
|
}
|
|
3951
3992
|
});
|
|
3952
3993
|
const {
|
|
@@ -4754,5 +4795,5 @@ exports.toFilterConfig = toFilterConfig;
|
|
|
4754
4795
|
exports.updateConfigValue = updateConfigValue;
|
|
4755
4796
|
exports.walkNestedMap = walkNestedMap;
|
|
4756
4797
|
exports.writeSocketJson = writeSocketJson;
|
|
4757
|
-
//# debugId=
|
|
4798
|
+
//# debugId=4f982f8d-ea52-46a2-a41c-84d9eac292ab
|
|
4758
4799
|
//# sourceMappingURL=utils.js.map
|