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

feat(transformer): transform explicit resource management #9310

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

camc314
Copy link
Contributor

@camc314 camc314 commented Feb 23, 2025

wanted to have a shot at implementing this, this is rough draft.

Dunqing or overlookmotel feel free to take over or close out this PR. not sure how much time i'll have to finish it off

@Dunqing @overlookmotel this should be ready when you guys have time 🙏

closes #9168

@github-actions github-actions bot added A-transformer Area - Transformer / Transpiler C-enhancement Category - New feature or request labels Feb 23, 2025
Copy link
Contributor Author

camc314 commented Feb 23, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

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

@camc314 camc314 marked this pull request as ready for review February 23, 2025 21:55
@camc314 camc314 marked this pull request as draft February 23, 2025 21:55
Copy link

codspeed-hq bot commented Feb 23, 2025

CodSpeed Performance Report

Merging #9310 will degrade performances by 5.4%

Comparing c/02-23-feat_transformer_transform_explicit_resource_management (69a7a41) with main (098f652)

Summary

❌ 3 regressions
✅ 30 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
transformer[antd.js] 53.3 ms 55 ms -3.11%
transformer[checker.ts] 24 ms 25.4 ms -5.4%
transformer[pdf.mjs] 10.6 ms 11.1 ms -4.29%

@camc314 camc314 force-pushed the c/02-23-feat_transformer_transform_explicit_resource_management branch 2 times, most recently from c4b4c55 to 0dd6726 Compare February 27, 2025 17:02
@camc314 camc314 force-pushed the c/02-23-feat_transformer_transform_explicit_resource_management branch 2 times, most recently from 6b624bd to 081e4d7 Compare February 27, 2025 17:43
@camc314 camc314 marked this pull request as ready for review February 27, 2025 17:43
@camc314 camc314 force-pushed the c/02-23-feat_transformer_transform_explicit_resource_management branch from 081e4d7 to 6716335 Compare February 28, 2025 09:30
@Dunqing
Copy link
Member

Dunqing commented Feb 28, 2025

Thank you for working on this, I will review this next week, before that, can you add some documentation like other plugins do at the top of file?

For example:

//! ES2020: Nullish Coalescing Operator
//!
//! This plugin transforms nullish coalescing operators (`??`) to a series of ternary expressions.
//!
//! > This plugin is included in `preset-env`, in ES2020
//!
//! ## Example
//!
//! Input:
//! ```js
//! var foo = object.foo ?? "default";
//! ```
//!
//! Output:
//! ```js
//! var _object$foo;
//! var foo =
//! (_object$foo = object.foo) !== null && _object$foo !== void 0
//! ? _object$foo
//! : "default";
//! ```
//!
//! ## Implementation
//!
//! Implementation based on [@babel/plugin-transform-nullish-coalescing-operator](https://babeljs.io/docs/babel-plugin-transform-nullish-coalescing-operator).
//!
//! ## References:
//! * Babel plugin implementation: <https://github.com/babel/babel/tree/v7.26.2/packages/babel-plugin-transform-nullish-coalescing-operator>
//! * Nullish coalescing TC39 proposal: <https://github.com/tc39-transfer/proposal-nullish-coalescing>

@camc314 camc314 force-pushed the c/02-23-feat_transformer_transform_explicit_resource_management branch from 6716335 to 305c2ab Compare February 28, 2025 10:59
@Dunqing Dunqing self-assigned this Mar 3, 2025
@camc314 camc314 force-pushed the c/02-23-feat_transformer_transform_explicit_resource_management branch from 305c2ab to 69a7a41 Compare March 3, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-transformer Area - Transformer / Transpiler C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

transformer: explicit resource management
3 participants