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

@snyk/dep-graph

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@snyk/dep-graph - npm Package Compare versions

Comparing version 1.6.1 to 1.7.0

6

dist/legacy/index.d.ts

@@ -13,2 +13,3 @@ import * as types from '../core/types';

};
pruned?: boolean;
}

@@ -24,2 +25,5 @@ interface DepTree extends DepTreeDep {

declare function depTreeToGraph(depTree: DepTree, pkgManagerName: string): Promise<types.DepGraph>;
declare function graphToDepTree(depGraphInterface: types.DepGraph, pkgType: string): Promise<DepTree>;
export interface GraphToTreeOptions {
deduplicateWithinTopLevelDeps: boolean;
}
declare function graphToDepTree(depGraphInterface: types.DepGraph, pkgType: string, opts?: GraphToTreeOptions): Promise<DepTree>;

@@ -192,3 +192,4 @@ "use strict";

}
function graphToDepTree(depGraphInterface, pkgType) {
function graphToDepTree(depGraphInterface, pkgType, opts) {
if (opts === void 0) { opts = { deduplicateWithinTopLevelDeps: false }; }
return tslib_1.__awaiter(this, void 0, void 0, function () {

@@ -205,3 +206,3 @@ var depGraph, eventLoopSpinner, depTree, targetOS;

eventLoopSpinner = new event_loop_spinner_1.EventLoopSpinner();
return [4 /*yield*/, buildSubtree(depGraph, depGraph.rootNodeId, eventLoopSpinner)];
return [4 /*yield*/, buildSubtree(depGraph, depGraph.rootNodeId, eventLoopSpinner, opts.deduplicateWithinTopLevelDeps ? null : false)];
case 1:

@@ -240,8 +241,10 @@ depTree = _a.sent();

}
function buildSubtree(depGraph, nodeId, eventLoopSpinner) {
function buildSubtree(depGraph, nodeId, eventLoopSpinner, maybeDeduplicationSet) {
if (maybeDeduplicationSet === void 0) { maybeDeduplicationSet = null; }
return tslib_1.__awaiter(this, void 0, void 0, function () {
var nodePkg, nodeInfo, depTree, depInstanceIds, _i, depInstanceIds_1, depInstId, subtree;
var isRoot, nodePkg, nodeInfo, depTree, depInstanceIds, _i, depInstanceIds_1, depInstId, subtree;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
isRoot = nodeId === depGraph.rootNodeId;
nodePkg = depGraph.getNodePkg(nodeId);

@@ -262,2 +265,11 @@ nodeInfo = depGraph.getNode(nodeId);

}
if (maybeDeduplicationSet) {
if (maybeDeduplicationSet.has(nodeId)) {
if (depInstanceIds.length > 0) {
depTree.pruned = true;
}
return [2 /*return*/, depTree];
}
maybeDeduplicationSet.add(nodeId);
}
_i = 0, depInstanceIds_1 = depInstanceIds;

@@ -268,3 +280,8 @@ _a.label = 1;

depInstId = depInstanceIds_1[_i];
return [4 /*yield*/, buildSubtree(depGraph, depInstId, eventLoopSpinner)];
// Deduplication of nodes occurs only within a scope of a top-level dependency.
// Therefore, every top-level dep gets an independent set to track duplicates.
if (isRoot && maybeDeduplicationSet !== false) {
maybeDeduplicationSet = new Set();
}
return [4 /*yield*/, buildSubtree(depGraph, depInstId, eventLoopSpinner, maybeDeduplicationSet)];
case 2:

@@ -271,0 +288,0 @@ subtree = _a.sent();

2

package.json

@@ -50,3 +50,3 @@ {

},
"version": "1.6.1"
"version": "1.7.0"
}

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