summaryrefslogtreecommitdiff
path: root/cli/ops/compiler.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/ops/compiler.rs')
-rw-r--r--cli/ops/compiler.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/cli/ops/compiler.rs b/cli/ops/compiler.rs
index d2a2a1d58..2934c79ee 100644
--- a/cli/ops/compiler.rs
+++ b/cli/ops/compiler.rs
@@ -109,8 +109,20 @@ fn op_fetch_source_files(
let files = try_join_all(futures).await?;
// We want to get an array of futures that resolves to
- let v = files.into_iter().map(|file| {
+ let v = files.into_iter().map(|f| {
async {
+ // if the source file contains a `types_url` we need to replace
+ // the module with the type definition when requested by the compiler
+ let file = match f.types_url {
+ Some(types_url) => {
+ let types_specifier = ModuleSpecifier::from(types_url);
+ global_state
+ .file_fetcher
+ .fetch_source_file_async(&types_specifier, ref_specifier.clone())
+ .await?
+ }
+ _ => f,
+ };
// Special handling of Wasm files:
// compile them into JS first!
// This allows TS to do correct export types.