feat(parser-react): instance tree — import-resolved definitions, nesting, design-system instances#13
Merged
officialCodeWork merged 1 commit intoJul 13, 2026
Conversation
…ing, design-system instances
Step 2.1 (TRACKER). Failure modes C1 (graph half), A5:
- JSX tags resolve through the file's imports via getExportedDeclarations:
barrel files, renames (export { ProfileCardInner as ProfileCard }), and
default-export aliases (export { default as Avatar }) all land on the
original definition's node id. Same-file and unique-name fallbacks retained;
HOC aliases compose with import resolution.
- Design-system instances (A5): tags imported from configured
designSystemPackages (or resolving into node_modules) materialize as
instances flagged external-definition with definitionId external:<pkg>#<Name>
— the usage site is ours even when the definition isn't. Unconfigured
unresolvable imports (react-i18next Trans etc.) stay excluded.
- Same-body nesting: <Card><Button/></Card> sets Button.parentInstanceId to
the Card call site — first bricks of the render tree.
- Scorecard: 99 pass / 0 fail / 2 xfail. 72 unit tests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
TRACKER Step 2.1 — Phase 2 opens. Instances now resolve to their definitions through real import resolution instead of global name matching, and design-system usage sites become first-class.
What resolves now
<ProfileCard/>viaexport { ProfileCardInner as ProfileCard }barrelProfileCardInner's definitiongetExportedDeclarationsthrough the barrel + rename<Avatar/>viaexport { default as Avatar }AvatarBadge(the default export)<Button label="Save changes"/>from@acme/uiexternal:@acme/ui#Button, flaggedexternal-definitiondesignSystemPackagesconfig (A5 — the usage site is what a screenshot match returns)<Panel/>wherePanel = connect(...)(PanelInner)PanelInner<Card><Button/></Card>Button.parentInstanceId= the Card siteUnconfigured, unresolvable imports (
<Trans>from react-i18next, etc.) still produce no instances — externals are opt-in.Eval movement
a5-design-system(external components + barrel + rename + default-alias): "Save changes" correctly matches SettingsPage, the usage site.Test plan
pnpm evalgate OK; schema regenerated; strict TS cleanDocumentation
TRACKER.md— 2.1 done, Status → 2.2 (the headline step: per-instance prop-flow attribution)🤖 Generated with Claude Code