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

refactor(transformer): TS transforms only store options they need #6135

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Sep 28, 2024

All TS transforms only need a subset of the options in TypeScriptOptions - mostly just a single bool. Store these specific options in the transforms, not the whole TypeScriptOptions object.

This makes the transformer types smaller, and also checking the option is cheaper as it doesn't involve going through a double-reference.

e.g. Accessing only_remove_type_imports option with Rust's deref sugar made explicit:

Before: *(&*self.options).only_remove_type_imports
After: *self.only_remove_type_imports

Copy link

graphite-app bot commented Sep 28, 2024

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

Add the label “0-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.

@github-actions github-actions bot added the A-transformer Area - Transformer / Transpiler label Sep 28, 2024
Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @overlookmotel and the rest of your teammates on Graphite Graphite

Copy link

codspeed-hq bot commented Sep 28, 2024

CodSpeed Performance Report

Merging #6135 will not alter performance

Comparing 09-28-refactor_transformer_ts_transforms_only_store_options_they_need (30424fa) with main (73098a4)

Summary

✅ 29 untouched benchmarks

@overlookmotel overlookmotel marked this pull request as ready for review September 28, 2024 09:17
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Sep 28, 2024
Copy link

graphite-app bot commented Sep 28, 2024

Merge activity

  • Sep 28, 5:39 AM EDT: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 28, 5:39 AM EDT: Boshen added this pull request to the Graphite merge queue.
  • Sep 28, 5:44 AM EDT: Boshen merged this pull request with the Graphite merge queue.

)

All TS transforms only need a subset of the options in `TypeScriptOptions` - mostly just a single `bool`. Store these specific options in the transforms, not the whole `TypeScriptOptions` object.

This makes the transformer types smaller, and also checking the option is cheaper as it doesn't involve going through a double-reference.

e.g. Accessing `only_remove_type_imports` option with Rust's deref sugar made explicit:

Before: `*(&*self.options).only_remove_type_imports`
After: `*self.only_remove_type_imports`
@Boshen Boshen force-pushed the 09-28-refactor_transformer_ts_transforms_only_store_options_they_need branch from 88036fb to 30424fa Compare September 28, 2024 09:40
@graphite-app graphite-app bot merged commit 30424fa into main Sep 28, 2024
26 checks passed
@graphite-app graphite-app bot deleted the 09-28-refactor_transformer_ts_transforms_only_store_options_they_need branch September 28, 2024 09:44
Boshen added a commit that referenced this pull request Sep 29, 2024
## [0.30.5] - 2024-09-29

### Features

- 15552ac napi/transform: Display semantic error (#6160) (Boshen)
- f50fdcd napi/transform: Make react refresh option take a boolean
(#6146) (Boshen)

### Bug Fixes

- f27d59f napi/transform: Remove confusing `jsx` option (#6159) (Boshen)
- bfd1988 transformer/react: Should not collect use-hooks if it's a
nested member expression (#6143) (Dunqing)

### Refactor

- ab187d1 codegen: Restrict visibility of internal methods (#6145)
(DonIsaac)
- 375bebe transformer: Improve parsing React pragmas (#6138)
(overlookmotel)
- 0836f6b transformer: Move parsing pragmas into TS transform (#6137)
(overlookmotel)
- 30424fa transformer: TS transforms only store options they need
(#6135) (overlookmotel)

---------

Co-authored-by: Boshen <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-transformer Area - Transformer / Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants