@pnpm/deps.inspection.commands 1100.1.8 → 1100.1.9
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/lib/listing/list.js +46 -4
- package/lib/peers.js +2 -50
- package/package.json +20 -19
package/lib/listing/list.js
CHANGED
|
@@ -2,7 +2,8 @@ import { FILTERING, OPTIONS, UNIVERSAL_OPTIONS } from '@pnpm/cli.common-cli-opti
|
|
|
2
2
|
import { docsUrl } from '@pnpm/cli.utils';
|
|
3
3
|
import { types as allTypes } from '@pnpm/config.reader';
|
|
4
4
|
import { list, listForPackages } from '@pnpm/deps.inspection.list';
|
|
5
|
-
import {
|
|
5
|
+
import { PnpmError } from '@pnpm/error';
|
|
6
|
+
import { findGlobalInstallDirs, listGlobalPackages } from '@pnpm/global.commands';
|
|
6
7
|
import { pick } from 'ramda';
|
|
7
8
|
import { renderHelp } from 'render-help';
|
|
8
9
|
import { BASE_RC_OPTION_KEYS, computeInclude, determineReportAs, resolveFinders, SHARED_CLI_HELP_OPTIONS } from './common.js';
|
|
@@ -73,11 +74,52 @@ For example: pnpm ls babel-* eslint-*',
|
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
export async function handler(opts, params) {
|
|
76
|
-
if (opts.global && opts.globalPkgDir) {
|
|
77
|
-
return listGlobalPackages(opts.globalPkgDir, params);
|
|
78
|
-
}
|
|
79
77
|
const include = computeInclude(opts);
|
|
80
78
|
const depth = opts.cliOptions?.['depth'] ?? 0;
|
|
79
|
+
if (opts.global && opts.globalPkgDir) {
|
|
80
|
+
if (depth > 0) {
|
|
81
|
+
const allInstallDirs = findGlobalInstallDirs(opts.globalPkgDir, []);
|
|
82
|
+
if (allInstallDirs.length === 1) {
|
|
83
|
+
// Single global install: delegate with params unchanged so
|
|
84
|
+
// listForPackages can search across the whole tree (including
|
|
85
|
+
// transitive deps), matching regular `pnpm ls` semantics.
|
|
86
|
+
return render([allInstallDirs[0]], params, {
|
|
87
|
+
...opts,
|
|
88
|
+
depth,
|
|
89
|
+
include,
|
|
90
|
+
lockfileDir: allInstallDirs[0],
|
|
91
|
+
checkWantedLockfileOnly: opts.lockfileOnly,
|
|
92
|
+
onlyProjects: opts.cliOptions?.['only-projects'] ?? opts.onlyProjects,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
// Multiple installs — try to narrow to a single one via params,
|
|
96
|
+
// matching against top-level aliases of each install group.
|
|
97
|
+
const matchingInstallDirs = findGlobalInstallDirs(opts.globalPkgDir, params);
|
|
98
|
+
if (matchingInstallDirs.length > 1 || (matchingInstallDirs.length === 0 && allInstallDirs.length > 0)) {
|
|
99
|
+
throw new PnpmError('GLOBAL_LS_DEPTH_NOT_SUPPORTED', 'Cannot list a merged dependency tree across multiple global packages. ' +
|
|
100
|
+
'Each global package is installed in an isolated directory with its own lockfile, ' +
|
|
101
|
+
'so transitive dependencies cannot be coherently merged. ' +
|
|
102
|
+
'Filter to a single global package by its top-level name, or omit --depth.');
|
|
103
|
+
}
|
|
104
|
+
if (matchingInstallDirs.length === 1) {
|
|
105
|
+
// Drop params: they served their purpose of narrowing to a single
|
|
106
|
+
// install group. Passing them through to `render` would activate
|
|
107
|
+
// search semantics, which prune the matched package's children.
|
|
108
|
+
return render([matchingInstallDirs[0]], [], {
|
|
109
|
+
...opts,
|
|
110
|
+
depth,
|
|
111
|
+
include,
|
|
112
|
+
lockfileDir: matchingInstallDirs[0],
|
|
113
|
+
checkWantedLockfileOnly: opts.lockfileOnly,
|
|
114
|
+
onlyProjects: opts.cliOptions?.['only-projects'] ?? opts.onlyProjects,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return listGlobalPackages(opts.globalPkgDir, params, {
|
|
119
|
+
long: opts.long,
|
|
120
|
+
reportAs: determineReportAs(opts),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
81
123
|
if (opts.recursive && (opts.selectedProjectsGraph != null)) {
|
|
82
124
|
const pkgs = Object.values(opts.selectedProjectsGraph).map((wsPkg) => wsPkg.package);
|
|
83
125
|
return listRecursive(pkgs, params, { ...opts, depth, include, checkWantedLockfileOnly: opts.lockfileOnly, onlyProjects: opts.cliOptions?.['only-projects'] ?? opts.onlyProjects });
|
package/lib/peers.js
CHANGED
|
@@ -2,7 +2,7 @@ import { FILTERING, UNIVERSAL_OPTIONS } from '@pnpm/cli.common-cli-options-help'
|
|
|
2
2
|
import { docsUrl } from '@pnpm/cli.utils';
|
|
3
3
|
import { types as allTypes } from '@pnpm/config.reader';
|
|
4
4
|
import { checkPeerDependencies } from '@pnpm/deps.inspection.peers-checker';
|
|
5
|
-
import
|
|
5
|
+
import { renderPeerIssues } from '@pnpm/deps.inspection.peers-issues-renderer';
|
|
6
6
|
import { isEmpty, pick } from 'ramda';
|
|
7
7
|
import { renderHelp } from 'render-help';
|
|
8
8
|
export function rcOptionsTypes() {
|
|
@@ -86,7 +86,7 @@ async function checkCmd(opts) {
|
|
|
86
86
|
return { output: 'No peer dependency issues found', exitCode: 0 };
|
|
87
87
|
}
|
|
88
88
|
return {
|
|
89
|
-
output:
|
|
89
|
+
output: `Issues with peer dependencies found\n\n${renderPeerIssues(issues)}`,
|
|
90
90
|
exitCode: 1,
|
|
91
91
|
};
|
|
92
92
|
}
|
|
@@ -94,52 +94,4 @@ function hasNoIssues(issues) {
|
|
|
94
94
|
return Object.values(issues).every((projectIssues) => isEmpty(projectIssues.bad) &&
|
|
95
95
|
isEmpty(projectIssues.missing));
|
|
96
96
|
}
|
|
97
|
-
function renderPeerIssuesFlat(issuesByProjects) {
|
|
98
|
-
const sections = [];
|
|
99
|
-
for (const [, { bad, missing, conflicts, intersections }] of Object.entries(issuesByProjects)) {
|
|
100
|
-
for (const [peerName, issues] of Object.entries(bad)) {
|
|
101
|
-
const foundVersion = issues[0].foundVersion;
|
|
102
|
-
const header = `${chalk.yellowBright('✕ unmet peer')} ${chalk.bold(peerName)}`;
|
|
103
|
-
const installed = ` ${chalk.cyan('Installed:')} ${chalk.dim(foundVersion)}`;
|
|
104
|
-
sections.push(`${header}\n${installed}\n${formatRequiredBy(issues)}`);
|
|
105
|
-
}
|
|
106
|
-
for (const [peerName, issues] of Object.entries(missing)) {
|
|
107
|
-
if (!intersections[peerName] && !conflicts.includes(peerName))
|
|
108
|
-
continue;
|
|
109
|
-
const conflict = conflicts.includes(peerName);
|
|
110
|
-
const header = conflict
|
|
111
|
-
? `${chalk.red('✕ conflicting peer')} ${chalk.bold(peerName)}`
|
|
112
|
-
: `${chalk.red('✕ missing peer')} ${chalk.bold(peerName)}`;
|
|
113
|
-
sections.push(`${header}\n${formatRequiredBy(issues)}`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (sections.length === 0)
|
|
117
|
-
return '';
|
|
118
|
-
return `Issues with peer dependencies found\n\n${sections.join('\n\n')}`;
|
|
119
|
-
}
|
|
120
|
-
function formatRequiredBy(issues) {
|
|
121
|
-
const byRange = new Map();
|
|
122
|
-
for (const issue of issues) {
|
|
123
|
-
const declaring = issue.parents[issue.parents.length - 1];
|
|
124
|
-
const pkg = `${declaring.name}@${declaring.version}`;
|
|
125
|
-
if (!byRange.has(issue.wantedRange)) {
|
|
126
|
-
byRange.set(issue.wantedRange, new Set());
|
|
127
|
-
}
|
|
128
|
-
byRange.get(issue.wantedRange).add(pkg);
|
|
129
|
-
}
|
|
130
|
-
const lines = [` ${chalk.cyan('Wanted:')}`];
|
|
131
|
-
for (const [range, pkgs] of byRange) {
|
|
132
|
-
lines.push(` ${chalk.cyanBright(formatRange(range))}${chalk.cyan(':')}`);
|
|
133
|
-
for (const pkg of pkgs) {
|
|
134
|
-
lines.push(` ${chalk.dim(pkg)}`);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return lines.join('\n');
|
|
138
|
-
}
|
|
139
|
-
function formatRange(range) {
|
|
140
|
-
if (range.includes(' ') || range === '*') {
|
|
141
|
-
return `"${range}"`;
|
|
142
|
-
}
|
|
143
|
-
return range;
|
|
144
|
-
}
|
|
145
97
|
//# sourceMappingURL=peers.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/deps.inspection.commands",
|
|
3
|
-
"version": "1100.1.
|
|
3
|
+
"version": "1100.1.9",
|
|
4
4
|
"description": "The list, ll, why, and outdated commands of pnpm",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -32,27 +32,28 @@
|
|
|
32
32
|
"open": "^7.4.2",
|
|
33
33
|
"ramda": "npm:@pnpm/ramda@0.28.1",
|
|
34
34
|
"render-help": "^2.0.0",
|
|
35
|
-
"@pnpm/cli.command": "1100.0.1",
|
|
36
35
|
"@pnpm/cli.utils": "1101.0.2",
|
|
37
|
-
"@pnpm/
|
|
38
|
-
"@pnpm/config.reader": "1101.1.4",
|
|
39
|
-
"@pnpm/cli.common-cli-options-help": "1100.0.1",
|
|
36
|
+
"@pnpm/cli.command": "1100.0.1",
|
|
40
37
|
"@pnpm/config.pick-registry-for-package": "1100.0.2",
|
|
41
|
-
"@pnpm/deps.inspection.list": "1100.0.5",
|
|
42
38
|
"@pnpm/deps.inspection.peers-checker": "1100.0.4",
|
|
43
|
-
"@pnpm/
|
|
44
|
-
"@pnpm/
|
|
39
|
+
"@pnpm/config.matcher": "1100.0.1",
|
|
40
|
+
"@pnpm/deps.inspection.peers-issues-renderer": "1100.0.0",
|
|
41
|
+
"@pnpm/error": "1100.0.0",
|
|
42
|
+
"@pnpm/global.commands": "1100.0.10",
|
|
43
|
+
"@pnpm/deps.inspection.list": "1100.0.5",
|
|
44
|
+
"@pnpm/cli.common-cli-options-help": "1100.0.1",
|
|
45
45
|
"@pnpm/deps.inspection.outdated": "1100.0.8",
|
|
46
|
-
"@pnpm/
|
|
46
|
+
"@pnpm/global.packages": "1100.0.2",
|
|
47
|
+
"@pnpm/network.fetch": "1100.0.2",
|
|
47
48
|
"@pnpm/lockfile.fs": "1100.0.4",
|
|
48
|
-
"@pnpm/
|
|
49
|
-
"@pnpm/network.auth-header": "1100.0.1",
|
|
49
|
+
"@pnpm/config.reader": "1101.1.4",
|
|
50
50
|
"@pnpm/resolving.npm-resolver": "1101.0.1",
|
|
51
|
+
"@pnpm/network.auth-header": "1100.0.1",
|
|
51
52
|
"@pnpm/resolving.default-resolver": "1100.0.8",
|
|
52
|
-
"@pnpm/
|
|
53
|
+
"@pnpm/resolving.registry.types": "1100.0.2",
|
|
53
54
|
"@pnpm/types": "1101.0.0",
|
|
54
|
-
"@pnpm/
|
|
55
|
-
"@pnpm/
|
|
55
|
+
"@pnpm/store.path": "1100.0.1",
|
|
56
|
+
"@pnpm/installing.modules-yaml": "1100.0.2"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|
|
58
59
|
"@pnpm/logger": ">=1001.0.0 <1002.0.0"
|
|
@@ -66,12 +67,12 @@
|
|
|
66
67
|
"symlink-dir": "^10.0.1",
|
|
67
68
|
"write-yaml-file": "^6.0.0",
|
|
68
69
|
"@pnpm/constants": "1100.0.0",
|
|
69
|
-
"@pnpm/deps.inspection.commands": "1100.1.
|
|
70
|
-
"@pnpm/
|
|
70
|
+
"@pnpm/deps.inspection.commands": "1100.1.9",
|
|
71
|
+
"@pnpm/installing.commands": "1100.1.8",
|
|
72
|
+
"@pnpm/test-fixtures": "1100.0.0",
|
|
71
73
|
"@pnpm/testing.command-defaults": "1100.0.1",
|
|
72
|
-
"@pnpm/
|
|
73
|
-
"@pnpm/
|
|
74
|
-
"@pnpm/test-fixtures": "1100.0.0"
|
|
74
|
+
"@pnpm/prepare": "1100.0.4",
|
|
75
|
+
"@pnpm/workspace.projects-filter": "1100.0.7"
|
|
75
76
|
},
|
|
76
77
|
"engines": {
|
|
77
78
|
"node": ">=22.13"
|