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

new: Start on es2022 preset. Implement class-static-block. #3033

Closed
wants to merge 5 commits into from
Closed

Conversation

milesj
Copy link
Collaborator

@milesj milesj commented Apr 19, 2024

No description provided.

@milesj milesj requested review from Boshen and Dunqing April 19, 2024 23:02
@github-actions github-actions bot added A-ast Area - AST A-transformer Area - Transformer / Transpiler labels Apr 19, 2024
for stmt in &body.body {
if stmt.is_private() {
if let Some(name) = stmt.property_key().and_then(|k| k.private_name()) {
private_names.insert(name.as_str().to_owned());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried to avoid the clones but kept running into borrow issues.


// We special-case the single expression case to avoid the iife,
// since it's common.
let replacement = if block.body.len() == 1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there a better way to handle this branch??

Copy link

codspeed-hq bot commented Apr 19, 2024

CodSpeed Performance Report

Merging #3033 will not alter performance

Comparing es2024 (7775590) with main (1249c6c)

Summary

✅ 30 untouched benchmarks

// NOTE: all callbacks must run in order.
x0_typescript: TypeScript<'a>,
x1_react: React<'a>,
// x2_decorators,
x3_es2022: Es2022<'a>,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ordering here is weird. When we add es2024, es2025, etc, all the numbers will shift. We probably need a different ordering system.

@Boshen
Copy link
Member

Boshen commented Apr 20, 2024

Thank you for the PR! Are we settled on everything, or should we refactor the current a bit more before getting into other presets?

@milesj
Copy link
Collaborator Author

milesj commented Apr 20, 2024

@Boshen We're still waiting on that PR to see if it's viable.

@Dunqing
Copy link
Member

Dunqing commented Apr 24, 2024

I think we should support babel-preset-env instead of es20xx preset. See https://babeljs.io/docs/env

@magic-akari
Copy link
Collaborator

I think we should support babel-preset-env instead of es20xx preset. See https://babeljs.io/docs/env

I agree that, compared to the es version, preset-env is more practical.

Moreover, I believe that the current Babel implementation completely separates env from the es version.
We could allow env to accept two types of inputs, treating the es version as a kind of env, accepting both chrome 90 and es2020.

However, when we implement the code logic, it is OK to classify according to the ES version; this is merely a matter of code organization.

@milesj
Copy link
Collaborator Author

milesj commented Apr 24, 2024

Yes this is purely for organization. It's also required for tranformers to run in the correct order: typescript -> react -> es2024 -> es2022 -> es2021, etc.

And furthermore, transforms within a preset must also be ran in a specific order.

@Dunqing
Copy link
Member

Dunqing commented Apr 25, 2024

Yes this is purely for organization. It's also required for tranformers to run in the correct order: typescript -> react -> es2024 -> es2022 -> es2021, etc.

And furthermore, transforms within a preset must also be ran in a specific order.

I got it, Thanks!

@milesj milesj closed this May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ast Area - AST A-transformer Area - Transformer / Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants