@@ -59,7 +59,6 @@ export function createMultiCompilerHost(fs: FS): MultiCompilerHost {
5959 traceResolution : true ,
6060 } ,
6161 bundler : {
62- // @ts -expect-error
6362 moduleResolution : ts . ModuleResolutionKind . Bundler ,
6463 module : ts . ModuleKind . ESNext ,
6564 target : ts . ScriptTarget . Latest ,
@@ -182,15 +181,22 @@ export function createMultiCompilerHost(fs: FS): MultiCompilerHost {
182181 ) ;
183182 const trace = traceCollector . read ( ) ;
184183 const moduleKey = `${ resolutionMode ?? 1 } :${ moduleName } ` ;
185- ( traceCache [ moduleResolution ] [ containingFile ] ??= { } ) [ moduleKey ] = trace ;
184+ if ( ! traceCache [ moduleResolution ] [ containingFile ] ?. [ moduleKey ] ) {
185+ ( traceCache [ moduleResolution ] [ containingFile ] ??= { } ) [ moduleKey ] = trace ;
186+ }
186187 return {
187188 resolution,
188189 trace,
189190 } ;
190191 }
191192
192- function getTrace ( moduleResolution : ResolutionOption , fromFileName : string , key : string ) : string [ ] | undefined {
193- return traceCache [ moduleResolution ] [ fromFileName ] ?. [ key ] ;
193+ function getTrace (
194+ moduleResolution : ResolutionOption ,
195+ fromFileName : string ,
196+ moduleSpecifier : string ,
197+ resolutionMode : ts . ModuleKind . ESNext | ts . ModuleKind . CommonJS
198+ ) : string [ ] | undefined {
199+ return traceCache [ moduleResolution ] [ fromFileName ] ?. [ `${ resolutionMode ?? 1 } :${ moduleSpecifier } ` ] ;
194200 }
195201
196202 function createProgram ( moduleResolution : ResolutionOption , rootNames : string [ ] ) : ts . Program {
@@ -231,6 +237,18 @@ export function createMultiCompilerHost(fs: FS): MultiCompilerHost {
231237 useCaseSensitiveFileNames,
232238 getNewLine,
233239 trace : traceCollector . trace ,
240+ resolveModuleNameLiterals ( moduleLiterals , containingFile , _redirectedReference , options , containingSourceFile ) {
241+ return moduleLiterals . map (
242+ ( literal ) =>
243+ resolveModuleName (
244+ literal . text ,
245+ containingFile ,
246+ moduleResolution ,
247+ ts . getModeForUsageLocation ( containingSourceFile , literal ) ,
248+ options . noDtsResolution
249+ ) . resolution
250+ ) ;
251+ } ,
234252 } ;
235253 }
236254
0 commit comments