You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in attatchment cycletest.zip
dependencies a->b->c->d->b
Expected behavior:
show cyclic workspace dependency detail about b to b cycle
Actual behavior:
only show "WARN There are cyclic workspace dependencies " but no detail about cycle
Additional information:
getCycles function use cached visited map to skip recursive call of visit, but check cycle by compare cycle[0] === dep .
if check cycle first from a , package b to d will be added to visited map , but no cycle is found , then check from b, recursive call of visit function will be skipped at c .
function getCycles(currDepsMap, visited) {
let items = Array.from(currDepsMap.keys());
let cycles = [];
function visit(item, cycle) {
let visitedDeps = visited.get(item);
if (!visitedDeps) {
visitedDeps = [];
visited.set(item, visitedDeps);
}
let deps = currDepsMap.get(item);
if (typeof deps === "undefined")
return;
for (let dep of deps) {
if (cycle[0] === dep) {
cycles.push(cycle);
}
if (!visitedDeps.includes(dep)) {
visitedDeps.push(dep);
visit(dep, cycle.concat(dep));
}
}
}
for (let item of items) {
visit(item, [item]);
}
return cycles;
}
node -v prints: v16.15.0
Windows, macOS, or Linux?: Windows
The text was updated successfully, but these errors were encountered:
pnpm version:
7.5.0
Code to reproduce the issue:
in attatchment cycletest.zip
dependencies a->b->c->d->b
Expected behavior:
show cyclic workspace dependency detail about b to b cycle
Actual behavior:
only show "WARN There are cyclic workspace dependencies " but no detail about cycle
Additional information:
getCycles function use cached visited map to skip recursive call of visit, but check cycle by compare cycle[0] === dep .
if check cycle first from a , package b to d will be added to visited map , but no cycle is found , then check from b, recursive call of visit function will be skipped at c .
function getCycles(currDepsMap, visited) {
let items = Array.from(currDepsMap.keys());
let cycles = [];
function visit(item, cycle) {
let visitedDeps = visited.get(item);
if (!visitedDeps) {
visitedDeps = [];
visited.set(item, visitedDeps);
}
let deps = currDepsMap.get(item);
if (typeof deps === "undefined")
return;
for (let dep of deps) {
if (cycle[0] === dep) {
cycles.push(cycle);
}
if (!visitedDeps.includes(dep)) {
visitedDeps.push(dep);
visit(dep, cycle.concat(dep));
}
}
}
for (let item of items) {
visit(item, [item]);
}
return cycles;
}
node -v
prints: v16.15.0Windows, macOS, or Linux?: Windows
The text was updated successfully, but these errors were encountered: