diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-07-22 15:34:28 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-22 15:34:28 +1000 |
commit | 7d151efc683e512386e4ad95bc01259b536d28fc (patch) | |
tree | 95b2b5920f166c761400a690a6841951ae6fe693 /cli/module_graph.rs | |
parent | bdc53b45b7665b29c2980416c3681e1671989f9c (diff) |
fix(cli): info now displays type reference deps (#11478)
Fixes #11476
Diffstat (limited to 'cli/module_graph.rs')
-rw-r--r-- | cli/module_graph.rs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/cli/module_graph.rs b/cli/module_graph.rs index 8689072f0..ee359b4bc 100644 --- a/cli/module_graph.rs +++ b/cli/module_graph.rs @@ -435,17 +435,9 @@ impl Module { .entry(desc.specifier.to_string()) .or_insert_with(|| Dependency::new(location)); dep.is_dynamic = desc.is_dynamic; - if let Some(specifier) = maybe_specifier { - if desc.kind == swc_ecmascript::dep_graph::DependencyKind::ExportType - || desc.kind == swc_ecmascript::dep_graph::DependencyKind::ImportType - { - dep.maybe_type = Some(specifier); - } else { - dep.maybe_code = Some(specifier); - } - } - // If the dependency wasn't a type only dependency already, and there is - // a `@deno-types` comment, then we will set the `maybe_type` dependency. + dep.maybe_code = maybe_specifier; + // If there is a `@deno-types` pragma, we will add it to the dependency + // if one doesn't already exist. if maybe_type.is_some() && dep.maybe_type.is_none() { dep.maybe_type = maybe_type; } @@ -1475,9 +1467,19 @@ impl Graph { } else { (None, None) }; + let maybe_type_dependency = + module.maybe_types.clone().map(|(specifier, _type)| { + info::ModuleGraphInfoDep { + specifier, + is_dynamic: false, + maybe_code: None, + maybe_type: Some(_type), + } + }); Some(info::ModuleGraphInfoMod { specifier: sp.clone(), dependencies, + maybe_type_dependency, size: Some(module.size()), media_type: Some(module.media_type), local: Some(module.source_path.clone()), |