Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(transformer): JSX set reference_id on refs to imports #3524

Merged

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Jun 3, 2024

Set reference_id for references to new imported bindings. e.g. _jsx in _jsx(Foo, {}) where JSX transform has inserted import {jsx as _jsx} from "react/jsx-runtime";.

Copy link

graphite-app bot commented Jun 3, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link

codspeed-hq bot commented Jun 3, 2024

CodSpeed Performance Report

Merging #3524 will not alter performance

Comparing 06-03-fix_transformer_jsx_set_reference_id_on_refs_to_imports (cacb11f) with main (9fe0863)

Summary

✅ 22 untouched benchmarks

@overlookmotel
Copy link
Contributor Author

overlookmotel commented Jun 3, 2024

@Dunqing I was hoping this would fix some of the failing tests you mentioned last week where imports get removed on a 2nd pass through transformer. But it doesn't, so my code may be wrong.

Can you remind me of such a case? I think it was something like:

const component = <Foo />;
type X = React;

@Boshen Boshen force-pushed the 06-03-fix_transformer_jsx_set_symbol_id_on_imports branch from ec0eb58 to 591c54b Compare June 4, 2024 03:04
@Boshen Boshen changed the base branch from 06-03-fix_transformer_jsx_set_symbol_id_on_imports to main June 4, 2024 03:10
@overlookmotel overlookmotel force-pushed the 06-03-fix_transformer_jsx_set_reference_id_on_refs_to_imports branch from bbbc8a3 to cacb11f Compare June 4, 2024 16:46
@overlookmotel
Copy link
Contributor Author

@Dunqing I was hoping this would fix some of the failing tests you mentioned last week where imports get removed on a 2nd pass through transformer. But it doesn't, so my code may be wrong.

We discussed. The test case I was thinking of is not relevant to React JSX transform.

@overlookmotel overlookmotel marked this pull request as ready for review June 4, 2024 16:47
@Dunqing Dunqing merged commit c00598b into main Jun 5, 2024
24 checks passed
@Dunqing Dunqing deleted the 06-03-fix_transformer_jsx_set_reference_id_on_refs_to_imports branch June 5, 2024 02:57
Dunqing added a commit that referenced this pull request Jun 5, 2024
…mbols references (#3533)

#3524 handled the references correctly, now we can remove the reference collector.
Boshen added a commit that referenced this pull request Jun 7, 2024
## [0.13.4] - 2024-06-07

### Features

- 5c8e16c coverage: Second transformer build does not print typescript
(#3561) (Dunqing)
- 646b993 coverage/transformer: Handle @jsx option (#3553) (Dunqing)
- a939ddd transformer/typescript: Remove more typescript ast nodes
(#3563) (Dunqing)
- e8a20f8 transformer/typescript: Remove typescript ast nodes (#3559)
(Dunqing)
- ee9a215 transformer/typescript: Handle namespace directive correctly
(#3532) (Dunqing)

### Bug Fixes

- affb2c8 codegen: Print indentation before directive (#3512) (Dunqing)
- f6939cb transformer: Store `react_importer` in `Bindings` in JSX
transform (#3551) (overlookmotel)
- 7982b93 transformer: Correct spans for JSX transform (#3549)
(overlookmotel)
- c00598b transformer: JSX set `reference_id` on refs to imports (#3524)
(overlookmotel)

### Performance

- 37cdc13 transformer: Faster checks if JSX plugin enabled (#3577)
(overlookmotel)
- 9f467b8 transformer: Avoid fragment update where possible (#3535)
(overlookmotel)
- ac394f0 transformer: JSX parse pragma only once (#3534)
(overlookmotel)

### Documentation

- 1d3c0d7 span: Add doc comments to `oxc_span::Span` (#3543) (Don Isaac)

### Refactor

- f2113ae transformer: Reduce cloning and referencing `Rc`s (#3576)
(overlookmotel)
- 0948124 transformer: Pass `Rc`s by value (#3550) (overlookmotel)
- e4d74ac transformer: Remove `update_fragment` from JSX transform
(#3541) (overlookmotel)
- 73b7864 transformer: Combine import and usage in JSX transform (#3540)
(overlookmotel)
- 6978269 transformer/typescript: Replace reference collector with
symbols references (#3533) (Dunqing)

Co-authored-by: Boshen <Boshen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-semantic Area - Semantic A-transformer Area - Transformer / Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants