diff options
Diffstat (limited to 'cli/file_fetcher.rs')
-rw-r--r-- | cli/file_fetcher.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/file_fetcher.rs b/cli/file_fetcher.rs index 2d9f3c104..a5c8d3727 100644 --- a/cli/file_fetcher.rs +++ b/cli/file_fetcher.rs @@ -132,6 +132,19 @@ impl SourceFileFetcher { .ok() } + /// Save a given source file into cache. + /// Allows injection of files that normally would not present + /// in filesystem. + /// This is useful when e.g. TS compiler retrieves a custom file + /// under a dummy specifier. + pub fn save_source_file_in_cache( + &self, + specifier: &ModuleSpecifier, + file: SourceFile, + ) { + self.source_file_cache.set(specifier.to_string(), file); + } + pub async fn fetch_source_file( &self, specifier: &ModuleSpecifier, |