workspace-tools
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -5,3 +5,18 @@ { | ||
{ | ||
"date": "Tue, 12 May 2020 01:25:43 GMT", | ||
"date": "Tue, 12 May 2020 16:43:03 GMT", | ||
"tag": "workspace-tools_v0.3.1", | ||
"version": "0.3.1", | ||
"comments": { | ||
"patch": [ | ||
{ | ||
"comment": "expose depedent map", | ||
"author": "kchau@microsoft.com", | ||
"commit": "e49bf63aad31a6b1c3e4ce4e08a8f61410c0889d", | ||
"package": "workspace-tools" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Tue, 12 May 2020 01:25:52 GMT", | ||
"tag": "workspace-tools_v0.3.0", | ||
@@ -8,0 +23,0 @@ "version": "0.3.0", |
# Change Log - workspace-tools | ||
This log was last generated on Tue, 12 May 2020 01:25:43 GMT and should not be manually modified. | ||
This log was last generated on Tue, 12 May 2020 16:43:03 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 0.3.1 | ||
Tue, 12 May 2020 16:43:03 GMT | ||
### Patches | ||
- expose depedent map (kchau@microsoft.com) | ||
## 0.3.0 | ||
Tue, 12 May 2020 01:25:43 GMT | ||
Tue, 12 May 2020 01:25:52 GMT | ||
@@ -11,0 +19,0 @@ ### Minor changes |
import { PackageInfo, PackageInfos } from "./types/PackageInfo"; | ||
/** | ||
* @internal resets the graph cache for internal testing purpose only | ||
*/ | ||
export declare function _resetGraphCache(): void; | ||
export declare function getTransitiveDependents(scopedPackages: string[], packages: PackageInfos): string[]; | ||
export declare function getDependentMap(packages: PackageInfos): Map<string, Set<string>>; | ||
export declare function getTransitiveDependencies(scopedPackages: string[], packages: PackageInfos): string[]; | ||
export declare function getInternalDeps(info: PackageInfo, packages: PackageInfos): string[]; |
@@ -18,27 +18,14 @@ "use strict"; | ||
} | ||
/** | ||
* @internal resets the graph cache for internal testing purpose only | ||
*/ | ||
function _resetGraphCache() { | ||
graphCache.clear(); | ||
} | ||
exports._resetGraphCache = _resetGraphCache; | ||
function getTransitiveDependents(scopedPackages, packages) { | ||
function getDependentMap(packages) { | ||
const graph = getPackageGraph(packages); | ||
const pkgQueue = [...scopedPackages]; | ||
const visited = new Set(); | ||
while (pkgQueue.length > 0) { | ||
const pkg = pkgQueue.shift(); | ||
if (!visited.has(pkg)) { | ||
visited.add(pkg); | ||
for (const [from, to] of graph) { | ||
if (to === pkg) { | ||
pkgQueue.push(from); | ||
} | ||
} | ||
const map = new Map(); | ||
for (const [from, to] of graph) { | ||
if (!map.has(to)) { | ||
map.set(to, new Set()); | ||
} | ||
map.get(to).add(from); | ||
} | ||
return [...visited].filter((pkg) => !scopedPackages.includes(pkg)); | ||
return map; | ||
} | ||
exports.getTransitiveDependents = getTransitiveDependents; | ||
exports.getDependentMap = getDependentMap; | ||
function getTransitiveDependencies(scopedPackages, packages) { | ||
@@ -45,0 +32,0 @@ const graph = getPackageGraph(packages); |
@@ -8,1 +8,2 @@ export * from "./getPackageInfos"; | ||
export * from "./scope"; | ||
export * from "./graph"; |
@@ -12,1 +12,2 @@ "use strict"; | ||
__export(require("./scope")); | ||
__export(require("./graph")); |
{ | ||
"name": "workspace-tools", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "types": "lib/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30258
24
817