Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion codepress-swc-plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3292,9 +3292,16 @@ impl VisitMut for CodePressTransform {
let symrefs_enc = xor_encode(&symrefs_json);

// Always-on behavior for custom component callsites (excluding skip list):
// Skip wrapping for components with props that indicate slot/polymorphic patterns:
// - asChild: Radix UI, Ark UI slot composition
// - forwardedAs: styled-components polymorphic pattern
// These patterns rely on direct parent-child relationships that wrappers would break
let has_slot_prop = Self::has_attr_key(&node.opening.attrs, "asChild")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 REQUIRED: This change alters core wrapper-insertion behavior by skipping custom components with asChild/forwardedAs props, but there are no tests covering these attributes. Given this affects a widely-applied transform, it needs direct test coverage to prevent regressions.

  Please add tests that:
  • Verify components with asChild are not wrapped.
  • Verify components with forwardedAs are not wrapped.
  • Confirm interaction with the skip list and that host elements are unaffected.
  • Include cases with prop spreads to document current behavior/limitations.
  
  Evidence:
  • search_repo "asChild" in tests (test/, tests/) → 0 matches
  • search_repo "forwardedAs" in tests (test/, tests/) → 0 matches

|| Self::has_attr_key(&node.opening.attrs, "forwardedAs");
let is_custom_call = !is_host
&& Self::is_custom_component_name(&node.opening.name)
&& !self.is_skip_component(&node.opening.name);
&& !self.is_skip_component(&node.opening.name)
&& !has_slot_prop;
let block_provider = self.should_block_provider_wrap(&node.opening.name);

if is_custom_call {
Expand Down