fix(emotion): preserve dynamic css prop arrays#641
Conversation
🦋 Changeset detectedLatest commit: 3298736 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Review: fix(emotion): preserve dynamic css prop arraysThanks for the fix — I traced through the logic and it's a well-targeted, conservative solution to #635. The core insight is right: wrapping Correctness ✔
Minor points (non-blocking)
Test coverage ✔The WASM test plus the Overall this looks good to merge. 👍 |
Summary
Fixes #635.
This keeps dynamic JSX
cssprop arrays, such ascss={[styles.row, {}]}, as raw arrays instead of rewriting them tocss([...]). Emotion needs the raw array to reach the JSX runtime so theme callbacks can be evaluated with the active theme.Changes
cssprop rewrite to object expressions and fully static array expressions.css([.@swc/plugin-emotion.Validation
cargo test -p swc_emotioncargo test -p swc_emotion --test fixture -- --include-ignoredRUSTFLAGS='--cfg swc_ast_unknown' cargo build -p swc_plugin_emotion --target wasm32-wasip1node_modules/.bin/vitest run packages/emotion/__tests__/wasm.test.ts --testTimeout=0Note:
pnpm -F @swc/plugin-emotion testwas blocked in this environment before running by pnpm build-script approval (ERR_PNPM_IGNORED_BUILDS), so I ran the package script's build and vitest steps directly.