chore(individual-pkg-gen): remove L1s from alpha modules, and rewrite…#16483
Closed
madeline-k wants to merge 1 commit intoaws:masterfrom
Closed
chore(individual-pkg-gen): remove L1s from alpha modules, and rewrite…#16483madeline-k wants to merge 1 commit intoaws:masterfrom
madeline-k wants to merge 1 commit intoaws:masterfrom
Conversation
… imports using ts.updateXX() APIs
Contributor
Author
|
Alternative option: #16481 |
Collaborator
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… imports using ts.updateXX() APIs
This change includes a significant rewrite of
rewrite.tsto use ts AST node manipulation to update the import statments, rather than text manipulation. The reason to try this approach is it allows us to manipulate the AST directly, and insert two nodes where there formerly was one. The driving use case to do it this way was rewriting this:into this:
The current approach still has some flaws, and it is really challenging to maintain the whitespace and comments of the original file. In the current state, a lot of whitespace and comments are removed.
Another approach that I tried and did not work in some cases unfortunately was to get the unchanged lines with :
this will most of the time get the full text of a statement, including leading whitespace and comments. But sometimes it gets entire lines or parts of lines preceding or following the line in question. This would even occur when just iterating through
sourceFile.statementswith the above logic. Before ever manipulating any of the nodes.And printing the updated lines with:
this worked for the updated lines for the most part, but the real blocker for using this was re-printing out the unchanged statements.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license