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

Add `cloneInputAst` option to `babel.transformFromAst` #10241

Merged
merged 1 commit into from Jul 29, 2020

Conversation

@coderaiser
Copy link
Contributor

coderaiser commented Jul 19, 2019

Q                       A
Fixed Issues? Fixes #10231, fixes #11206
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Added new flag cloneInputAst
Tests Added + Pass? Yes
Documentation PR Link babel/website#2306
Any Dependency Changes?
License MIT

Copy link
Member

nicolo-ribaudo left a comment

I'm not a fan of this name, since it doesn't tell what it is copying. Maybe cloneInputAst?

@babel-bot
Copy link
Collaborator

babel-bot commented Jul 19, 2019

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/24551/

@coderaiser coderaiser force-pushed the coderaiser:feature/babel-core-deep-copy branch from 00547a9 to b56fea5 Jul 19, 2019
@coderaiser
Copy link
Contributor Author

coderaiser commented Jul 19, 2019

That’s a good idea, cloneInputAst feats more 🙂.
Just pushed changes.

Copy link
Member

nicolo-ribaudo left a comment

This PR makes it way easier to write codemods using recast (which keepts the original formatting). If we clone the AST, then recast will see all the output AST nodes as new and completely discard the original source format.

Without this PR, the only way to make it work is to inject the input AST in a pre or Program visitor: https://github.com/nicolo-ribaudo/codemods/blob/40e90e3ad6e2db91fd7756bcce68bfefd373a3a3/src/utils.js#L32-L68

@nicolo-ribaudo nicolo-ribaudo changed the title feature: babel-core: add deepCopy flag (#10231) Add `cloneInputAst` option to `babel.transformFromAst` Apr 29, 2020
@codesandbox
Copy link

codesandbox bot commented Apr 29, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8983fe7:

Sandbox Source
exciting-golick-w2ui3 Configuration
great-wood-e9jj0 Configuration
@nicolo-ribaudo nicolo-ribaudo force-pushed the coderaiser:feature/babel-core-deep-copy branch from e0fbe66 to cff296f Apr 29, 2020
@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Apr 29, 2020

@coderaiser I have rebased this PR, since it looks like there were some problems after merging master into this branch.

@coderaiser
Copy link
Contributor Author

coderaiser commented May 4, 2020

@nicolo-ribaudo looks like something wrong on windows with node v14 in places that not related to this PR.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented May 4, 2020

It's a node bug, we are investigating it.

@coderaiser
Copy link
Contributor Author

coderaiser commented Jun 2, 2020

@nicolo-ribaudo Any progress on this :)?

@xtuc
xtuc approved these changes Jun 2, 2020
coderaiser pushed a commit to coderaiser/putout that referenced this pull request Jun 3, 2020
@nicolo-ribaudo nicolo-ribaudo added this to the 7.11.0 milestone Jun 6, 2020
@JLHwung JLHwung changed the base branch from master to main Jun 24, 2020
@JLHwung
Copy link
Contributor

JLHwung commented Jun 24, 2020

@coderaiser Can you rebase on main?

@coderaiser coderaiser force-pushed the coderaiser:feature/babel-core-deep-copy branch from d3bfc36 to 36d0605 Jun 24, 2020
@coderaiser
Copy link
Contributor Author

coderaiser commented Jun 24, 2020

@JLHwung done :)

@JLHwung JLHwung dismissed their stale review Jun 24, 2020

CI error is related.

@coderaiser coderaiser force-pushed the coderaiser:feature/babel-core-deep-copy branch from 36d0605 to 1d58bac Jun 24, 2020
@coderaiser coderaiser force-pushed the coderaiser:feature/babel-core-deep-copy branch 2 times, most recently from 251d2bb to c570891 Jun 25, 2020
@coderaiser coderaiser force-pushed the coderaiser:feature/babel-core-deep-copy branch from c570891 to 8983fe7 Jun 25, 2020
Copy link
Contributor

JLHwung left a comment

Thanks.

@coderaiser
Copy link
Contributor Author

coderaiser commented Jul 5, 2020

test262 takes too long, looks like they should be approved.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Jul 5, 2020

Yeah sorry, we don't run test262 on PRs automatically since often it's not needed. We haven't merged this PR yet just because we are waiting for the next minor release.

@JLHwung JLHwung merged commit cf425a0 into babel:main Jul 29, 2020
8 of 9 checks passed
8 of 9 checks passed
build
Details
test262-pr Workflow: test262-pr
Details
Gitpod Open an online workspace in Gitpod
Details
Travis CI - Pull Request Build Passed
Details
babel/repl REPL preview is available
Details
build-standalone Workflow: build-standalone
Details
ci/codesandbox Building packages succeeded.
Details
codecov/project 91.86% (target 90.00%)
Details
e2e Workflow: e2e
Details
@coderaiser coderaiser deleted the coderaiser:feature/babel-core-deep-copy branch Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.