Skip to content

Commit

Permalink
Safely handle components without names (#1464)
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu authored Nov 18, 2024
1 parent d83d58a commit 4c70540
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/helpers/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,11 @@ export function printDependencyTree(
console.log(
table([[highlightStr(treeGraphics.join("\n"), highlight)]], config),
);
} else {
} else if (treeGraphics.length < 500) {
// https://github.com/nodejs/node/issues/35973
console.log(highlightStr(treeGraphics.join("\n"), highlight));
} else {
console.log("Dependency tree is too large to print.");
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/stages/postgen/annotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ function joinArray(arr) {
}

function cleanNames(s) {
return s.replace(/[+]/g, " ");
return s?.replace(/[+]/g, " ");
}

function cleanTypes(s) {
return s.replace(/[+-_]/g, " ");
return s?.replace(/[+-_]/g, " ");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion types/lib/helpers/display.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4c70540

Please sign in to comment.