Uh oh!
There was an error while loading. Please reload this page.
feat(plugin): transparentWrappers option for design-system passthrough wrappers - #71
feat(plugin): transparentWrappers option for design-system passthrough wrappers#71billouboq wants to merge 1 commit into
Conversation
…rough wrappers Components that render their children straight into a host View/Text (design-system stacks and typography wrappers) currently classify as 'unknown' ancestors, so every View/Text under them bails out. The new transparentWrappers option lets users register such components (per module, per export, with the host kind they render to) so the ancestor analysis can classify them like the equivalent react-native host: 'view' wrappers behave like a View ancestor, 'text' wrappers like a Text ancestor (inline-text context, still a bail). Matching is done on the imported name, so aliased imports resolve correctly, and is scoped to import specifiers (named imports). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
This PR adds a
transparentWrappersplugin option that lets users register design-system components as transparent passthrough wrappers for ancestor classification.Motivation
Design systems commonly wrap
View/Textin thin passthrough components (HStack,VStack, typography components) that render children straight into the host without introducing a React NativeTextwrapper. Today, anyView/Textunder such a component classifies as having an'unknown'ancestor and bails out — even though the wrapper is provably safe by construction.The existing escape hatches (
dangerouslyOptimize*WithUnknownAncestors) are all-or-nothing and unsafe by design.transparentWrappersis the targeted alternative: the user vouches for specific (module, export) pairs and declares which host they render to.At Beedeez (React Native app, ~2 100 source files, design-system based UI), registering 8 wrapper components removed every "unresolved ancestor" bail under our stacks/typography wrappers with no behavioral change, verified on device.
API
'view'→ descendants classify the wrapper as'safe', like a realView'text'→ descendants classify it as'text', like a realText(so nested elements correctly keep bailing)'unknown'behaviorTests
transparent-ds-ancestorfixtures for both optimizers:'view'wrapper → child optimizes'text'wrapper → child bails ("has Text ancestor")tsc --noEmitclean,pnpm buildcleanNotes
PluginOptionsJSDoc (AutoOptionSections)🤖 Generated with Claude Code