File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,11 @@ async function buildGraph(
75
75
pkgName : string ,
76
76
eventLoopSpinner : EventLoopSpinner ,
77
77
isRoot = false ,
78
+ memoizationMap : Map < DepTree , string > = new Map ( ) ,
78
79
) : Promise < string > {
80
+ if ( memoizationMap . has ( depTree ) ) {
81
+ return memoizationMap . get ( depTree ) ! ;
82
+ }
79
83
const getNodeId = (
80
84
name : string ,
81
85
version : string | undefined ,
@@ -103,6 +107,8 @@ async function buildGraph(
103
107
dep ,
104
108
depName ,
105
109
eventLoopSpinner ,
110
+ false ,
111
+ memoizationMap ,
106
112
) ;
107
113
108
114
const depPkg : types . PkgInfo = {
@@ -160,6 +166,7 @@ async function buildGraph(
160
166
if ( depNodesIds . length > 0 && eventLoopSpinner . isStarving ( ) ) {
161
167
await eventLoopSpinner . spin ( ) ;
162
168
}
169
+ memoizationMap . set ( depTree , treeHash ) ;
163
170
return treeHash ;
164
171
}
165
172
You can’t perform that action at this time.
0 commit comments