1mod auto_imports;
19mod dynamic_imports;
20pub(crate) mod fallbacks;
21pub(crate) mod inline_loaders;
22mod jsx_runtime;
23mod memo;
24mod output_entry;
25mod path_info;
26mod re_exports;
27mod react_native;
28mod require_imports;
29mod specifier;
30mod static_imports;
31#[cfg(test)]
32mod tests;
33mod types;
34mod upgrades;
35mod work;
36
37pub use auto_imports::{UnreadableAutoImportRead, unreadable_auto_import_reads};
38pub use fallbacks::extract_package_name_from_node_modules_path;
39pub use inline_loaders::InlineLoaderRequest;
40pub use output_entry::{directory_index_entry, output_entry_to_source_path};
41pub use path_info::{
42 extract_package_name, is_bare_specifier, is_path_alias, is_valid_package_name,
43 normalize_npm_specifier,
44};
45pub use react_native::{PlatformFamilyKey, has_react_native_plugin, platform_family_key};
46pub use types::{
47 MISSING_ONLY_OUTPUT_DIRS, MissingExportTarget, OUTPUT_DIRS, ResolveResult, ResolvedImport,
48 ResolvedModule, ResolvedProject, ResolvedReExport, ResolvedReplacedModuleTarget,
49 ResolvedSourceEdge,
50};
51pub use work::ResolveWork;
52
53use std::sync::Arc;
54
55use std::path::{Path, PathBuf};
56use std::sync::Mutex;
57
58use rayon::prelude::*;
59use rustc_hash::{FxHashMap, FxHashSet};
60
61use fallow_config::{AutoImportKind, AutoImportRule, JsxImportSourceRule};
62use fallow_types::discover::{DiscoveredFile, FileId};
63use fallow_types::extract::{ImportInfo, ImportedName, ModuleInfo, SemanticFact};
64use oxc_span::Span;
65
66use auto_imports::synthesize_auto_import_edges;
67use dynamic_imports::{GlobMatcherCache, resolve_dynamic_imports, resolve_dynamic_patterns};
68use jsx_runtime::resolve_config_jsx_runtime_imports;
69pub use jsx_runtime::{CompiledJsxRule, compile_jsx_rules};
70use re_exports::resolve_re_exports;
71use react_native::{build_condition_names, build_extensions, synthesize_platform_family_edges};
72use require_imports::resolve_require_imports;
73use specifier::{build_resolve_options, create_resolver};
74use static_imports::resolve_static_imports;
75use types::{DenoImportMapEntry, PackageManifestInfo, ResolveContext};
76use upgrades::{ResolvedVitestMockOperation, apply_specifier_upgrades};
77
78pub struct ResolveAllImportsInput<'a> {
80 pub modules: &'a [ModuleInfo],
82 pub files: &'a [DiscoveredFile],
84 pub workspaces: &'a [fallow_config::WorkspaceInfo],
86 pub active_plugins: &'a [String],
88 pub path_aliases: &'a [(String, String)],
90 pub auto_imports: &'a [AutoImportRule],
92 pub jsx_import_sources: &'a [JsxImportSourceRule],
95 pub scss_include_paths: &'a [PathBuf],
97 pub static_dir_mappings: &'a [(PathBuf, String)],
99 pub framework_static_dir_mappings: &'a [(PathBuf, String)],
101 pub root: &'a Path,
103 pub extra_conditions: &'a [String],
105}
106
107pub struct ResolverSession {
118 resolver: oxc_resolver::Resolver,
119 script_resolver: oxc_resolver::Resolver,
120 style_resolver: oxc_resolver::Resolver,
121 extensions: Vec<String>,
122 condition_names: Vec<String>,
123 package_manifests: Vec<PackageManifestInfo>,
124 has_deno_import_maps: bool,
125 canonical_ws_roots: Vec<PathBuf>,
126 root_is_canonical: bool,
127}
128
129impl ResolverSession {
130 #[must_use]
138 pub fn new(input: &ResolveAllImportsInput<'_>) -> Self {
139 let canonical_ws_roots: Vec<PathBuf> = input
140 .workspaces
141 .par_iter()
142 .map(|ws| dunce::canonicalize(&ws.root).unwrap_or_else(|_| ws.root.clone()))
143 .collect();
144 let package_manifests = build_package_manifests(input, &canonical_ws_roots);
145 let has_deno_import_maps = package_manifests
146 .iter()
147 .any(|manifest| !manifest.deno_import_map.is_empty());
148 let root_is_canonical = dunce::canonicalize(input.root).is_ok_and(|c| c == input.root);
149
150 let extensions = build_extensions(input.active_plugins);
151 let condition_names = build_condition_names(input.active_plugins, input.extra_conditions);
152 let resolver = create_resolver(input.root, input.active_plugins, input.extra_conditions);
153 let script_resolver = specifier::create_script_resolver(&resolver);
154 let mut style_conditions = input.extra_conditions.to_vec();
155 style_conditions.push("sass".to_string());
156 style_conditions.push("style".to_string());
157 let style_resolver = resolver.clone_with_options(build_resolve_options(
160 input.root,
161 input.active_plugins,
162 &style_conditions,
163 ));
164
165 Self {
166 resolver,
167 script_resolver,
168 style_resolver,
169 extensions,
170 condition_names,
171 package_manifests,
172 has_deno_import_maps,
173 canonical_ws_roots,
174 root_is_canonical,
175 }
176 }
177}
178
179#[must_use]
181pub fn resolve_all_imports(input: &ResolveAllImportsInput<'_>) -> ResolvedProject {
182 let session = ResolverSession::new(input);
183 resolve_all_imports_with_session(input, &session)
184}
185
186#[must_use]
194pub fn resolve_all_imports_with_session(
195 input: &ResolveAllImportsInput<'_>,
196 session: &ResolverSession,
197) -> ResolvedProject {
198 let root_is_canonical = session.root_is_canonical;
199 let workspace_roots = build_workspace_roots(input.workspaces, &session.canonical_ws_roots);
200 let canonical_paths = build_canonical_file_paths(input.files, root_is_canonical);
201 let mut work = ResolveWork {
202 canonicalize_calls: canonical_paths.len() as u64,
203 ..ResolveWork::default()
204 };
205 let path_to_id = build_path_to_id(input.files, &canonical_paths, root_is_canonical);
206 let raw_path_to_id: FxHashMap<&Path, FileId> = input
207 .files
208 .iter()
209 .map(|f| (f.path.as_path(), f.id))
210 .collect();
211
212 let file_paths: Vec<&Path> = input.files.iter().map(|f| f.path.as_path()).collect();
213
214 let canonical_fallback = if root_is_canonical {
215 Some(types::CanonicalFallback::new(input.files))
216 } else {
217 None
218 };
219
220 let tsconfig_warned: Mutex<FxHashSet<String>> = Mutex::new(FxHashSet::default());
221 let tsconfig_cache = types::TsconfigCache::default();
222 let canonicalize_cache = types::CanonicalizeCache::default();
223 let glob_matcher_cache = GlobMatcherCache::default();
224 let pattern_root = if canonical_paths.is_empty() {
228 input.root.to_path_buf()
229 } else {
230 dunce::canonicalize(input.root).unwrap_or_else(|_| input.root.to_path_buf())
231 };
232 let jsx_rules = compile_jsx_rules(input.jsx_import_sources);
233
234 let ctx = ResolveContext {
235 resolver: &session.resolver,
236 script_resolver: &session.script_resolver,
237 style_resolver: &session.style_resolver,
238 extensions: &session.extensions,
239 path_to_id: &path_to_id,
240 raw_path_to_id: &raw_path_to_id,
241 workspace_roots: &workspace_roots,
242 package_manifests: &session.package_manifests,
243 has_deno_import_maps: session.has_deno_import_maps,
244 condition_names: &session.condition_names,
245 path_aliases: input.path_aliases,
246 scss_include_paths: input.scss_include_paths,
247 static_dir_mappings: input.static_dir_mappings,
248 framework_static_dir_mappings: input.framework_static_dir_mappings,
249 root: input.root,
250 canonical_fallback: canonical_fallback.as_ref(),
251 tsconfig_warned: &tsconfig_warned,
252 tsconfig_cache: &tsconfig_cache,
253 canonicalize_cache: &canonicalize_cache,
254 };
255
256 let resolved_outputs: Vec<ResolvedModuleOutput> = input
257 .modules
258 .par_iter()
259 .filter_map(|module| {
260 resolve_module_imports(
261 module,
262 &ctx,
263 &ProjectResolveRules {
264 glob_matcher_cache: &glob_matcher_cache,
265 pattern_root: &pattern_root,
266 jsx_rules: &jsx_rules,
267 },
268 &file_paths,
269 &canonical_paths,
270 input.files,
271 )
272 })
273 .collect();
274 let mut resolved = Vec::with_capacity(resolved_outputs.len());
275 let mut vitest_mock_operations = Vec::new();
276 for output in resolved_outputs {
277 resolved.push(output.module);
278 vitest_mock_operations.extend(output.vitest_mock_operations);
279 work += output.work;
280 }
281 work.canonicalize_calls += canonicalize_cache.distinct_paths() as u64;
282
283 apply_specifier_upgrades(&mut resolved, &mut vitest_mock_operations);
284
285 synthesize_platform_family_edges(&mut resolved, input.files, input.active_plugins);
286
287 synthesize_auto_import_edges(
288 &mut resolved,
289 input.modules,
290 input.auto_imports,
291 &path_to_id,
292 &raw_path_to_id,
293 );
294
295 let replaced_module_targets = final_replaced_module_targets(vitest_mock_operations);
296
297 ResolvedProject {
298 modules: resolved,
299 replaced_module_targets,
300 work,
301 }
302}
303
304fn build_workspace_roots<'a>(
305 workspaces: &'a [fallow_config::WorkspaceInfo],
306 canonical_ws_roots: &'a [PathBuf],
307) -> FxHashMap<&'a str, &'a Path> {
308 workspaces
309 .iter()
310 .zip(canonical_ws_roots.iter())
311 .map(|(ws, canonical)| (ws.name.as_str(), canonical.as_path()))
312 .collect()
313}
314
315fn build_canonical_file_paths(files: &[DiscoveredFile], root_is_canonical: bool) -> Vec<PathBuf> {
316 if root_is_canonical {
317 return Vec::new();
318 }
319
320 files
321 .par_iter()
322 .map(|f| dunce::canonicalize(&f.path).unwrap_or_else(|_| f.path.clone()))
323 .collect()
324}
325
326fn build_package_manifests(
333 input: &ResolveAllImportsInput<'_>,
334 canonical_ws_roots: &[PathBuf],
335) -> Vec<PackageManifestInfo> {
336 let root_canonical =
337 dunce::canonicalize(input.root).unwrap_or_else(|_| input.root.to_path_buf());
338 let root_probe = fallow_config::probe_dir_manifest(input.root);
339 let root_import_map = merge_deno_import_maps(&[], input.root, root_probe.deno_import_map);
340 let mut package_manifests = Vec::new();
341 if let Ok(Some((_name, package_json, _deps))) = root_probe.manifest {
342 package_manifests.push(PackageManifestInfo {
343 root: input.root.to_path_buf(),
344 canonical_root: root_canonical,
345 name: package_json.name.clone(),
346 package_json,
347 deno_import_map: root_import_map.clone(),
348 });
349 }
350 for (ws, canonical_root) in input.workspaces.iter().zip(canonical_ws_roots.iter()) {
351 let ws_probe = fallow_config::probe_dir_manifest(&ws.root);
352 if let Ok(Some((_name, package_json, _deps))) = ws_probe.manifest {
353 package_manifests.push(PackageManifestInfo {
354 root: ws.root.clone(),
355 canonical_root: canonical_root.clone(),
356 name: package_json.name.clone().or_else(|| Some(ws.name.clone())),
357 package_json,
358 deno_import_map: merge_deno_import_maps(
359 &root_import_map,
360 &ws.root,
361 ws_probe.deno_import_map,
362 ),
363 });
364 }
365 }
366 package_manifests
367}
368
369fn merge_deno_import_maps(
375 inherited: &[DenoImportMapEntry],
376 package_root: &Path,
377 local: Option<(PathBuf, Vec<(String, String)>)>,
378) -> Vec<DenoImportMapEntry> {
379 let mut entries: FxHashMap<String, DenoImportMapEntry> = inherited
380 .iter()
381 .cloned()
382 .map(|entry| (entry.key.clone(), entry))
383 .collect();
384
385 if let Some((config_path, local_entries)) = local {
386 let declaring_dir = config_path.parent().unwrap_or(package_root).to_path_buf();
387 for (key, target) in local_entries {
388 entries.insert(
389 key.clone(),
390 DenoImportMapEntry {
391 key,
392 target,
393 declaring_dir: declaring_dir.clone(),
394 },
395 );
396 }
397 }
398
399 let mut entries: Vec<_> = entries.into_values().collect();
400 entries.sort_by(|a, b| a.key.cmp(&b.key));
401 entries
402}
403
404fn build_path_to_id<'a>(
407 files: &'a [DiscoveredFile],
408 canonical_paths: &'a [PathBuf],
409 root_is_canonical: bool,
410) -> FxHashMap<&'a Path, FileId> {
411 if root_is_canonical {
412 files.iter().map(|f| (f.path.as_path(), f.id)).collect()
413 } else {
414 canonical_paths
415 .iter()
416 .enumerate()
417 .map(|(idx, canonical)| (canonical.as_path(), files[idx].id))
418 .collect()
419 }
420}
421
422struct ProjectResolveRules<'a> {
424 glob_matcher_cache: &'a GlobMatcherCache,
425 pattern_root: &'a Path,
426 jsx_rules: &'a [CompiledJsxRule<'a>],
427}
428
429fn resolve_module_imports(
430 module: &ModuleInfo,
431 ctx: &ResolveContext<'_>,
432 rules: &ProjectResolveRules<'_>,
433 file_paths: &[&Path],
434 canonical_paths: &[PathBuf],
435 files: &[DiscoveredFile],
436) -> Option<ResolvedModuleOutput> {
437 let Some(file_path) = file_paths.get(module.file_id.0 as usize) else {
438 tracing::warn!(
439 file_id = module.file_id.0,
440 "Skipping module with unknown file_id during resolution"
441 );
442 return None;
443 };
444
445 let resolve = || {
446 let mut all_imports = resolve_static_imports(ctx, file_path, &module.imports);
447 all_imports.extend(resolve_config_jsx_runtime_imports(
448 ctx,
449 file_path,
450 module,
451 rules.jsx_rules,
452 ));
453 all_imports.extend(resolve_require_imports(
454 ctx,
455 file_path,
456 &module.require_calls,
457 ));
458
459 let from_dir = if canonical_paths.is_empty() {
460 file_path.parent().unwrap_or(file_path)
461 } else {
462 canonical_paths
463 .get(module.file_id.0 as usize)
464 .and_then(|p| p.parent())
465 .unwrap_or(file_path)
466 };
467
468 let vitest_mock_operations =
469 resolve_vitest_mock_operations(module.file_id, &module.semantic_facts, ctx, file_path);
470 let module = build_resolved_module(ResolvedModuleBuildInput {
471 module,
472 ctx,
473 glob_matcher_cache: rules.glob_matcher_cache,
474 pattern_root: rules.pattern_root,
475 file_path,
476 from_dir,
477 canonical_paths,
478 files,
479 all_imports,
480 });
481 (module, vitest_mock_operations)
482 };
483 let ((module, vitest_mock_operations), work) =
484 memo::in_file_scope(file_path, || work::in_module_scope(resolve));
485
486 Some(ResolvedModuleOutput {
487 module,
488 vitest_mock_operations,
489 work,
490 })
491}
492
493struct ResolvedModuleOutput {
494 module: ResolvedModule,
495 vitest_mock_operations: Vec<ResolvedVitestMockOperation>,
496 work: ResolveWork,
497}
498
499fn resolve_vitest_mock_operations(
500 source_file: FileId,
501 semantic_facts: &[SemanticFact],
502 ctx: &ResolveContext<'_>,
503 file_path: &Path,
504) -> Vec<ResolvedVitestMockOperation> {
505 let mut operations: Vec<_> = semantic_facts
506 .iter()
507 .filter_map(|fact| {
508 let SemanticFact::VitestModuleMockOperation(operation) = fact else {
509 return None;
510 };
511 Some(ResolvedVitestMockOperation {
512 source_file,
513 source_specifier: operation.source.clone(),
514 call_start: operation.call_start,
515 action: operation.action,
516 target: specifier::resolve_import_specifier(
517 ctx,
518 file_path,
519 &operation.source,
520 false,
521 ),
522 })
523 })
524 .collect();
525 operations.sort_unstable_by(|left, right| {
526 left.call_start
527 .cmp(&right.call_start)
528 .then_with(|| left.source_specifier.cmp(&right.source_specifier))
529 });
530 operations
531}
532
533fn final_replaced_module_targets(
534 mut operations: Vec<ResolvedVitestMockOperation>,
535) -> Vec<ResolvedReplacedModuleTarget> {
536 operations.sort_unstable_by(|left, right| {
537 left.source_file
538 .0
539 .cmp(&right.source_file.0)
540 .then_with(|| left.call_start.cmp(&right.call_start))
541 .then_with(|| left.source_specifier.cmp(&right.source_specifier))
542 });
543
544 let mut final_operations = FxHashMap::default();
545 for operation in operations {
546 let Some(target_file) = operation.target.internal_file_id() else {
547 continue;
548 };
549 final_operations.insert((operation.source_file, target_file), operation.action);
550 }
551
552 let mut targets: Vec<_> = final_operations
553 .into_iter()
554 .filter_map(|((source_file, target_file), action)| {
555 action
556 .replaces_original()
557 .then_some(ResolvedReplacedModuleTarget {
558 source_file,
559 target_file,
560 })
561 })
562 .collect();
563 targets.sort_unstable_by_key(|target| (target.source_file.0, target.target_file.0));
564 targets
565}
566
567struct ResolvedModuleBuildInput<'a> {
568 module: &'a ModuleInfo,
569 ctx: &'a ResolveContext<'a>,
570 glob_matcher_cache: &'a GlobMatcherCache,
571 pattern_root: &'a Path,
572 file_path: &'a Path,
573 from_dir: &'a Path,
574 canonical_paths: &'a [PathBuf],
575 files: &'a [DiscoveredFile],
576 all_imports: Vec<types::ResolvedImport>,
577}
578
579fn build_resolved_module(input: ResolvedModuleBuildInput<'_>) -> ResolvedModule {
580 let ctx = input.ctx;
581 let mut module = resolved_module_without_export_hints(input);
582 module.missing_export_targets = collect_missing_export_targets(ctx, &module);
583 module
584}
585
586fn collect_missing_export_targets(
588 ctx: &ResolveContext<'_>,
589 module: &ResolvedModule,
590) -> Vec<MissingExportTarget> {
591 let mut seen: FxHashSet<&str> = FxHashSet::default();
592 let mut targets: Vec<MissingExportTarget> = module
593 .all_resolved_source_edges()
594 .filter_map(|edge| match edge.target() {
595 ResolveResult::Unresolvable(specifier) => Some(specifier.as_str()),
596 _ => None,
597 })
598 .filter(|specifier| seen.insert(specifier))
599 .filter_map(|specifier| {
600 fallbacks::missing_package_export_paths(ctx, specifier).map(|paths| {
601 MissingExportTarget {
602 specifier: specifier.to_string(),
603 paths,
604 }
605 })
606 })
607 .collect();
608 targets.sort_unstable_by(|left, right| left.specifier.cmp(&right.specifier));
609 targets
610}
611
612fn resolved_module_without_export_hints(input: ResolvedModuleBuildInput<'_>) -> ResolvedModule {
613 ResolvedModule {
614 file_id: input.module.file_id,
615 path: input.file_path.to_path_buf(),
616 exports: Arc::clone(&input.module.exports),
617 re_exports: resolve_re_exports(input.ctx, input.file_path, &input.module.re_exports),
618 resolved_imports: input.all_imports,
619 resolved_dynamic_imports: resolve_dynamic_imports(
620 input.ctx,
621 input.file_path,
622 &input.module.dynamic_imports,
623 ),
624 resolved_dynamic_patterns: resolve_dynamic_patterns(
625 input.glob_matcher_cache,
626 input.pattern_root,
627 input.from_dir,
628 &input.module.dynamic_import_patterns,
629 input.canonical_paths,
630 input.files,
631 ),
632 member_accesses: Arc::clone(&input.module.member_accesses),
633 semantic_facts: Arc::clone(&input.module.semantic_facts),
634 whole_object_uses: Arc::clone(&input.module.whole_object_uses),
635 has_cjs_exports: input.module.has_cjs_exports,
636 has_angular_component_template_url: input.module.has_angular_component_template_url,
637 unused_import_bindings: input
638 .module
639 .unused_import_bindings
640 .iter()
641 .cloned()
642 .collect(),
643 type_referenced_import_bindings: input.module.type_referenced_import_bindings.clone(),
644 value_referenced_import_bindings: input.module.value_referenced_import_bindings.clone(),
645 namespace_object_aliases: input.module.namespace_object_aliases.clone(),
646 exported_factory_returns: Arc::clone(&input.module.exported_factory_returns),
647 exported_factory_return_object_shapes: Arc::clone(
648 &input.module.exported_factory_return_object_shapes,
649 ),
650 type_member_types: Arc::clone(&input.module.type_member_types),
651 missing_export_targets: Vec::new(),
652 }
653}
654
655fn is_auto_import_builtin(name: &str) -> bool {
656 is_js_auto_import_builtin(name)
657 || is_vue_auto_import_builtin(name)
658 || is_nuxt_auto_import_builtin(name)
659}
660
661fn is_js_auto_import_builtin(name: &str) -> bool {
662 matches!(
663 name,
664 "AbortController"
665 | "AbortSignal"
666 | "Array"
667 | "ArrayBuffer"
668 | "BigInt"
669 | "Blob"
670 | "Boolean"
671 | "Buffer"
672 | "CSS"
673 | "DOMParser"
674 | "Date"
675 | "Document"
676 | "Error"
677 | "Event"
678 | "EventTarget"
679 | "File"
680 | "FormData"
681 | "Intl"
682 | "JSON"
683 | "Map"
684 | "Math"
685 | "Number"
686 | "Object"
687 | "Promise"
688 | "Reflect"
689 | "RegExp"
690 | "Response"
691 | "Set"
692 | "String"
693 | "Symbol"
694 | "URL"
695 | "URLSearchParams"
696 | "WeakMap"
697 | "WeakSet"
698 | "Window"
699 | "alert"
700 | "clearInterval"
701 | "clearTimeout"
702 | "console"
703 | "document"
704 | "fetch"
705 | "global"
706 | "globalThis"
707 | "localStorage"
708 | "navigator"
709 | "process"
710 | "requestAnimationFrame"
711 | "sessionStorage"
712 | "setInterval"
713 | "setTimeout"
714 | "window"
715 )
716}
717
718fn is_vue_auto_import_builtin(name: &str) -> bool {
719 matches!(name, |"computed"| "customRef"
720 | "defineAsyncComponent"
721 | "defineComponent"
722 | "effectScope"
723 | "getCurrentInstance"
724 | "h"
725 | "inject"
726 | "isProxy"
727 | "isReactive"
728 | "isReadonly"
729 | "isRef"
730 | "markRaw"
731 | "nextTick"
732 | "onActivated"
733 | "onBeforeMount"
734 | "onBeforeUnmount"
735 | "onBeforeUpdate"
736 | "onDeactivated"
737 | "onErrorCaptured"
738 | "onMounted"
739 | "onRenderTracked"
740 | "onRenderTriggered"
741 | "onScopeDispose"
742 | "onServerPrefetch"
743 | "onUnmounted"
744 | "onUpdated"
745 | "provide"
746 | "reactive"
747 | "readonly"
748 | "ref"
749 | "resolveComponent"
750 | "shallowReactive"
751 | "shallowReadonly"
752 | "shallowRef"
753 | "toRaw"
754 | "toRef"
755 | "toRefs"
756 | "triggerRef"
757 | "unref"
758 | "watch"
759 | "watchEffect"
760 | "watchPostEffect"
761 | "watchSyncEffect")
762}
763
764fn is_nuxt_auto_import_builtin(name: &str) -> bool {
765 matches!(name, |"useAsyncData"| "useCookie"
766 | "useError"
767 | "useFetch"
768 | "useHead"
769 | "useLazyAsyncData"
770 | "useLazyFetch"
771 | "useNuxtApp"
772 | "useRequestEvent"
773 | "useRequestHeaders"
774 | "useRoute"
775 | "useRouter"
776 | "useRuntimeConfig"
777 | "useSeoMeta"
778 | "useState")
779}
780
781fn synthetic_auto_import_info(name: &str, kind: AutoImportKind) -> ImportInfo {
784 let imported_name = match kind {
785 AutoImportKind::Named => ImportedName::Named(name.to_string()),
786 AutoImportKind::Default | AutoImportKind::DefaultComponent => ImportedName::Default,
787 };
788 ImportInfo {
789 source: format!("<auto-import:{name}>"),
790 imported_name,
791 local_name: name.to_string(),
792 is_type_only: false,
793 is_type_only_star: false,
794 from_style: false,
795 span: Span::default(),
796 source_span: Span::default(),
797 }
798}