Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pnpm/render-peer-issues

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/render-peer-issues - npm Package Compare versions

Comparing version 0.0.0 to 1.0.0

6

lib/index.d.ts

@@ -1,2 +0,4 @@

import { PeerDependencyIssues } from '@pnpm/types';
export default function (peerDependencyIssues: PeerDependencyIssues): string;
import { PeerDependencyIssuesByProjects } from '@pnpm/types';
export default function (peerDependencyIssuesByProjects: PeerDependencyIssuesByProjects, opts?: {
width?: number;
}): string;

@@ -8,29 +8,51 @@ "use strict";

const chalk_1 = __importDefault(require("chalk"));
const ROOT_LABEL = '<ROOT>';
function default_1(peerDependencyIssues) {
const cli_columns_1 = __importDefault(require("cli-columns"));
function default_1(peerDependencyIssuesByProjects, opts) {
var _a;
const projects = {};
for (const [peerName, issues] of Object.entries(peerDependencyIssues.missing)) {
for (const issue of issues) {
const projectPath = issue.location.projectPath || ROOT_LABEL;
if (!projects[projectPath]) {
projects[projectPath] = { dependencies: {}, peerIssues: [] };
for (const [projectId, { bad, missing, conflicts, intersections }] of Object.entries(peerDependencyIssuesByProjects)) {
projects[projectId] = { dependencies: {}, peerIssues: [] };
for (const [peerName, issues] of Object.entries(missing)) {
if (!conflicts.includes(peerName) &&
intersections[peerName] == null) {
continue;
}
createTree(projects[projectPath], issue.location.parents, `${chalk_1.default.red('✕ missing peer')} ${peerName}@"${issue.wantedRange}"`);
for (const issue of issues) {
createTree(projects[projectId], issue.parents, `${chalk_1.default.red('✕ missing peer')} ${formatNameAndRange(peerName, issue.wantedRange)}`);
}
}
}
for (const [peerName, issues] of Object.entries(peerDependencyIssues.bad)) {
for (const issue of issues) {
const projectPath = issue.location.projectPath || ROOT_LABEL;
if (!projects[projectPath]) {
projects[projectPath] = { dependencies: {}, peerIssues: [] };
for (const [peerName, issues] of Object.entries(bad)) {
for (const { parents, foundVersion, wantedRange } of issues) {
// eslint-disable-next-line
createTree(projects[projectId], parents, `${chalk_1.default.red('✕ unmet peer')} ${formatNameAndRange(peerName, wantedRange)}: found ${foundVersion}`);
}
// eslint-disable-next-line
createTree(projects[projectPath], issue.location.parents, `${chalk_1.default.red('✕ unmet peer')} ${peerName}@"${issue.wantedRange}": found ${issue.foundVersion}`);
}
}
const cliColumnsOptions = {
newline: '\n ',
width: ((_a = opts === null || opts === void 0 ? void 0 : opts.width) !== null && _a !== void 0 ? _a : process.stdout.columns) - 2,
};
return Object.entries(projects)
.filter(([, project]) => Object.keys(project.dependencies).length > 0)
.sort(([projectKey1], [projectKey2]) => projectKey1.localeCompare(projectKey2))
.map(([projectKey, project]) => (0, archy_1.default)(toArchyData(projectKey, project))).join('');
.map(([projectKey, project]) => {
let summary = '';
const { conflicts, intersections } = peerDependencyIssuesByProjects[projectKey];
if (conflicts.length) {
summary += chalk_1.default.red(`✕ Conflicting peer dependencies:\n ${(0, cli_columns_1.default)(conflicts, cliColumnsOptions)}`);
}
if (Object.keys(intersections).length) {
summary += `Peer dependencies that should be installed:\n ${(0, cli_columns_1.default)(Object.entries(intersections).map(([name, version]) => formatNameAndRange(name, version)), cliColumnsOptions)}`;
}
const title = chalk_1.default.white(projectKey);
return `${(0, archy_1.default)(toArchyData(title, project))}${summary}`;
}).join('\n\n');
}
exports.default = default_1;
function formatNameAndRange(name, range) {
if (range.includes(' ')) {
return `${name}@"${range}"`;
}
return `${name}@${range}`;
}
function createTree(pkgNode, pkgs, issueText) {

@@ -37,0 +59,0 @@ const [pkg, ...rest] = pkgs;

{
"name": "@pnpm/render-peer-issues",
"description": "Visualizes peer dependency issues",
"version": "0.0.0",
"version": "1.0.0",
"bugs": {

@@ -25,5 +25,6 @@ "url": "https://github.com/pnpm/pnpm/issues"

"dependencies": {
"@pnpm/types": "7.6.0",
"@pnpm/types": "7.7.0",
"archy": "^1.0.0",
"chalk": "^4.1.0"
"chalk": "^4.1.0",
"cli-columns": "^4.0.0"
},

@@ -30,0 +31,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc