New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dependencies-hierarchy

Package Overview
Dependencies
Maintainers
1
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dependencies-hierarchy - npm Package Compare versions

Comparing version 1.0.2 to 2.0.0

4

lib/index.d.ts

@@ -5,3 +5,3 @@ export declare type PackageSelector = string | {

};
export declare type PackageNode = {
export interface PackageNode {
pkg: {

@@ -15,3 +15,3 @@ name: string;

circular?: true;
};
}
export declare function forPackages(packages: PackageSelector[], projectPath: string, opts?: {

@@ -18,0 +18,0 @@ depth: number;

@@ -11,6 +11,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const dependency_path_1 = require("dependency-path");
const pnpm_shrinkwrap_1 = require("pnpm-shrinkwrap");
const semver = require("semver");
const dependency_path_1 = require("dependency-path");
const assert = require("assert");
function forPackages(packages, projectPath, opts) {

@@ -27,12 +27,12 @@ assert(packages, 'packages should be defined');

exports.default = default_1;
function dependenciesHierarchy(projectPath, searched, opts) {
function dependenciesHierarchy(projectPath, searched, maybeOpts) {
return __awaiter(this, void 0, void 0, function* () {
const _opts = Object.assign({}, {
const opts = Object.assign({}, {
depth: 0,
only: undefined,
}, opts);
}, maybeOpts);
const shrinkwrap = yield pnpm_shrinkwrap_1.readPrivate(projectPath, { ignoreIncompatible: false });
if (!shrinkwrap)
return [];
const topDeps = getTopDependencies(shrinkwrap, _opts);
const topDeps = getTopDependencies(shrinkwrap, opts);
if (!topDeps)

@@ -42,9 +42,9 @@ return [];

currentDepth: 1,
maxDepth: _opts.depth,
prod: _opts.only === 'prod',
maxDepth: opts.depth,
prod: opts.only === 'prod',
registry: shrinkwrap.registry,
searched,
registry: shrinkwrap.registry,
}, shrinkwrap.packages);
const result = [];
Object.keys(topDeps).forEach(depName => {
Object.keys(topDeps).forEach((depName) => {
const relativeId = dependency_path_1.refToRelative(topDeps[depName], depName);

@@ -54,4 +54,4 @@ const pkgPath = dependency_path_1.refToAbsolute(topDeps[depName], depName, shrinkwrap.registry);

name: depName,
path: pkgPath,
version: topDeps[depName],
path: pkgPath,
};

@@ -63,4 +63,4 @@ const dependencies = getChildrenTree([relativeId], relativeId);

newEntry = {
dependencies,
pkg,
dependencies,
};

@@ -102,4 +102,4 @@ }

}), packages);
let result = [];
Object.keys(deps).forEach(depName => {
const result = [];
Object.keys(deps).forEach((depName) => {
const pkgPath = dependency_path_1.refToAbsolute(deps[depName], depName, opts.registry);

@@ -109,4 +109,4 @@ const relativeId = dependency_path_1.refToRelative(deps[depName], depName);

name: depName,
path: pkgPath,
version: deps[depName],
path: pkgPath,
};

@@ -119,4 +119,4 @@ const circular = keypath.indexOf(relativeId) !== -1;

newEntry = {
dependencies,
pkg,
dependencies,
};

@@ -140,3 +140,3 @@ }

function matches(searched, pkg) {
return searched.some(searchedPkg => {
return searched.some((searchedPkg) => {
if (typeof searchedPkg === 'string') {

@@ -143,0 +143,0 @@ return pkg.name === searchedPkg;

{
"name": "dependencies-hierarchy",
"version": "1.0.2",
"version": "2.0.0",
"description": "Creates a dependencies hierarchy for a symlinked `node_modules`",

@@ -11,8 +11,12 @@ "main": "lib/index.js",

"scripts": {
"prepare": "cd test && pnpm install",
"test": "cd test && npm test && mos t",
"fix": "tslint -c tslint.json --project . --fix",
"lint": "tslint -c tslint.json --project .",
"test": "npm run lint && preview && ts-node test && mos t",
"prepublishOnly": "tsc",
"tsc": "tsc",
"md": "tsc && mos"
"md": "preview && tsc && mos"
},
"engines": {
"node": ">=4"
},
"repository": {

@@ -30,3 +34,3 @@ "type": "git",

"name": "Zoltan Kochan",
"email": "zoltan.kochan@gmail.com",
"email": "z@kochan.io",
"url": "https://www.kochan.io/"

@@ -43,9 +47,14 @@ },

"dependency-path": "^1.0.0",
"pnpm-shrinkwrap": "^4.0.0",
"pnpm-shrinkwrap": "^5.0.0",
"semver": "^5.3.0"
},
"devDependencies": {
"@pnpm/logger": "^1.0.0",
"@types/tape": "^4.2.30",
"mos": "^2.0.0-alpha.3",
"mos-plugin-readme": "^1.0.4",
"pnpm-logger": "^0.6.2",
"package-preview": "^1.0.0",
"tape": "^4.7.0",
"ts-node": "^3.3.0",
"tslint": "^5.8.0",
"typescript": "^2.4.1"

@@ -52,0 +61,0 @@ },

@@ -29,14 +29,4 @@ # dependencies-hierarchy

// {
// "pkg": {
// "name": "write-pkg",
// "version": "3.1.0",
// "path": "registry.npmjs.org/write-pkg/3.1.0"
// },
// "dependencies": [
// {
// "pkg": {
// "name": "write-json-file",
// "version": "2.2.0",
// "path": "registry.npmjs.org/write-json-file/2.2.0"
// },
// "dependencies": [

@@ -46,4 +36,4 @@ // {

// "name": "graceful-fs",
// "version": "4.1.11",
// "path": "registry.npmjs.org/graceful-fs/4.1.11"
// "path": "registry.npmjs.org/graceful-fs/4.1.11",
// "version": "4.1.11"
// },

@@ -55,10 +45,20 @@ // "searched": true

// "name": "pify",
// "version": "2.3.0",
// "path": "registry.npmjs.org/pify/2.3.0"
// "path": "registry.npmjs.org/pify/2.3.0",
// "version": "2.3.0"
// },
// "searched": true
// }
// ]
// ],
// "pkg": {
// "name": "write-json-file",
// "path": "registry.npmjs.org/write-json-file/2.2.0",
// "version": "2.2.0"
// }
// }
// ]
// ],
// "pkg": {
// "name": "write-pkg",
// "path": "registry.npmjs.org/write-pkg/3.1.0",
// "version": "3.1.0"
// }
// }

@@ -65,0 +65,0 @@ // ]

Sorry, the diff of this file is not supported yet

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