TS/JS: make barrel re-export bindings queryable nodes#250
Merged
Conversation
A JS/TS barrel forwards another module's surface with
`export { X } from './mod'` (optionally `export { X as Y }`), and that is
the public API a consumer imports. Until now the extractor recorded a
re-export only as a file-level edge and minted no node for the forwarded
binding, so `find_usages("src/middleware.ts::persist")` resolved nothing —
querying the façade an agent actually imports returned a silent zero.
For each named value specifier within the cap the extractor now mints a
node at the barrel site under the exported (post-alias) name, following the
standard `<file>::<name>` id scheme, marked with a reexport flag and a
node->canonical re-export edge that resolves through the same import
machinery as the file-level edge. Aliased re-exports mint under the alias
name; type-only re-exports stay reference edges and mint no value node.
find_usages on a re-export node returns its own direct refs — consumer
imports that bind to it — merged with the canonical declaration's usages by
walking the forward edge, so the façade answers with the full usage set.
Call resolution treats a re-export node as a transparent forwarder and
skips it as a candidate, so a call still binds to the real declaration and
the canonical node's usages remain a superset of before.
Claude-Session: https://claude.ai/code/session_01SXwzimUB1ZVcBaGsC9qfZ5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A JS/TS barrel (
export { X } from './mod', optionally aliased) is the public API a consumer imports — but the extractor recorded re-exports only as file-level edges and minted no node for the forwarded binding, so querying the façade path an agent actually knows (src/middleware.ts::persist) returned a silent zero.The extractor now mints a node at the barrel site under the exported (post-alias) name for each named value specifier within the cap, marked with a reexport flag plus a node→canonical forward edge resolved through the existing import machinery. find_usages on a re-export node returns its own direct refs (consumer imports binding to it) merged with the canonical declaration's usages by walking the forward edge, so the façade answers with the full usage set. Aliased re-exports mint under the alias; type-only re-exports stay reference edges and mint no value node; call resolution treats the node as a transparent forwarder.