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(es/compat): Implement decorator metadata proposal #8097

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

alekitto
Copy link
Contributor

@alekitto alekitto commented Oct 11, 2023

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:

@kdy1 kdy1 self-assigned this Oct 11, 2023
@kdy1 kdy1 added this to the Planned milestone Oct 11, 2023
@@ -476,6 +483,14 @@ function applyDecs2203RFactory() {
// so we don't have to return an empty array here.
}

function defineMetadata(Class, metadata) {
Copy link
Member

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

Copy link
Contributor Author

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

@kdy1
Copy link
Member

kdy1 commented Oct 12, 2023

cc @magic-akari Can you take a quick look? If you don't want to, feel free to tell me.
My main concern is that the additional helper script may diverge.

@magic-akari
Copy link
Member

cc @magic-akari Can you take a quick look? If you don't want to, feel free to tell me. My main concern is that the additional helper script may diverge.

I didn't find issues, what could cause divergence?
Do you mean the issue of different versions of swc/helprs with the swc/core?

Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

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

@kdy1 kdy1 changed the title feat(es/compat): implement decorator metadata proposal feat(es/decorators): Implement decorator metadata proposal Oct 16, 2023
@kdy1 kdy1 changed the title feat(es/decorators): Implement decorator metadata proposal feat(es/compat): Implement decorator metadata proposal Oct 16, 2023
@alekitto
Copy link
Contributor Author

@kdy1 kdy1 enabled auto-merge (squash) October 16, 2023 20:38
@kdy1 kdy1 merged commit 9c029ef into swc-project:main Oct 16, 2023
142 checks passed
@kdy1 kdy1 modified the milestones: Planned, v1.3.94 Oct 21, 2023
@swc-project swc-project locked as resolved and limited conversation to collaborators Nov 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

undefined is passed for the "context.metadata" field in a decorator metadata
3 participants