summaryrefslogtreecommitdiff
path: root/cli/module_graph.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/module_graph.rs')
-rw-r--r--cli/module_graph.rs24
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()),