-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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(es/compat): Implement decorator metadata proposal #8097
Conversation
@@ -476,6 +483,14 @@ function applyDecs2203RFactory() { | |||
// so we don't have to return an empty array here. | |||
} | |||
|
|||
function defineMetadata(Class, metadata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you write this by yourself? I want to know if there was a reference implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The js part is almost copied and adapted from babel implementation, while the Rust part obviously not
Tests are copied from babel
cc @magic-akari Can you take a quick look? If you don't want to, feel free to tell me. |
I didn't find issues, what could cause divergence? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please modify https://github.com/swc-project/swc/blob/7fe9c76c37ade3a84ab25804bff73f94d0857a29/packages/helpers/esm/_apply_decs_2203_r.js , too.
swc-bump:
- swc_ecma_transforms_base
Done and rebased |
Description:
This PR implements the decorator metadata proposal, that is now at Stage 3.
As the decorator metadata proposal is a small extension of the decorator proposal and is not possible to compile the metadata without transpiling decorators, I opted to implement it into the existing decorator transformer (and helper)
Related issue:
undefined
is passed for the "context.metadata" field in a decorator metadata #7957