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

fix: some stuff #57

Merged
merged 4 commits into from
Feb 3, 2024
Merged

fix: some stuff #57

merged 4 commits into from
Feb 3, 2024

Conversation

lxsmnsyc
Copy link
Member

@lxsmnsyc lxsmnsyc commented Jan 30, 2024

This PR focuses more on correcting bindings that are lost during the transformation process. Things like new functions, new variable declarations and new imports can cause issues with other babel plugins.

This involves:

  • Removing @babel/helper-module-imports.
    • The package is unnecessary bloat that can be simplified with a few lines. On top of that, the package doesn't correct bindings for new imports.
  • Remove unnecessary scope crawling.
    • This was a naive solution, but I found out that insertBefore and replaceWith returns a new path. With that in mind, we can register the replacement declarations immediately after insertion. So no need to re-crawl the entire scope.

Minor fix includes capturing the import declarations. The issue was that I initially added a check if the import is a normal import or a type import through importKind === "value". Turns out that's not always true, so I did an inverse check instead.

@ryansolid ryansolid merged commit e2d22a3 into main Feb 3, 2024
1 check passed
@lxsmnsyc lxsmnsyc deleted the fix-stuff branch February 3, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants