-
Notifications
You must be signed in to change notification settings - Fork 24.8k
[Codegen] Extract the parseFile function in the typescript and flow parsers #35318
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many changes on several files, but it looks very good to me. I like that we are centralizing the shared logic in a specific object.
Thank you so much for taking care of this.
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There is a problem with the BUCK tests, though... :/ |
@cipolleschi, I investigated a bit and I think the errors come from circular imports:
It will be solved in #35147. But, I think the problem can come back later and I don't know how to fix it. Do you know how we could avoid these circular imports? Aren't we importing the parser in too many places? Or, maybe moving parseFile into the FlowParser/Typescript parser was just a bad idea. |
This comment was marked as outdated.
This comment was marked as outdated.
The circular dependency problem has landed on |
Hi @MaeIg, could you rebase this, whenever you have some time, please? 🙏 |
Hi, sorry I was pretty busy this week. I will do it tomorrow! |
ad6b929
to
f28b428
Compare
What if we don't |
I will try to do it. It will make a lot of changes but this rule should avoid circular dependencies in the future! |
This comment was marked as resolved.
This comment was marked as resolved.
@Pranav-yadav, sorry if I reply here and I haven't replied in the other PR. I understand what you say and it makes a lot of sense. I'm quite scared about how big the file will ends up. It could become very hard to read an navigate. 🤔 That's the main reason why I was pushing to keep the files separated. However, we currently have a different circular dependency: it is not related to |
f28b428
to
cb0a6be
Compare
Hi @cipolleschi, After a hard fight I ended up overcoming these circular dependencies! 🎉 I recommend you to review commit by commit to understand well the refacto 😃 Here's a diagram I created to understand what to do. Maybe it can help you to review! |
Base commit: 48966eb |
Base commit: 48966eb |
PR build artifact for 6cede0d is ready. |
PR build artifact for 6cede0d is ready. |
6cede0d
to
bf9f2f6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @MaeIg, thank you endlessly for taking care of this and for all these changes. 🙏
I left some comments to improve this even further, but it already looks extremely good to me.
PR build artifact for bf9f2f6 is ready. |
PR build artifact for bf9f2f6 is ready. |
bf9f2f6
to
eabd58d
Compare
PR build artifact for eabd58d is ready. |
PR build artifact for eabd58d is ready. |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This PR needs some changes internally. Unfortunately, I don't think I'll be able to to them today, so we will merge it in a week. I'm sorry for this. :( |
eabd58d
to
6de5740
Compare
No problem. Take your time and feel free to ping me if there is anything I can do! :) I rebased on main! |
PR build artifact for 6de5740 is ready. |
PR build artifact for 6de5740 is ready. |
… other functions that consume it
…on and other functions that consume it
It is already accessible in parser
…ions that consume it
It avoid circular dependencies and it is temporary It will be moved again in facebook#35158
At least I tried... There were still circular dependencies... (node:58076) Warning: Accessing non-existent property 'getTypes' of module exports inside circular dependency (node:58076) Warning: Accessing non-existent property 'getValueFromTypes' of module exports inside circular dependency (node:58076) Warning: Accessing non-existent property 'getValueFromTypes' of module exports inside circular dependency (node:58076) Warning: Accessing non-existent property 'buildModuleSchema' of module exports inside circular dependency
6de5740
to
29505f7
Compare
Hello 👋 |
PR build artifact for 29505f7 is ready. |
PR build artifact for 29505f7 is ready. |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This pull request was successfully merged by @MaeIg in 3f2691c. When will my fix make it into a release? | Upcoming Releases |
…cebook#35318) Summary: This PR aims to extract the parseFile function in the typescript and flow parsers. This is to solve the problem described [here](facebook#35158 (comment)) and help with the work done in facebook#34872. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Internal] [Changed] - Extract the parseFile function in the typescript and flow parsers Pull Request resolved: facebook#35318 Test Plan: yarn flow: <img width="496" alt="image" src="https://user-images.githubusercontent.com/40902940/206518024-83084c3d-ab0d-4a04-810a-d40270add4b0.png"> yarn lint: <img width="495" alt="image" src="https://user-images.githubusercontent.com/40902940/206518076-9e07eafe-db61-4c6e-8aaa-f92f190cf4f3.png"> yarn test: <img width="389" alt="image" src="https://user-images.githubusercontent.com/40902940/206518118-5633b28c-b79b-4421-80f7-de1e03fb8ff2.png"> Reviewed By: cortinico Differential Revision: D41248581 Pulled By: cipolleschi fbshipit-source-id: f5b878a28a7de612fcdd1528f064b44f668503af
Summary
This PR aims to extract the parseFile function in the typescript and flow parsers. This is to solve the problem described here and help with the work done in #34872.
Changelog
[Internal] [Changed] - Extract the parseFile function in the typescript and flow parsers
Test Plan
yarn flow:

yarn lint:

yarn test:
