Skip to content

Commit bf00a76

Browse files
authored
Remove module resolution caching for now, make resolved modules available from program (#796)
1 parent 296fe51 commit bf00a76

File tree

8 files changed

+49
-488
lines changed

8 files changed

+49
-488
lines changed

cmd/tsgo/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func runMain() int {
169169

170170
currentDirectory = tspath.GetDirectoryPath(configFileName)
171171
// !!! is the working directory actually the config path?
172-
host := ts.NewCompilerHost(compilerOptions, currentDirectory, fs, defaultLibraryPath)
172+
host := ts.NewCachedFSCompilerHost(compilerOptions, currentDirectory, fs, defaultLibraryPath)
173173

174174
parseStart := time.Now()
175175
program := ts.NewProgram(ts.ProgramOptions{

internal/compiler/host.go

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/microsoft/typescript-go/internal/scanner"
88
"github.com/microsoft/typescript-go/internal/tspath"
99
"github.com/microsoft/typescript-go/internal/vfs"
10+
"github.com/microsoft/typescript-go/internal/vfs/cachedvfs"
1011
)
1112

1213
type CompilerHost interface {
@@ -32,6 +33,10 @@ type compilerHost struct {
3233
defaultLibraryPath string
3334
}
3435

36+
func NewCachedFSCompilerHost(options *core.CompilerOptions, currentDirectory string, fs vfs.FS, defaultLibraryPath string) CompilerHost {
37+
return NewCompilerHost(options, currentDirectory, cachedvfs.From(fs), defaultLibraryPath)
38+
}
39+
3540
func NewCompilerHost(options *core.CompilerOptions, currentDirectory string, fs vfs.FS, defaultLibraryPath string) CompilerHost {
3641
h := &compilerHost{}
3742
h.options = options

0 commit comments

Comments
 (0)