feat(plugin): transparentWrappers option for design-system passthrough wrappers#71
Draft
billouboq wants to merge 1 commit into
Draft
feat(plugin): transparentWrappers option for design-system passthrough wrappers#71billouboq wants to merge 1 commit into
billouboq 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 |
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
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