Skip to content

feat(parser-react): instance tree — import-resolved definitions, nesting, design-system instances#13

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-2/step-2.1-instance-tree
Jul 13, 2026
Merged

feat(parser-react): instance tree — import-resolved definitions, nesting, design-system instances#13
officialCodeWork merged 1 commit into
developmentfrom
build/phase-2/step-2.1-instance-tree

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

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

JSX call site Resolves to Mechanism
<ProfileCard/> via export { ProfileCardInner as ProfileCard } barrel ProfileCardInner's definition getExportedDeclarations through the barrel + rename
<Avatar/> via export { default as Avatar } AvatarBadge (the default export) default-export aliasing
<Button label="Save changes"/> from @acme/ui external:@acme/ui#Button, flagged external-definition designSystemPackages config (A5 — the usage site is what a screenshot match returns)
<Panel/> where Panel = connect(...)(PanelInner) PanelInner HOC aliases compose with import resolution
<Card><Button/></Card> Button.parentInstanceId = the Card site same-body nesting — first bricks of the render tree

Unconfigured, unresolvable imports (<Trans> from react-i18next, etc.) still produce no instances — externals are opt-in.

Eval movement

  • New fixture a5-design-system (external components + barrel + rename + default-alias): "Save changes" correctly matches SettingsPage, the usage site.
  • Scorecard: 99 pass / 0 fail / 2 xfail / 0 unexpected-pass · precision 1.000 · recall 0.895 · match accuracy 1.000.

Test plan

  • 72 unit tests green (5 new: external flagging + staticProps, barrel rename, default alias, external opt-in scoping, nesting baseline)
  • pnpm eval gate OK; schema regenerated; strict TS clean

Documentation

  • TRACKER.md — 2.1 done, Status → 2.2 (the headline step: per-instance prop-flow attribution)

🤖 Generated with Claude Code

…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>
@officialCodeWork
officialCodeWork merged commit ce7a3bc into development Jul 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants