@pnpm/deps.inspection.commands 1000.0.0 → 1100.0.0
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/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/listing/list.d.ts +3 -2
- package/lib/listing/list.js +1 -0
- package/lib/listing/ll.d.ts +1 -0
- package/lib/listing/ll.js +1 -0
- package/lib/listing/why.d.ts +1 -0
- package/lib/listing/why.js +1 -0
- package/lib/outdated/outdated.d.ts +2 -2
- package/lib/peers.d.ts +17 -0
- package/lib/peers.js +145 -0
- package/lib/view/index.d.ts +8 -0
- package/lib/view/index.js +229 -0
- package/package.json +36 -29
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/listing/list.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Config } from '@pnpm/config.reader';
|
|
1
|
+
import { type Config, type ConfigContext } from '@pnpm/config.reader';
|
|
2
2
|
import type { Finder, IncludedDependencies } from '@pnpm/types';
|
|
3
3
|
export declare const EXCLUDE_PEERS_HELP: {
|
|
4
4
|
description: string;
|
|
@@ -8,8 +8,9 @@ export declare function rcOptionsTypes(): Record<string, unknown>;
|
|
|
8
8
|
export declare const cliOptionsTypes: () => Record<string, unknown>;
|
|
9
9
|
export { shorthands } from './common.js';
|
|
10
10
|
export declare const commandNames: string[];
|
|
11
|
+
export declare const recursiveByDefault = true;
|
|
11
12
|
export declare function help(): string;
|
|
12
|
-
export type ListCommandOptions = Pick<Config, '
|
|
13
|
+
export type ListCommandOptions = Pick<Config, 'dev' | 'dir' | 'optional' | 'production' | 'modulesDir' | 'virtualStoreDirMaxLength'> & Pick<ConfigContext, 'allProjects' | 'finders' | 'selectedProjectsGraph'> & Partial<Pick<ConfigContext, 'cliOptions'>> & {
|
|
13
14
|
alwaysPrintRootPackage?: boolean;
|
|
14
15
|
depth?: number;
|
|
15
16
|
excludePeers?: boolean;
|
package/lib/listing/list.js
CHANGED
|
@@ -27,6 +27,7 @@ export const cliOptionsTypes = () => ({
|
|
|
27
27
|
});
|
|
28
28
|
export { shorthands } from './common.js';
|
|
29
29
|
export const commandNames = ['list', 'ls'];
|
|
30
|
+
export const recursiveByDefault = true;
|
|
30
31
|
export function help() {
|
|
31
32
|
return renderHelp({
|
|
32
33
|
aliases: ['list', 'ls', 'la', 'll'],
|
package/lib/listing/ll.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as list from './list.js';
|
|
2
2
|
export declare const commandNames: string[];
|
|
3
|
+
export declare const recursiveByDefault = true;
|
|
3
4
|
export declare const rcOptionsTypes: typeof list.rcOptionsTypes;
|
|
4
5
|
export declare function cliOptionsTypes(): Record<string, unknown>;
|
|
5
6
|
export declare const help: typeof list.help;
|
package/lib/listing/ll.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { omit } from 'ramda';
|
|
2
2
|
import * as list from './list.js';
|
|
3
3
|
export const commandNames = ['ll', 'la'];
|
|
4
|
+
export const recursiveByDefault = true;
|
|
4
5
|
export const rcOptionsTypes = list.rcOptionsTypes;
|
|
5
6
|
export function cliOptionsTypes() {
|
|
6
7
|
return omit(['long'], list.cliOptionsTypes());
|
package/lib/listing/why.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export declare function rcOptionsTypes(): Record<string, unknown>;
|
|
|
3
3
|
export declare const cliOptionsTypes: () => Record<string, unknown>;
|
|
4
4
|
export { shorthands } from './common.js';
|
|
5
5
|
export declare const commandNames: string[];
|
|
6
|
+
export declare const recursiveByDefault = true;
|
|
6
7
|
export declare function help(): string;
|
|
7
8
|
export declare function handler(opts: ListCommandOptions, params: string[]): Promise<string>;
|
package/lib/listing/why.js
CHANGED
|
@@ -18,6 +18,7 @@ export const cliOptionsTypes = () => ({
|
|
|
18
18
|
});
|
|
19
19
|
export { shorthands } from './common.js';
|
|
20
20
|
export const commandNames = ['why'];
|
|
21
|
+
export const recursiveByDefault = true;
|
|
21
22
|
export function help() {
|
|
22
23
|
return renderHelp({
|
|
23
24
|
description: `Shows the packages that depend on <pkg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompletionFunc } from '@pnpm/cli.command';
|
|
2
|
-
import { type Config } from '@pnpm/config.reader';
|
|
2
|
+
import { type Config, type ConfigContext } from '@pnpm/config.reader';
|
|
3
3
|
import { type OutdatedPackage } from '@pnpm/deps.inspection.outdated';
|
|
4
4
|
import type { DependenciesField, PackageManifest } from '@pnpm/types';
|
|
5
5
|
import { type OutdatedWithVersionDiff } from './utils.js';
|
|
@@ -15,7 +15,7 @@ export type OutdatedCommandOptions = {
|
|
|
15
15
|
recursive?: boolean;
|
|
16
16
|
format?: 'table' | 'list' | 'json';
|
|
17
17
|
sortBy?: 'name';
|
|
18
|
-
} & Pick<Config, '
|
|
18
|
+
} & Pick<Config, 'ca' | 'cacheDir' | 'catalogs' | 'cert' | 'dev' | 'dir' | 'engineStrict' | 'fetchRetries' | 'fetchRetryFactor' | 'fetchRetryMaxtimeout' | 'fetchRetryMintimeout' | 'fetchTimeout' | 'global' | 'httpProxy' | 'httpsProxy' | 'key' | 'localAddress' | 'lockfileDir' | 'minimumReleaseAge' | 'minimumReleaseAgeExclude' | 'networkConcurrency' | 'noProxy' | 'offline' | 'optional' | 'production' | 'configByUri' | 'registries' | 'strictSsl' | 'tag' | 'userAgent' | 'updateConfig'> & Pick<ConfigContext, 'allProjects' | 'selectedProjectsGraph'> & Partial<Pick<Config, 'globalPkgDir' | 'userConfig'>>;
|
|
19
19
|
export declare function handler(opts: OutdatedCommandOptions, params?: string[]): Promise<{
|
|
20
20
|
output: string;
|
|
21
21
|
exitCode: number;
|
package/lib/peers.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Config, type ConfigContext } from '@pnpm/config.reader';
|
|
2
|
+
export declare function rcOptionsTypes(): Record<string, unknown>;
|
|
3
|
+
export declare const cliOptionsTypes: () => Record<string, unknown>;
|
|
4
|
+
export declare const shorthands: {};
|
|
5
|
+
export declare const commandNames: string[];
|
|
6
|
+
export declare const recursiveByDefault = true;
|
|
7
|
+
export declare function help(): string;
|
|
8
|
+
export type PeersCommandOptions = Pick<Config, 'dir' | 'modulesDir' | 'peerDependencyRules'> & Pick<ConfigContext, 'selectedProjectsGraph'> & Partial<Pick<ConfigContext, 'cliOptions'>> & {
|
|
9
|
+
json?: boolean;
|
|
10
|
+
lockfileDir?: string;
|
|
11
|
+
lockfileOnly?: boolean;
|
|
12
|
+
recursive?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function handler(opts: PeersCommandOptions, params: string[]): Promise<string | {
|
|
15
|
+
output: string;
|
|
16
|
+
exitCode: number;
|
|
17
|
+
}>;
|
package/lib/peers.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { FILTERING, UNIVERSAL_OPTIONS } from '@pnpm/cli.common-cli-options-help';
|
|
2
|
+
import { docsUrl } from '@pnpm/cli.utils';
|
|
3
|
+
import { types as allTypes } from '@pnpm/config.reader';
|
|
4
|
+
import { checkPeerDependencies } from '@pnpm/deps.inspection.peers-checker';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { isEmpty, pick } from 'ramda';
|
|
7
|
+
import { renderHelp } from 'render-help';
|
|
8
|
+
export function rcOptionsTypes() {
|
|
9
|
+
return pick([
|
|
10
|
+
'json',
|
|
11
|
+
'lockfile-only',
|
|
12
|
+
], allTypes);
|
|
13
|
+
}
|
|
14
|
+
export const cliOptionsTypes = () => ({
|
|
15
|
+
...rcOptionsTypes(),
|
|
16
|
+
recursive: Boolean,
|
|
17
|
+
});
|
|
18
|
+
export const shorthands = {};
|
|
19
|
+
export const commandNames = ['peers'];
|
|
20
|
+
export const recursiveByDefault = true;
|
|
21
|
+
export function help() {
|
|
22
|
+
return renderHelp({
|
|
23
|
+
description: 'Commands for inspecting peer dependency relationships.',
|
|
24
|
+
descriptionLists: [
|
|
25
|
+
{
|
|
26
|
+
title: 'Commands',
|
|
27
|
+
list: [
|
|
28
|
+
{
|
|
29
|
+
description: 'Checks for unmet or missing peer dependency issues by reading the lockfile. \
|
|
30
|
+
Exits with a non-zero exit code when issues are found.',
|
|
31
|
+
name: 'check',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: 'Options',
|
|
37
|
+
list: [
|
|
38
|
+
{
|
|
39
|
+
description: 'Show information in JSON format',
|
|
40
|
+
name: '--json',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
description: 'Check the lockfile only, without reading node_modules.',
|
|
44
|
+
name: '--lockfile-only',
|
|
45
|
+
},
|
|
46
|
+
...UNIVERSAL_OPTIONS,
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
FILTERING,
|
|
50
|
+
],
|
|
51
|
+
url: docsUrl('peers'),
|
|
52
|
+
usages: [
|
|
53
|
+
'pnpm peers <command>',
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export async function handler(opts, params) {
|
|
58
|
+
switch (params[0]) {
|
|
59
|
+
case 'check':
|
|
60
|
+
case undefined:
|
|
61
|
+
return checkCmd(opts);
|
|
62
|
+
default:
|
|
63
|
+
return { output: help(), exitCode: 1 };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function checkCmd(opts) {
|
|
67
|
+
const lockfileDir = opts.lockfileDir ?? opts.dir;
|
|
68
|
+
const projectPaths = opts.recursive && opts.selectedProjectsGraph
|
|
69
|
+
? Object.keys(opts.selectedProjectsGraph)
|
|
70
|
+
: [opts.dir];
|
|
71
|
+
const issues = await checkPeerDependencies(projectPaths, {
|
|
72
|
+
lockfileDir,
|
|
73
|
+
checkWantedLockfileOnly: opts.lockfileOnly,
|
|
74
|
+
modulesDir: opts.modulesDir,
|
|
75
|
+
peerDependencyRules: opts.peerDependencyRules,
|
|
76
|
+
});
|
|
77
|
+
const noIssues = hasNoIssues(issues);
|
|
78
|
+
const json = opts.json ?? opts.cliOptions?.['json'];
|
|
79
|
+
if (json) {
|
|
80
|
+
return {
|
|
81
|
+
output: JSON.stringify(issues, null, 2),
|
|
82
|
+
exitCode: noIssues ? 0 : 1,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (noIssues) {
|
|
86
|
+
return { output: 'No peer dependency issues found', exitCode: 0 };
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
output: renderPeerIssuesFlat(issues),
|
|
90
|
+
exitCode: 1,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function hasNoIssues(issues) {
|
|
94
|
+
return Object.values(issues).every((projectIssues) => isEmpty(projectIssues.bad) &&
|
|
95
|
+
isEmpty(projectIssues.missing));
|
|
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
|
+
//# sourceMappingURL=peers.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Config, type ConfigContext } from '@pnpm/config.reader';
|
|
2
|
+
export declare function rcOptionsTypes(): Record<string, unknown>;
|
|
3
|
+
export declare function cliOptionsTypes(): Record<string, unknown>;
|
|
4
|
+
export declare const commandNames: string[];
|
|
5
|
+
export declare function help(): string;
|
|
6
|
+
export declare function handler(opts: Config & ConfigContext & {
|
|
7
|
+
json?: boolean;
|
|
8
|
+
}, params: string[]): Promise<string | void>;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { pickRegistryForPackage } from '@pnpm/config.pick-registry-for-package';
|
|
2
|
+
import { types as allTypes } from '@pnpm/config.reader';
|
|
3
|
+
import { PnpmError } from '@pnpm/error';
|
|
4
|
+
import { createGetAuthHeaderByURI } from '@pnpm/network.auth-header';
|
|
5
|
+
import { createFetchFromRegistry } from '@pnpm/network.fetch';
|
|
6
|
+
import npa from '@pnpm/npm-package-arg';
|
|
7
|
+
import { fetchMetadataFromFromRegistry, pickPackageFromMeta, pickVersionByVersionRange, } from '@pnpm/resolving.npm-resolver';
|
|
8
|
+
import { pick } from 'ramda';
|
|
9
|
+
import { renderHelp } from 'render-help';
|
|
10
|
+
export function rcOptionsTypes() {
|
|
11
|
+
return pick(['registry'], allTypes);
|
|
12
|
+
}
|
|
13
|
+
export function cliOptionsTypes() {
|
|
14
|
+
return {
|
|
15
|
+
...rcOptionsTypes(),
|
|
16
|
+
json: Boolean,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export const commandNames = ['view', 'info', 'show', 'v'];
|
|
20
|
+
export function help() {
|
|
21
|
+
return renderHelp({
|
|
22
|
+
description: 'View package information from the registry without using npm CLI.',
|
|
23
|
+
usages: [
|
|
24
|
+
'pnpm view <package-name>',
|
|
25
|
+
'pnpm view <package-name>@<version>',
|
|
26
|
+
'pnpm view <package-name> [<field>[.subfield]...]',
|
|
27
|
+
],
|
|
28
|
+
descriptionLists: [
|
|
29
|
+
{
|
|
30
|
+
title: 'Options',
|
|
31
|
+
list: [
|
|
32
|
+
{
|
|
33
|
+
description: 'Show information in JSON format',
|
|
34
|
+
name: '--json',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export async function handler(opts, params) {
|
|
42
|
+
const packageSpec = params[0];
|
|
43
|
+
if (!packageSpec) {
|
|
44
|
+
throw new PnpmError('MISSING_PACKAGE_NAME', 'Package name is required. Usage: pnpm view <package-name>');
|
|
45
|
+
}
|
|
46
|
+
const fields = params.slice(1);
|
|
47
|
+
let parsed;
|
|
48
|
+
try {
|
|
49
|
+
parsed = npa(packageSpec);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
throw new PnpmError('INVALID_PACKAGE_NAME', `Invalid package name: "${packageSpec}"`);
|
|
53
|
+
}
|
|
54
|
+
if (!parsed.registry) {
|
|
55
|
+
throw new PnpmError('INVALID_PACKAGE_NAME', `Invalid package name: "${packageSpec}". pnpm view only supports registry packages.`);
|
|
56
|
+
}
|
|
57
|
+
const subSpec = parsed.type === 'alias' ? parsed.subSpec : parsed;
|
|
58
|
+
const packageName = subSpec?.name;
|
|
59
|
+
if (!packageName) {
|
|
60
|
+
throw new PnpmError('INVALID_PACKAGE_NAME', `Invalid package name: "${packageSpec}"`);
|
|
61
|
+
}
|
|
62
|
+
const specType = (subSpec?.type ?? 'tag');
|
|
63
|
+
const spec = {
|
|
64
|
+
name: packageName,
|
|
65
|
+
fetchSpec: subSpec?.fetchSpec ?? 'latest',
|
|
66
|
+
type: specType,
|
|
67
|
+
};
|
|
68
|
+
const registry = pickRegistryForPackage(opts.registries, packageName);
|
|
69
|
+
const fetchFromRegistry = createFetchFromRegistry(opts);
|
|
70
|
+
const getAuthHeader = createGetAuthHeaderByURI(opts.configByUri ?? {}, opts.registries?.default);
|
|
71
|
+
const fetchResult = await fetchMetadataFromFromRegistry({
|
|
72
|
+
fetch: fetchFromRegistry,
|
|
73
|
+
retry: {
|
|
74
|
+
factor: opts.fetchRetryFactor,
|
|
75
|
+
maxTimeout: opts.fetchRetryMaxtimeout,
|
|
76
|
+
minTimeout: opts.fetchRetryMintimeout,
|
|
77
|
+
retries: opts.fetchRetries,
|
|
78
|
+
},
|
|
79
|
+
timeout: opts.fetchTimeout ?? 60000,
|
|
80
|
+
fetchWarnTimeoutMs: 10000,
|
|
81
|
+
}, packageName, {
|
|
82
|
+
registry,
|
|
83
|
+
authHeaderValue: getAuthHeader(registry),
|
|
84
|
+
fullMetadata: true,
|
|
85
|
+
});
|
|
86
|
+
if (fetchResult.notModified) {
|
|
87
|
+
throw new PnpmError('UNEXPECTED_304', `Unexpected 304 response for ${packageName}`);
|
|
88
|
+
}
|
|
89
|
+
const { meta: metadata } = fetchResult;
|
|
90
|
+
const data = pickPackageFromMeta(pickVersionByVersionRange, { preferredVersionSelectors: undefined }, spec, metadata);
|
|
91
|
+
if (!data) {
|
|
92
|
+
throw new PnpmError('PACKAGE_NOT_FOUND', `No matching version found for ${packageName}@${spec.fetchSpec}`);
|
|
93
|
+
}
|
|
94
|
+
const versions = metadata.versions ? Object.keys(metadata.versions) : [];
|
|
95
|
+
const depsCount = data.dependencies ? Object.keys(data.dependencies).length : 0;
|
|
96
|
+
const distTags = metadata['dist-tags'];
|
|
97
|
+
const info = {
|
|
98
|
+
...data,
|
|
99
|
+
author: typeof data.author === 'object' ? data.author.name : data.author,
|
|
100
|
+
repository: typeof data.repository === 'object' ? data.repository.url : data.repository,
|
|
101
|
+
versions,
|
|
102
|
+
versionsCount: versions.length > 0 ? versions.length : undefined,
|
|
103
|
+
depsCount: depsCount > 0 ? depsCount : undefined,
|
|
104
|
+
distTags,
|
|
105
|
+
'dist-tags': distTags,
|
|
106
|
+
time: metadata.time,
|
|
107
|
+
};
|
|
108
|
+
// If fields are specified, filter and return only those
|
|
109
|
+
if (fields.length > 0) {
|
|
110
|
+
const selectedFields = {};
|
|
111
|
+
for (const field of fields) {
|
|
112
|
+
selectedFields[field] = getNestedProperty(info, field);
|
|
113
|
+
}
|
|
114
|
+
if (opts.json) {
|
|
115
|
+
if (fields.length === 1) {
|
|
116
|
+
return JSON.stringify(selectedFields[fields[0]], null, 2);
|
|
117
|
+
}
|
|
118
|
+
return JSON.stringify(selectedFields, null, 2);
|
|
119
|
+
}
|
|
120
|
+
if (fields.length === 1) {
|
|
121
|
+
const value = selectedFields[fields[0]];
|
|
122
|
+
return formatFieldValue(value);
|
|
123
|
+
}
|
|
124
|
+
const lines = fields.map(field => {
|
|
125
|
+
const value = selectedFields[field];
|
|
126
|
+
if (typeof value === 'object' && value !== null) {
|
|
127
|
+
return `${field} = ${JSON.stringify(value)}`;
|
|
128
|
+
}
|
|
129
|
+
if (typeof value === 'string') {
|
|
130
|
+
return `${field} = '${value}'`;
|
|
131
|
+
}
|
|
132
|
+
return `${field} = ${formatFieldValue(value)}`;
|
|
133
|
+
});
|
|
134
|
+
return lines.join('\n');
|
|
135
|
+
}
|
|
136
|
+
if (opts.json) {
|
|
137
|
+
return JSON.stringify(info, null, 2);
|
|
138
|
+
}
|
|
139
|
+
const headerParts = [];
|
|
140
|
+
if (info.name && info.version) {
|
|
141
|
+
headerParts.push(`${info.name}@${info.version}`);
|
|
142
|
+
}
|
|
143
|
+
if (info.license) {
|
|
144
|
+
headerParts.push(info.license);
|
|
145
|
+
}
|
|
146
|
+
if (info.depsCount !== undefined) {
|
|
147
|
+
headerParts.push(`deps: ${info.depsCount}`);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
headerParts.push('deps: none');
|
|
151
|
+
}
|
|
152
|
+
if (info.versionsCount !== undefined) {
|
|
153
|
+
headerParts.push(`versions: ${info.versionsCount}`);
|
|
154
|
+
}
|
|
155
|
+
const lines = [headerParts.join(' | ')];
|
|
156
|
+
if (info.description) {
|
|
157
|
+
lines.push(info.description);
|
|
158
|
+
}
|
|
159
|
+
if (info.homepage) {
|
|
160
|
+
lines.push(info.homepage);
|
|
161
|
+
}
|
|
162
|
+
if (info.keywords && info.keywords.length > 0) {
|
|
163
|
+
lines.push('');
|
|
164
|
+
lines.push(`keywords: ${info.keywords.join(', ')}`);
|
|
165
|
+
}
|
|
166
|
+
if (info.dependencies && Object.keys(info.dependencies).length > 0) {
|
|
167
|
+
lines.push('');
|
|
168
|
+
lines.push('dependencies:');
|
|
169
|
+
const depEntries = Object.entries(info.dependencies).map(([name, version]) => `${name}: ${version}`);
|
|
170
|
+
lines.push(depEntries.join(', '));
|
|
171
|
+
}
|
|
172
|
+
if (info.dist) {
|
|
173
|
+
lines.push('');
|
|
174
|
+
lines.push('dist');
|
|
175
|
+
if (info.dist.tarball) {
|
|
176
|
+
lines.push(`.tarball: ${info.dist.tarball}`);
|
|
177
|
+
}
|
|
178
|
+
if (info.dist.shasum) {
|
|
179
|
+
lines.push(`.shasum: ${info.dist.shasum}`);
|
|
180
|
+
}
|
|
181
|
+
if (info.dist.integrity) {
|
|
182
|
+
lines.push(`.integrity: ${info.dist.integrity}`);
|
|
183
|
+
}
|
|
184
|
+
if (info.dist.unpackedSize != null) {
|
|
185
|
+
lines.push(`.unpackedSize: ${formatBytes(info.dist.unpackedSize)}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (info.maintainers && info.maintainers.length > 0) {
|
|
189
|
+
lines.push('');
|
|
190
|
+
lines.push('maintainers:');
|
|
191
|
+
for (const maintainer of info.maintainers) {
|
|
192
|
+
lines.push(`- ${maintainer.name}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (info.distTags && Object.keys(info.distTags).length > 0) {
|
|
196
|
+
lines.push('');
|
|
197
|
+
lines.push('dist-tags:');
|
|
198
|
+
for (const [tag, tagVersion] of Object.entries(info.distTags)) {
|
|
199
|
+
lines.push(`${tag}: ${tagVersion}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return lines.join('\n');
|
|
203
|
+
}
|
|
204
|
+
function formatBytes(bytes) {
|
|
205
|
+
if (bytes === 0)
|
|
206
|
+
return '0 B';
|
|
207
|
+
const k = 1024;
|
|
208
|
+
const sizes = ['B', 'kB', 'MB', 'GB', 'TB', 'PB'];
|
|
209
|
+
const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), sizes.length - 1);
|
|
210
|
+
return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + ' ' + sizes[i];
|
|
211
|
+
}
|
|
212
|
+
function getNestedProperty(obj, path) {
|
|
213
|
+
return path.split('.').reduce((acc, part) => {
|
|
214
|
+
if (typeof acc === 'object' && acc !== null) {
|
|
215
|
+
return acc[part];
|
|
216
|
+
}
|
|
217
|
+
return undefined;
|
|
218
|
+
}, obj);
|
|
219
|
+
}
|
|
220
|
+
function formatFieldValue(value) {
|
|
221
|
+
if (value === null || value === undefined) {
|
|
222
|
+
return '';
|
|
223
|
+
}
|
|
224
|
+
if (typeof value === 'object') {
|
|
225
|
+
return JSON.stringify(value, null, 2);
|
|
226
|
+
}
|
|
227
|
+
return String(value);
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/deps.inspection.commands",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1100.0.0",
|
|
4
4
|
"description": "The list, ll, why, and outdated commands of pnpm",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -25,44 +25,51 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@pnpm/colorize-semver-diff": "^1.0.1",
|
|
28
|
+
"@pnpm/npm-package-arg": "^2.0.0",
|
|
28
29
|
"@pnpm/semver-diff": "^1.1.0",
|
|
29
30
|
"@zkochan/table": "^2.0.1",
|
|
30
31
|
"chalk": "^5.6.0",
|
|
31
32
|
"ramda": "npm:@pnpm/ramda@0.28.1",
|
|
32
33
|
"render-help": "^2.0.0",
|
|
33
|
-
"@pnpm/cli.
|
|
34
|
-
"@pnpm/cli.
|
|
35
|
-
"@pnpm/cli.utils": "
|
|
36
|
-
"@pnpm/config.
|
|
37
|
-
"@pnpm/
|
|
38
|
-
"@pnpm/
|
|
39
|
-
"@pnpm/
|
|
40
|
-
"@pnpm/
|
|
41
|
-
"@pnpm/
|
|
42
|
-
"@pnpm/global.
|
|
43
|
-
"@pnpm/installing.modules-yaml": "
|
|
44
|
-
"@pnpm/
|
|
45
|
-
"@pnpm/
|
|
46
|
-
"@pnpm/
|
|
47
|
-
"@pnpm/
|
|
34
|
+
"@pnpm/cli.command": "1100.0.0",
|
|
35
|
+
"@pnpm/cli.common-cli-options-help": "1100.0.0",
|
|
36
|
+
"@pnpm/cli.utils": "1100.0.0",
|
|
37
|
+
"@pnpm/config.matcher": "1100.0.0",
|
|
38
|
+
"@pnpm/config.pick-registry-for-package": "1100.0.0",
|
|
39
|
+
"@pnpm/config.reader": "1100.0.0",
|
|
40
|
+
"@pnpm/deps.inspection.outdated": "1100.0.0",
|
|
41
|
+
"@pnpm/deps.inspection.peers-checker": "1100.0.0",
|
|
42
|
+
"@pnpm/error": "1100.0.0",
|
|
43
|
+
"@pnpm/global.commands": "1100.0.0",
|
|
44
|
+
"@pnpm/installing.modules-yaml": "1100.0.0",
|
|
45
|
+
"@pnpm/global.packages": "1100.0.0",
|
|
46
|
+
"@pnpm/lockfile.fs": "1100.0.0",
|
|
47
|
+
"@pnpm/network.auth-header": "1100.0.0",
|
|
48
|
+
"@pnpm/network.fetch": "1100.0.0",
|
|
49
|
+
"@pnpm/resolving.npm-resolver": "1100.0.0",
|
|
50
|
+
"@pnpm/store.path": "1100.0.0",
|
|
51
|
+
"@pnpm/deps.inspection.list": "1100.0.0",
|
|
52
|
+
"@pnpm/resolving.default-resolver": "1100.0.0",
|
|
53
|
+
"@pnpm/types": "1100.0.0"
|
|
48
54
|
},
|
|
49
55
|
"peerDependencies": {
|
|
50
56
|
"@pnpm/logger": ">=1001.0.0 <1002.0.0"
|
|
51
57
|
},
|
|
52
58
|
"devDependencies": {
|
|
53
|
-
"@jest/globals": "30.0
|
|
54
|
-
"@pnpm/registry-mock": "
|
|
55
|
-
"@types/ramda": "0.
|
|
59
|
+
"@jest/globals": "30.3.0",
|
|
60
|
+
"@pnpm/registry-mock": "6.0.0",
|
|
61
|
+
"@types/ramda": "0.31.1",
|
|
56
62
|
"@types/zkochan__table": "npm:@types/table@6.0.0",
|
|
57
63
|
"execa": "npm:safe-execa@0.3.0",
|
|
58
|
-
"symlink-dir": "^
|
|
64
|
+
"symlink-dir": "^10.0.1",
|
|
59
65
|
"write-yaml-file": "^6.0.0",
|
|
60
|
-
"@pnpm/constants": "
|
|
61
|
-
"@pnpm/
|
|
62
|
-
"@pnpm/installing.commands": "
|
|
63
|
-
"@pnpm/
|
|
64
|
-
"@pnpm/
|
|
65
|
-
"@pnpm/
|
|
66
|
+
"@pnpm/constants": "1100.0.0",
|
|
67
|
+
"@pnpm/deps.inspection.commands": "1100.0.0",
|
|
68
|
+
"@pnpm/installing.commands": "1100.0.0",
|
|
69
|
+
"@pnpm/prepare": "1100.0.0",
|
|
70
|
+
"@pnpm/test-fixtures": "1100.0.0",
|
|
71
|
+
"@pnpm/testing.command-defaults": "1100.0.0",
|
|
72
|
+
"@pnpm/workspace.projects-filter": "1100.0.0"
|
|
66
73
|
},
|
|
67
74
|
"engines": {
|
|
68
75
|
"node": ">=22.13"
|
|
@@ -72,8 +79,8 @@
|
|
|
72
79
|
},
|
|
73
80
|
"scripts": {
|
|
74
81
|
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
82
|
+
"test": "pn compile && pn --filter=pnpm compile && pn .test",
|
|
83
|
+
"compile": "tsgo --build && pn lint --fix",
|
|
84
|
+
".test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest"
|
|
78
85
|
}
|
|
79
86
|
}
|