Skip to content

feat(plugin): transparentWrappers option for design-system passthrough wrappers#71

Draft
billouboq wants to merge 1 commit into
kuatsu:mainfrom
billouboq:feat/transparent-wrappers
Draft

feat(plugin): transparentWrappers option for design-system passthrough wrappers#71
billouboq wants to merge 1 commit into
kuatsu:mainfrom
billouboq:feat/transparent-wrappers

Conversation

@billouboq

Copy link
Copy Markdown

Summary

This PR adds a transparentWrappers plugin option that lets users register design-system components as transparent passthrough wrappers for ancestor classification.

Motivation

Design systems commonly wrap View/Text in thin passthrough components (HStack, VStack, typography components) that render children straight into the host without introducing a React Native Text wrapper. Today, any View/Text under 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. transparentWrappers is 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

[
  'react-native-boost/plugin',
  {
    transparentWrappers: [
      {
        module: '@acme/design-system',
        components: {
          HStack: 'view', // classifies like a View ancestor
          Body: 'text',   // classifies like a Text ancestor (inline context, still bails)
        },
      },
    ],
  },
]
  • 'view' → descendants classify the wrapper as 'safe', like a real View
  • 'text' → descendants classify it as 'text', like a real Text (so nested elements correctly keep bailing)
  • Matching is on the imported name (alias-proof), named imports only
  • Unregistered components keep the existing 'unknown' behavior

Tests

  • New transparent-ds-ancestor fixtures for both optimizers:
    • registered 'view' wrapper → child optimizes
    • registered 'text' wrapper → child bails ("has Text ancestor")
    • unregistered component → keeps bailing (default fixture run pins the negative)
  • Full suite passes (371 tests), tsc --noEmit clean, pnpm build clean

Notes

  • Docs for the option come from the PluginOptions JSDoc (AutoOptionSections)
  • Out of scope (possible follow-ups): namespace imports, resolving a manifest file shipped by the design system

🤖 Generated with Claude Code

…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>
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
react-native-boost-docs Skipped Skipped Jul 6, 2026 8:27am

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a8669e30-0b5f-43d9-b265-d11d5ed34f4e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant