build: Update swc_core to v75.0.0 - #647
Conversation
Releases: @swc/plugin-react-remove-properties@12.18.0 @swc/plugin-styled-components@12.18.0 @swc/plugin-transform-imports@12.18.0 @swc/plugin-swc-confidential@11.18.0 @swc-contrib/mut-cjs-exports@14.18.0 @swc/plugin-remove-console@12.18.0 @swc/plugin-experimental-feature-flags@0.17.0 @swc/plugin-styled-jsx@13.18.0 @swc/plugin-swc-magic@12.18.0 @swc/plugin-formatjs@9.18.0 @swc/plugin-prefresh@12.18.0 @swc/plugin-emotion@14.18.0 @swc/plugin-swc-sdk@12.18.0 @swc/plugin-relay@12.18.0 @swc-contrib/plugin-graphql-codegen-client-preset@0.30.0 @swc/plugin-jest@12.18.0 @swc/plugin-loadable-components@11.18.0 @swc/plugin-noop@12.18.0 [skip ci]
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Review:
|
|
Claude (@claude) Fix CI failures |
|
Claude finished Donny/강동윤 (@kdy1)'s task in 17m 49s —— View job CI fixes pushed —
|
| Crate | Tests | Cause |
|---|---|---|
styled_components |
1 | swc_ecma_transforms_base v47 fixer change |
swc_emotion |
3 | same fixer change |
styled_jsx |
2 | lightningcss v1.0.0-alpha.72 minifier |
Root cause: the annotation range of /*#__PURE__*/
v47's fixer parenthesizes a PURE-annotated callee/receiver so the annotation range survives a re-emit (swc-project/swc#12019, fixer.rs:415 + fixer.rs:653). The flag is stored by position, and both plugins annotated a call that starts at the same BytePos as its own nested styled(..) call, so the fixer resolved the ambiguity in favor of the inner call and wrapped it:
// styled-components (outer span = tagged template span = inner call's lo)
- const Test2 = /*#__PURE__*/ styled("div").withConfig({...})([``]);
+ const Test2 = /*#__PURE__*/ (styled("div")).withConfig({...})([``]);
// emotion
- const SpanContainer = /*#__PURE__*/ styled("span", {...})({...});
+ const SpanContainer = /*#__PURE__*/ (styled("span", {...}))({...});
- const ContainerWithOptions = /*#__PURE__*/ styled("div", {...})("color:hotpink;");
+ const ContainerWithOptions = (/*#__PURE__*/ styled("div", {...}))("color:hotpink;");I did not accept these as the new snapshots, because the parens are not cosmetic — they narrow the annotation to the inner styled(...) factory call, which is trivially side-effect-free anyway. The component-creating outer call is exactly the one that needs to be pure, so blessing the snapshots would have silently cost styled-components/emotion users tree-shaking of every styled("tag") / styled(Component) component (the styled.div member forms were unaffected — their intermediate withConfig call has a dummy span, which is why only 4 of the ~93 fixtures moved).
Fix
Annotate a synthesized position (Span::dummy_with_cmt()) that no other node shares, so the annotation is unambiguously owned by the outer call. Emitted output is then byte-identical to swc_core v74 — no fixture snapshot changes in either plugin.
packages/styled-components/transform/src/visitors/pure_annotation.rs— reuse the existing "dummy span → fresh comment position" path when a nested call/new/tagged template on the leftmost spine of the callee starts at the same position (newstarts_with_call_athelper).packages/emotion/transform/src/lib.rs— newadd_pure_comment_with_new_span, used at the two ambiguous sites (styled('div')({})infold_call_expr,styled('div')`` infold_expr). The `BytePos(0)` guard is kept, so React-Compiler-synthesized calls with dummy spans still get no hint. The other 7 `add_pure_comment` sites annotate an ident or member callee, which the fixer never parenthesizes, so they're untouched.
Fixtures that genuinely needed updating
packages/styled-jsx/transform/tests/fixture/{transform-css,transform-css-global}/output.lightningcss.js — unrelated to swc_core: lightningcss alpha.71 → alpha.72 now minifies rgba(255,255,255,.8) to the equivalent 4-digit hex #fffc. Only the two .lightningcss.js snapshots changed; the non-lightningcss variants are identical.
Note on release
No changeset added — the branch already carries the RELEASING: Releasing 18 package(s) bump, and these fixes keep behavior at v74 parity rather than changing it, so they ride along under the existing "Update swc_core to v75.0.0" entries. Say the word if you'd rather they be called out separately.
• Branch kdy1/core
`swc_ecma_transforms_base` v47 parenthesizes a `PURE`-annotated callee or member receiver so that the annotation range is preserved (swc-project/swc#12019). The `PURE` flag is stored by position, and both the emotion and the styled-components plugin annotated calls which start at the same position as their nested `styled(..)` call, so the fixer narrowed the annotation to the nested call: -const Test2 = /*#__PURE__*/ styled("div").withConfig({}) ([``]); +const Test2 = /*#__PURE__*/ (styled("div")).withConfig({}) ([``]); -const SpanContainer = /*#__PURE__*/ styled("span", {})({}); +const SpanContainer = /*#__PURE__*/ (styled("span", {}))({}); Annotate a synthesized position instead, so the annotation stays attached to the whole call and the output is unchanged. Also update the two `lightningcss` fixtures, as `lightningcss` v1.0.0-alpha.72 minifies `rgba(255, 255, 255, 0.8)` to `#fffc`. Co-authored-by: Donny/강동윤 <29931815+kdy1@users.noreply.github.com>
|
|
No description provided.