@@ -32,7 +32,6 @@ interface Module {
3232/** A bounded interpreter for data expressions. It never invokes a source function. */
3333export class Resolver {
3434 private readonly modules = new Map < string , Module > ( )
35- private readonly values = new WeakMap < t . Node , Map < string , Evidence & { cost : number } > > ( )
3635 private readonly evaluations = new WeakMap < t . Node , Evidence > ( )
3736 private readonly unknowns = new WeakMap < t . Node , Map < string , Evidence > > ( )
3837 private readonly opaqueValues = new Map < string , Evidence > ( )
@@ -77,7 +76,7 @@ export class Resolver {
7776 } ,
7877 } )
7978 const result = { ast, exports, stars }
80- if ( this . modules . size >= 128 ) this . modules . delete ( this . modules . keys ( ) . next ( ) . value ! )
79+ if ( this . modules . size >= 32 ) this . modules . delete ( this . modules . keys ( ) . next ( ) . value ! )
8180 this . modules . set ( file , result )
8281 return result
8382 }
@@ -729,15 +728,6 @@ export class Resolver {
729728
730729 private value ( path : NodePath , file : string , depth : number ) : Data {
731730 if ( ! path ?. node ) return null
732- const started = this . steps
733- const cacheKey = `${ depth } :${ this . tree . config . limits . resolutionSteps - started } `
734- const cached = this . values . get ( path . node ) ?. get ( cacheKey )
735- if ( cached && ! this . active . has ( path . node ) ) {
736- this . steps += cached . cost
737- for ( const file of cached . dependencies ) this . dependencies . add ( file )
738- for ( const reason of cached . unresolved ) this . unresolved . add ( reason )
739- return cached . value
740- }
741731 if (
742732 ++ this . steps > this . tree . config . limits . resolutionSteps ||
743733 depth > this . tree . config . limits . resolutionDepth
@@ -752,21 +742,7 @@ export class Resolver {
752742 this . dependencies = new Set ( [ file ] )
753743 this . unresolved = new Set ( )
754744 try {
755- const value = this . inner ( path , file , depth )
756- if ( ! [ ...this . unresolved ] . some ( ( reason ) => / c y c l e / i. test ( reason ) ) ) {
757- const entries = this . values . get ( path . node ) ?? new Map ( )
758- // Bound per-node cache variants; budget/depth are part of the key so warming
759- // a cache cannot change evidence in a later evaluation.
760- if ( entries . size < 8 )
761- entries . set ( cacheKey , {
762- value,
763- cost : this . steps - started ,
764- dependencies : [ ...this . dependencies ] ,
765- unresolved : [ ...this . unresolved ] ,
766- } )
767- this . values . set ( path . node , entries )
768- }
769- return value
745+ return this . inner ( path , file , depth )
770746 } finally {
771747 for ( const file of this . dependencies ) dependencies . add ( file )
772748 for ( const reason of this . unresolved ) unresolved . add ( reason )
0 commit comments