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.
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:
@babel/helper-module-imports
.insertBefore
andreplaceWith
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.