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

Execute plugins before typescript strip #7501

Closed
hjkcai opened this issue Jun 7, 2023 · 2 comments
Closed

Execute plugins before typescript strip #7501

hjkcai opened this issue Jun 7, 2023 · 2 comments

Comments

@hjkcai
Copy link

hjkcai commented Jun 7, 2023

Describe the feature

I am trying to write a plugin to transform TypeScript enums to object literals. However swc executes plugin_transforms after typescript::strip_with_jsx so that enums are already transformed into IIFEs. Thus it will be harder to implement my plugin.

IMO it will be nice to have the original code exposed to plugins. For example some plugins may want to process type information. Maybe plugins can be executed before any built-in transformations?

However some plugins may want to process the transformed code. Simply change the execution order of plugins cannot cover all cases. In Babel, I am able to insert my plugin before or after the transformation (aka plugin-env) to fit my use cases.

Another problem is that existing plugins may have already depended on the current execution order. This will be a breaking change.

Is there any ideas?

Babel plugin or link to the feature description

No response

Additional context

No response

@kwonoj
Copy link
Member

kwonoj commented Jun 7, 2023

This is dupe of #5535 (comment).

There are large amount of optimization we applied, which we can't easily revert to allow raw typescript goes to the plugin transform.

@kwonoj kwonoj closed this as completed Jun 7, 2023
@swc-bot
Copy link
Collaborator

swc-bot commented Jul 7, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Jul 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants