1use std::path::Path;
4
5use rustc_hash::FxHashSet;
6
7use crate::duplicates::DuplicationReport;
8use crate::module_graph::RetainedModuleGraph;
9
10#[expect(
11 unused_imports,
12 reason = "engine owns a copied trace implementation whose internal pub uses serve its tests"
13)]
14#[path = "trace_impl.rs"]
15mod trace_impl;
16
17pub type ClassMemberTrace = fallow_types::trace::ClassMemberTrace;
18pub type CloneTrace = fallow_types::trace::CloneTrace;
19pub type DependencyTrace = fallow_types::trace::DependencyTrace;
20pub type ExportReference = fallow_types::trace::ExportReference;
21pub type ExportTrace = fallow_types::trace::ExportTrace;
22pub type FileTrace = fallow_types::trace::FileTrace;
23pub type ImpactClosureGap = fallow_types::trace::ImpactClosureGap;
24pub type ImpactClosureTrace = fallow_types::trace::ImpactClosureTrace;
25pub type PipelineTimings = fallow_types::trace::PipelineTimings;
26pub type ReExportChain = fallow_types::trace::ReExportChain;
27pub type TracedCloneGroup = fallow_types::trace::TracedCloneGroup;
28pub type TracedExport = fallow_types::trace::TracedExport;
29pub type TracedReExport = fallow_types::trace::TracedReExport;
30
31#[must_use]
33pub fn trace_export(
34 graph: &RetainedModuleGraph,
35 root: &Path,
36 file_path: &str,
37 export_name: &str,
38) -> Option<ExportTrace> {
39 trace_impl::trace_export(graph.as_graph(), root, file_path, export_name)
40}
41
42#[must_use]
45pub fn trace_class_member(
46 graph: &RetainedModuleGraph,
47 root: &Path,
48 file_path: &str,
49 member_name: &str,
50) -> Option<ClassMemberTrace> {
51 trace_impl::trace_class_member(graph.as_graph(), root, file_path, member_name)
52}
53
54#[must_use]
56pub fn trace_file(graph: &RetainedModuleGraph, root: &Path, file_path: &str) -> Option<FileTrace> {
57 trace_impl::trace_file(graph.as_graph(), root, file_path)
58}
59
60#[must_use]
62#[expect(
63 clippy::implicit_hasher,
64 reason = "fallow standardizes on FxHashSet across the workspace"
65)]
66pub fn trace_dependency(
67 graph: &RetainedModuleGraph,
68 root: &Path,
69 package_name: &str,
70 script_used_packages: &FxHashSet<String>,
71) -> DependencyTrace {
72 trace_impl::trace_dependency(graph.as_graph(), root, package_name, script_used_packages)
73}
74
75#[must_use]
77pub fn trace_clone(
78 report: &DuplicationReport,
79 root: &Path,
80 file_path: &str,
81 line: usize,
82) -> CloneTrace {
83 trace_impl::trace_clone(report, root, file_path, line)
84}
85
86#[must_use]
88pub fn trace_clone_by_fingerprint(
89 report: &DuplicationReport,
90 root: &Path,
91 fingerprint: &str,
92) -> CloneTrace {
93 trace_impl::trace_clone_by_fingerprint(report, root, fingerprint)
94}
95
96#[must_use]
98pub fn trace_impact_closure(
99 graph: &RetainedModuleGraph,
100 root: &Path,
101 file_path: &str,
102) -> Option<ImpactClosureTrace> {
103 trace_impl::trace_impact_closure(graph.as_graph(), root, file_path)
104}