Files
Colby McHenry b6e1b72d89 feat(resolution): Fabric / Codegen view components — close JSX → native flow (Phase 6)
Two-part design closes the React Native Fabric architecture flow:

1. Framework extractor (src/resolution/frameworks/fabric.ts) parses TS/TSX
   spec files for `codegenNativeComponent<Props>('Name', ...)`
   declarations and emits:
   - One `component` node per declaration (named after the JS-visible
     component name; this is what the existing reactJsxChildEdges JSX
     synthesizer matches against to wire `<MyComponent>` JSX tags).
   - One `property` node per field of the `NativeProps` interface —
     surfacing JSX-callable props (onTap, onAppear, color, …) as
     discoverable graph nodes.

2. Synthesizer (`fabricNativeImplEdges` in callback-synthesizer.ts)
   walks every `fabric-component:*` node and looks for a native class
   matching its name with one of RN's convention suffixes
   (empty / View / ViewManager / ComponentView / Manager). Emits a
   `calls` edge per match with metadata.synthesizedBy:
   'fabric-native-impl'.

Combined with reactJsxChildEdges, this closes the full
JSX → native flow: consumer-app
`<MyView prop=v/>` → Fabric `component` node `MyView` → native
class `MyViewView` / `MyViewManager` / `MyViewComponentView` / etc.

Validated on react-native-screens (the corpus repo that was entirely
Fabric and showed 0 bridges previously):
- 27 Fabric component nodes extracted from 54 codegenNativeComponent
  declarations (the .web.ts variants are filtered out by the spec
  validity check).
- 272 prop nodes from the NativeProps interfaces.
- 68 fabric-native-impl bridge edges, sample:
    RNSFullWindowOverlay → RNSFullWindowOverlay (ObjC, exact match)
    RNSFullWindowOverlay → RNSFullWindowOverlayManager (suffix: Manager)
    RNSModalScreen → RNSModalScreenManager (Manager)
    RNSScreenContainer → RNSScreenContainerView (View)

Four tests in __tests__/fabric-view.test.ts cover the extractor (with
NativeProps + bare-component variants) + an end-to-end fixture proving:
  App (TSX with <MyView color="red"/>) → MyView (fabric-component)
    → MyViewView (ObjC class)
end-to-end after indexing.

Detect simplification: initially gated extraction on a file-scan signal
`codegenNativeComponent` marker, but on big repos (RNScreens has
~1500 source files; fabric specs sit alphabetically after FabricExample/
beyond a reasonable scan budget) the marker check timed out and
produced false negatives. Detect now uses package.json's
react-native dep alone — extract() per-file decides the per-spec
validity, which is essentially free on non-spec files.

928/930 existing tests still pass (2 skipped); +4 new Fabric tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 01:51:19 -05:00
..
2026-01-18 16:25:00 -06:00