Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
2b6a00d
fix: scope codegraph batch complexity targets to file paths
carlos-alm Jul 5, 2026
b28051a
fix: exclude parameters and interface/type members from dead-role cla…
carlos-alm Jul 5, 2026
17fbcba
fix: credit import-type usages as exports consumers
carlos-alm Jul 5, 2026
26918bb
fix: prevent fn-impact/query crash when -f/--file is passed
carlos-alm Jul 5, 2026
be6432c
fix: correct exported-symbol detection for literal and object-literal…
carlos-alm Jul 5, 2026
4ead840
fix: exclude primitive type keywords from ast --kind string matching
carlos-alm Jul 5, 2026
f6326bf
fix: resolve call edges through renamed import specifiers
carlos-alm Jul 5, 2026
590f560
fix: couple file_hashes updates with edge regeneration in incremental…
carlos-alm Jul 5, 2026
d3ea4a4
fix: compare signature-change diffs using new-file line ranges
carlos-alm Jul 5, 2026
c306812
feat: add environment doctor check for stale native binary and missin…
carlos-alm Jul 5, 2026
8bb5893
fix: eliminate non-deterministic ordering in community detection
carlos-alm Jul 6, 2026
46037b1
fix: sync update-graph.sh hook extension allowlist with EXTENSIONS
carlos-alm Jul 6, 2026
6a84cf9
fix: recompute directory structure metrics for affected directories o…
carlos-alm Jul 6, 2026
8d936d1
refactor: register hardcoded execFileSync/execSync maxBuffer values i…
carlos-alm Jul 6, 2026
11c84be
fix: gate blast-radius check on newly introduced risk, not pre-existi…
carlos-alm Jul 6, 2026
963301a
fix: gate identifier-argument dynamic call edges on callback-acceptin…
carlos-alm Jul 6, 2026
3e8035d
fix: gate Array.from's callback arg by position, not just callee name
carlos-alm Jul 6, 2026
879635e
fix: scope reexportedSymbols to actually-named re-export specifiers
carlos-alm Jul 6, 2026
0fe9fc3
fix: stop CFG block/edge count from overriding AST-derived cyclomatic…
carlos-alm Jul 6, 2026
ccf3c19
fix: backfill edges.technique for incrementally-inserted calls edges
carlos-alm Jul 6, 2026
d5b1162
fix: wrap remote embedding JSON parse failure in EngineError
carlos-alm Jul 6, 2026
8971017
refactor: extract shared platform-default-path helper in config.ts
carlos-alm Jul 6, 2026
056c5e4
refactor: decompose loadConfig and related high-effort functions in c…
carlos-alm Jul 6, 2026
0738171
refactor: decompose findDbPath and openRepo in db/connection.ts (docs…
carlos-alm Jul 6, 2026
6f2423c
refactor: dedupe busy/locked error detection into isBusyOrLockedError
carlos-alm Jul 6, 2026
4c02378
fix: log statSync failures in findDbPath instead of silently swallowi…
carlos-alm Jul 6, 2026
0698e16
test: add direct unit coverage for closeDbPair/closeDbPairDeferred/cl…
carlos-alm Jul 6, 2026
4ac3b99
fix: correct blast-radius/fn-impact computation for line-shifted decl…
carlos-alm Jul 6, 2026
6767f09
feat: wire points-to solver max-iterations cap through DEFAULTS.analy…
carlos-alm Jul 6, 2026
5f6f30a
refactor: route console.log calls in domain/search through logger
carlos-alm Jul 6, 2026
b479318
refactor: reduce cyclomatic complexity of computeDeltaModularityDirected
carlos-alm Jul 6, 2026
c39ac40
refactor: unify impact-level rendering format between audit and fn-im…
carlos-alm Jul 6, 2026
067674f
refactor: dedupe computeSavings via pct helper and persist partial to…
carlos-alm Jul 6, 2026
f6807b4
fix: add main.rs driver to rust dynamic tracer fixture
carlos-alm Jul 6, 2026
1c07a54
fix: scope diff file-header detection to between-hunk positions
carlos-alm Jul 6, 2026
bf82aa2
fix: update titan-grind's dead-symbol script for current roles --json…
carlos-alm Jul 6, 2026
cd02d27
fix: thread configured busyTimeoutMs through remaining read-only quer…
carlos-alm Jul 6, 2026
980b5dc
fix: resolve computed string-literal keys in object-literal extractio…
carlos-alm Jul 6, 2026
4a873a3
fix: add same-class bare-call fallback to incremental rebuild path (d…
carlos-alm Jul 6, 2026
8f3348a
fix: unify Object.defineProperty accessor fallback kind-filtering bet…
carlos-alm Jul 6, 2026
acf804c
refactor: share chunked statement-cache primitive between builder and…
carlos-alm Jul 6, 2026
986c851
refactor: cache prepared statements in applyEdgeTechniquesAfterNative…
carlos-alm Jul 6, 2026
71e9174
fix: replace fixed-depth directory-proximity check with symmetric dis…
carlos-alm Jul 6, 2026
d2935cc
refactor: remove unreachable Partition delta-computation interface me…
carlos-alm Jul 6, 2026
6515186
fix: emit reference edges for function identifiers used as object-lit…
carlos-alm Jul 6, 2026
30c491a
refactor: unify call-ref and tests rendering format between audit and…
carlos-alm Jul 6, 2026
9db911b
fix: classify destructured bindings as constant, not function (docs c…
carlos-alm Jul 6, 2026
70559fc
refactor: adopt timeMedian in remaining benchmark timing loops
carlos-alm Jul 6, 2026
822e0eb
refactor: decompose runPerfBenchmarks in token-benchmark.ts
carlos-alm Jul 6, 2026
fcdfe7d
fix: attribute liveness to Lua functions assigned to global/builtin i…
carlos-alm Jul 6, 2026
ee6362c
refactor: extract shared sedi() helper for tracer scripts
carlos-alm Jul 6, 2026
d4e6212
fix: restore reflection dynamicKind for .call/.apply/.bind (docs chec…
carlos-alm Jul 6, 2026
aec5d2b
fix: restrict entry-role classification to function/method-kind symbo…
carlos-alm Jul 6, 2026
d250f8d
fix: credit destructured dynamic import() bindings as exports consumers
carlos-alm Jul 6, 2026
75978e2
fix: recognize Lua function nodes in complexity metrics computation (…
carlos-alm Jul 6, 2026
af17b6d
fix: scope global call-resolution fallback to same-language candidate…
carlos-alm Jul 6, 2026
dd447bc
fix: credit instanceof ClassName checks as exports consumers
carlos-alm Jul 6, 2026
a79a8a1
fix: update automated-review workflow to use current claude-code-acti…
carlos-alm Jul 6, 2026
d84f6b5
refactor: widen outputResult signature, remove redundant casts at cal…
carlos-alm Jul 6, 2026
e7a2255
fix: port Leiden algorithm to native Rust for cross-engine community-…
carlos-alm Jul 7, 2026
b54972a
feat: detect exported-symbol loss from full file deletion in checkNoS…
carlos-alm Jul 7, 2026
1821a8b
fix(complexity): scope summary stats to file/target/kind filters
carlos-alm Jul 7, 2026
d45aba7
fix(extractors): label property_signature interface/type members as k…
carlos-alm Jul 7, 2026
69d8a6f
fix(roles): exclude genuine class/struct properties from dead-role cl…
carlos-alm Jul 7, 2026
db08219
fix(resolver): scope extends/implements edges to same-file/import/lan…
carlos-alm Jul 7, 2026
79cd761
fix: track inline per-specifier type-only import modifier
carlos-alm Jul 7, 2026
cbfa954
fix(native): widen NativeRepository file filters to accept string[]
carlos-alm Jul 7, 2026
c0e7eae
fix(native): remove unused source param from get_first_call_arg
carlos-alm Jul 7, 2026
2dabe21
fix(extractors): align native/WASM definitions order for object-liter…
carlos-alm Jul 7, 2026
b1eb9af
fix(extractors): capture top-level const definitions regardless of in…
carlos-alm Jul 7, 2026
4a1e279
fix: exclude PHP scalar type-hint/cast keywords from ast --kind string
carlos-alm Jul 7, 2026
40b5e24
fix: track barrel re-export renames (export { X as Y } from ...)
carlos-alm Jul 7, 2026
1506896
fix: record local alias for dynamic import() destructuring renames
carlos-alm Jul 7, 2026
2dfd6bc
fix: resolve renamed-import receiver calls in qualified-method lookup
carlos-alm Jul 7, 2026
ccea0cb
fix(native): propagate edge/node write failures out of run_pipeline
carlos-alm Jul 7, 2026
93ccfa3
fix(exports): discriminate file-level from symbol-level consumer entries
carlos-alm Jul 7, 2026
e105c26
docs: refresh CONTRIBUTING.md for TypeScript architecture and current…
carlos-alm Jul 7, 2026
5d99bf0
fix(exports): credit plain imports of TypeScript interfaces/type aliases
carlos-alm Jul 7, 2026
e0ab9dc
fix(hooks): point update-graph.sh fallback build path at dist/cli.js
carlos-alm Jul 7, 2026
730b49b
fix(hooks): resolve track-edits.sh's PROJECT_DIR from the edited file…
carlos-alm Jul 7, 2026
0d7e8e6
fix: capture removed files' cross-directory neighbors before purge
carlos-alm Jul 7, 2026
c5b9a34
docs: fix stale codegraph check flag names in recommended-practices.md
carlos-alm Jul 7, 2026
2de6550
fix(cycles): classify cycles whose only closing edges are speculative
carlos-alm Jul 7, 2026
e5fe754
fix(resolver): recognize identifier args to user-defined higher-order…
carlos-alm Jul 8, 2026
4eef28e
fix(native): scope barrel-only import skipping to transient barrel re…
carlos-alm Jul 8, 2026
4090355
refactor(ast-analysis): extract shared CFG/complexity result-merging …
carlos-alm Jul 8, 2026
bf8e969
fix(incremental): port CHA/RTA dispatch, points-to, and dynamic-sink …
carlos-alm Jul 8, 2026
51b9e23
fix(config): derive ENV_LLM_KEYS from ENV_LLM_MAP to prevent drift
carlos-alm Jul 8, 2026
a62bab7
fix(resolver): resolveByGlobal picks the single best match, not every…
carlos-alm Jul 8, 2026
8f52d28
fix(embed): resolve default DB path from positional dir, not cwd
carlos-alm Jul 8, 2026
59220a5
refactor(leiden): extract makePartition's inline getters to cut cyclo…
carlos-alm Jul 8, 2026
2e1aa11
docs: regenerate stale audit/diff-impact example output blocks
carlos-alm Jul 8, 2026
3d436ca
fix(rust): resolve self.field, unit-struct, and constructor-typed locals
carlos-alm Jul 8, 2026
668451c
docs: add missing titan-grind mirror to claude-code-skills examples
carlos-alm Jul 8, 2026
4bccd4b
fix(scripts): migrate ts-resolve-loader.js off deprecated module.regi…
carlos-alm Jul 8, 2026
25ba42f
fix(native): recover renamed import names in the FFI hybrid import-ed…
carlos-alm Jul 8, 2026
10e61d3
fix: resolve merge conflicts with main
carlos-alm Jul 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 156 additions & 26 deletions crates/codegraph-core/src/domain/graph/builder/stages/build_edges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::collections::{HashMap, HashSet};
use napi_derive::napi;

use crate::domain::graph::builder::barrel_resolution::{self, BarrelContext, ReexportRef};
use crate::domain::graph::builder::stages::import_edges::{import_name_pairs, ImportNameSource};
use crate::domain::graph::resolve;
use crate::types::{
ArrayCallbackBinding, ArrayElemBinding, FnRefBinding, ForOfBinding, ObjectPropBinding,
Expand Down Expand Up @@ -1536,6 +1537,28 @@ pub struct ImportInfo {
/// by `type_only`, #1813).
#[napi(js_name = "typeOnlyNames")]
pub type_only_names: Vec<String>,
/// `{ local, imported }` pairs for `import { X as Y }` specifiers —
/// mirrors `Import.renamedImports` (#1730). Without this, symbol-level
/// lookups in `emit_named_symbol_edges`/`emit_barrel_through_edges` would
/// search the target file for the local (post-rename) name instead of
/// the name actually declared there, silently failing to find it (#1847).
#[napi(js_name = "renamedImports")]
pub renamed_imports: Vec<RenamedImport>,
}

impl ImportNameSource for ImportInfo {
fn names(&self) -> &[String] {
&self.names
}
fn renamed_imports(&self) -> &[RenamedImport] {
&self.renamed_imports
}
fn is_type_only(&self) -> bool {
self.type_only
}
fn type_only_names(&self) -> &[String] {
&self.type_only_names
}
}

#[napi(object)]
Expand Down Expand Up @@ -1721,17 +1744,6 @@ pub fn build_import_edges(

// ── build_import_edges helpers ──────────────────────────────────────────

/// Strip a `"* as "` / `"*\tas "` prefix from an import name so the bare
/// symbol can be looked up against the target's exports. JS equivalent:
/// `name.replace(/^\*\s+as\s+/, '')`.
fn strip_star_as_prefix(name: &str) -> &str {
if name.starts_with("* as ") || name.starts_with("*\tas ") {
&name[5..]
} else {
name
}
}

/// Classify an import into its edge kind: reexports / imports-type /
/// dynamic-imports / imports. Mirrors the JS classifier in `build-edges.ts`.
fn classify_import_edge_kind(imp: &ImportInfo) -> &'static str {
Expand Down Expand Up @@ -1780,17 +1792,20 @@ fn is_wildcard_reexport(imp: &ImportInfo) -> bool {
/// `type` keyword) is the only consumption signal `codegraph exports` can
/// observe for them (#1833).
///
/// `imp.names` holds the *original* declaration name for export specifiers
/// (see `extractImportNames` in the JS extractor) even when renamed
/// externally, so this naturally resolves `export { X as Z }` against `X`'s
/// own node — the emitted edge (and downstream `reexportedSymbols` entry)
/// is reported under the symbol's own declared name, not the barrel alias.
/// Looks up each specifier's *original* declared name via `import_name_pairs`
/// rather than the local (possibly renamed) binding — for `export { X as Z }`
/// this is already `X` (`imp.names` holds the original for export
/// specifiers), but for a renamed value/type import (`import type { X as Y }`)
/// the original name only exists in `imp.renamed_imports`; searching under the
/// local alias `Y` would never find a match in the target file (#1847). The
/// emitted edge (and downstream `reexportedSymbols` entry) is reported under
/// the symbol's own declared name in both cases, not the local/barrel alias.
///
/// When `resolved_path` is itself a barrel that renamed the requested name
/// further down its own reexport chain (`export { X as Y } from …`),
/// `resolve_barrel_export` reports the name actually declared in the
/// resolved file — which may differ from `clean_name` — so the lookup below
/// must use that reported name, not `clean_name`, against the barrel target
/// resolved file — which may differ from `original` — so the lookup below
/// must use that reported name, not `original`, against the barrel target
/// (#1823).
fn emit_named_symbol_edges(
edges: &mut Vec<ComputedEdge>,
Expand All @@ -1803,12 +1818,10 @@ fn emit_named_symbol_edges(
if ctx.symbol_node_map.is_empty() {
return;
}
for name in &imp.names {
let clean_name = strip_star_as_prefix(name);
let type_only = imp.type_only || imp.type_only_names.iter().any(|n| n == clean_name);
for (_local, original, type_only) in import_name_pairs(imp) {
let barrel_target = if ctx.barrel_set.contains(resolved_path) {
let mut visited = HashSet::new();
barrel_resolution::resolve_barrel_export(ctx, resolved_path, clean_name, &mut visited)
barrel_resolution::resolve_barrel_export(ctx, resolved_path, &original, &mut visited)
} else {
None
};
Expand All @@ -1820,7 +1833,7 @@ fn emit_named_symbol_edges(
{
(resolved.name.clone(), resolved.file.clone())
}
_ => (clean_name.to_string(), resolved_path.to_string()),
_ => (original, resolved_path.to_string()),
};
let Some((id, sym_kind)) = ctx.symbol_node_map.get(&(target_name, target_file.clone()))
else {
Expand Down Expand Up @@ -1864,13 +1877,12 @@ fn emit_barrel_through_edges(
_ => "imports",
};
let mut resolved_sources: HashSet<String> = HashSet::new();
for name in &imp.names {
let clean_name = strip_star_as_prefix(name);
for (_local, original, _type_only) in import_name_pairs(imp) {
let mut visited = HashSet::new();
let actual = barrel_resolution::resolve_barrel_export(
ctx,
resolved_path,
clean_name,
&original,
&mut visited,
);
let actual_source = match actual {
Expand Down Expand Up @@ -1968,6 +1980,7 @@ mod import_edge_tests {
dynamic_import: dynamic,
wildcard_reexport: false,
type_only_names: vec![],
renamed_imports: vec![],
}
}

Expand All @@ -1986,6 +1999,35 @@ mod import_edge_tests {
dynamic_import: false,
wildcard_reexport: false,
type_only_names: type_only_names.into_iter().map(|s| s.to_string()).collect(),
renamed_imports: vec![],
}
}

/// A renamed import (`import { X as Y } from 'src'`, optionally `import
/// type`) — `names` carries the local (post-rename) binding `Y`, and
/// `renamed_imports` maps it back to the original declared name `X`
/// (#1730, #1847).
fn make_import_with_renames(
source: &str,
names: Vec<&str>,
renames: Vec<(&str, &str)>,
type_only: bool,
) -> ImportInfo {
ImportInfo {
source: source.to_string(),
names: names.into_iter().map(|s| s.to_string()).collect(),
reexport: false,
type_only,
dynamic_import: false,
wildcard_reexport: false,
type_only_names: vec![],
renamed_imports: renames
.into_iter()
.map(|(local, imported)| RenamedImport {
local: local.to_string(),
imported: imported.to_string(),
})
.collect(),
}
}

Expand Down Expand Up @@ -2082,6 +2124,7 @@ mod import_edge_tests {
dynamic_import: false,
wildcard_reexport: true,
type_only_names: vec![],
renamed_imports: vec![],
},
], vec![])];
let resolved = vec![make_resolved("/root/src/index.ts", "./utils", "src/utils.ts")];
Expand Down Expand Up @@ -2128,6 +2171,7 @@ mod import_edge_tests {
dynamic_import: false,
wildcard_reexport: true,
type_only_names: vec![],
renamed_imports: vec![],
},
], vec![])];
let resolved = vec![make_resolved("/root/src/index.ts", "./utils", "src/utils.ts")];
Expand Down Expand Up @@ -2215,6 +2259,92 @@ mod import_edge_tests {
assert_eq!(edges[0].kind, "imports-type");
}

#[test]
fn renamed_type_import_resolves_original_name() {
// `import type { Config as CfgType } from './types'` — `names` holds
// the local alias "CfgType", but `Config` is the name actually
// declared in types.ts. The symbol-level `imports-type` edge must
// resolve against Config's own node, not fail to find "CfgType"
// there (#1847).
let files = vec![make_file("src/app.ts", 1, vec![
make_import_with_renames("./types", vec!["CfgType"], vec![("CfgType", "Config")], true),
], vec![])];
let resolved = vec![make_resolved("/root/src/app.ts", "./types", "src/types.ts")];
let node_ids = vec![make_node_entry("src/app.ts", 1), make_node_entry("src/types.ts", 2)];
let symbol_nodes = vec![SymbolNodeEntry {
name: "Config".to_string(),
file: "src/types.ts".to_string(),
node_id: 77,
kind: "interface".to_string(),
}];

let edges = build_import_edges(
files,
resolved,
vec![],
node_ids,
vec![],
"/root".to_string(),
Some(symbol_nodes),
);
assert_eq!(edges.len(), 2);
assert_eq!(edges[0].kind, "imports-type");
assert_eq!(edges[0].target_id, 2);
assert_eq!(edges[1].kind, "imports-type");
assert_eq!(edges[1].target_id, 77);
}

#[test]
fn renamed_import_through_barrel_resolves_original_name() {
// `import { Config as CfgType } from './barrel'` where './barrel'
// does `export { Config } from './types'`. Barrel-through resolution
// must look up "Config" (the original name) in the barrel's own
// export map, not the local alias "CfgType", which only exists in
// app.ts (#1847).
let files = vec![
make_file("src/app.ts", 1, vec![
make_import_with_renames("./barrel", vec!["CfgType"], vec![("CfgType", "Config")], false),
], vec![]),
make_file("src/barrel.ts", 10, vec![], vec![]),
make_file("src/types.ts", 20, vec![], vec!["Config"]),
];
let resolved = vec![make_resolved("/root/src/app.ts", "./barrel", "src/barrel.ts")];
let reexports = vec![FileReexports {
file: "src/barrel.ts".to_string(),
reexports: vec![ReexportEntryInput {
source: "src/types.ts".to_string(),
names: vec!["Config".to_string()],
wildcard_reexport: false,
renames: None,
}],
}];
let node_ids = vec![
make_node_entry("src/app.ts", 1),
make_node_entry("src/barrel.ts", 10),
make_node_entry("src/types.ts", 20),
];
let barrels = vec!["src/barrel.ts".to_string()];

let edges = build_import_edges(
files,
resolved,
reexports,
node_ids,
barrels,
"/root".to_string(),
None,
);
assert_eq!(edges.len(), 2);
// First: direct import to the barrel.
assert_eq!(edges[0].kind, "imports");
assert_eq!(edges[0].target_id, 10);
// Second: barrel-through to the actual source (types.ts), resolved
// via the original name "Config", not the local alias "CfgType".
assert_eq!(edges[1].kind, "imports");
assert_eq!(edges[1].target_id, 20);
assert_eq!(edges[1].confidence, 0.9);
}

#[test]
fn mixed_import_inline_type_modifier_credits_only_flagged_name() {
// `import { value, type Foo } from './mixed'` — only `Foo` carries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,35 @@ impl BarrelContext for ImportEdgeContext {
}
}

/// Adapter over the two distinct "import statement" Rust representations in
/// this crate that [`import_name_pairs`] needs to read from: the native
/// orchestrator's own parsed `crate::types::Import`, and the FFI-facing
/// `ImportInfo` wire struct the hybrid native path (`build_edges.rs`)
/// deserializes from JS. Both mirror TS `Import` — this trait exists only so
/// `import_name_pairs` has one implementation instead of being duplicated
/// per Rust type, since the two structs differ in `Option` wrapping.
pub(crate) trait ImportNameSource {
fn names(&self) -> &[String];
fn renamed_imports(&self) -> &[RenamedImport];
fn is_type_only(&self) -> bool;
fn type_only_names(&self) -> &[String];
}

impl ImportNameSource for crate::types::Import {
fn names(&self) -> &[String] {
&self.names
}
fn renamed_imports(&self) -> &[RenamedImport] {
self.renamed_imports.as_deref().unwrap_or(&[])
}
fn is_type_only(&self) -> bool {
self.type_only.unwrap_or(false)
}
fn type_only_names(&self) -> &[String] {
self.type_only_names.as_deref().unwrap_or(&[])
}
}

/// Pairs each locally-bound name from an import statement with its original
/// (pre-rename) exported name — identical to the local name unless the
/// specifier renames a binding (`import { X as Y }`). Barrel tracing and
Expand All @@ -131,23 +160,20 @@ impl BarrelContext for ImportEdgeContext {
/// either because the whole statement is (`import type { X }`) or because
/// this specific specifier carries the inline modifier
/// (`import { type X }`, #1813).
pub(crate) fn import_name_pairs(imp: &crate::types::Import) -> Vec<(String, String, bool)> {
pub(crate) fn import_name_pairs<T: ImportNameSource>(imp: &T) -> Vec<(String, String, bool)> {
let mut original_name_for: HashMap<&str, &str> = HashMap::new();
if let Some(renamed) = &imp.renamed_imports {
for r in renamed {
original_name_for.insert(&r.local, &r.imported);
}
for r in imp.renamed_imports() {
original_name_for.insert(&r.local, &r.imported);
}
let statement_type_only = imp.type_only.unwrap_or(false);
let type_only_names: HashSet<&str> = imp
.type_only_names
.as_ref()
.map(|v| v.iter().map(|s| s.as_str()).collect())
.unwrap_or_default();
imp.names
let statement_type_only = imp.is_type_only();
let type_only_names: HashSet<&str> = imp.type_only_names().iter().map(|s| s.as_str()).collect();
imp.names()
.iter()
.map(|name| {
let local = name.strip_prefix("* as ").unwrap_or(name);
let local = name
.strip_prefix("* as ")
.or_else(|| name.strip_prefix("*\tas "))
.unwrap_or(name);
let original = original_name_for.get(local).copied().unwrap_or(local);
let type_only = statement_type_only || type_only_names.contains(local);
(local.to_string(), original.to_string(), type_only)
Expand Down
9 changes: 9 additions & 0 deletions src/domain/graph/builder/stages/build-edges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,14 @@ interface NativeImportInfo {
wildcardReexport: boolean;
/** Local names (subset of `names`) marked type-only via inline `type`/`typeof` modifier (#1813). */
typeOnlyNames: string[];
/**
* `{ local, imported }` pairs for `import { X as Y }` specifiers — mirrors
* `Import.renamedImports` (#1730). Without this, the native `emit_named_symbol_edges`/
* `emit_barrel_through_edges` FFI handlers would search the target file for
* the local (post-rename) name instead of the name actually declared
* there, silently dropping the edge for a renamed import (#1847).
*/
renamedImports: Array<{ local: string; imported: string }>;
}

/** Native FFI input shape for a single file. */
Expand Down Expand Up @@ -384,6 +392,7 @@ function toNativeImportInfo(imp: Import): NativeImportInfo {
dynamicImport: !!imp.dynamicImport,
wildcardReexport: !!imp.wildcardReexport,
typeOnlyNames: imp.typeOnlyNames ?? [],
renamedImports: imp.renamedImports ?? [],
};
}

Expand Down
Loading