[Codegen] Extract the parseFile function in the typescript and flow parsers#35318
[Codegen] Extract the parseFile function in the typescript and flow parsers#35318MaeIg wants to merge 11 commits into
Conversation
cipolleschi
left a comment
There was a problem hiding this comment.
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 6cede0d456f39e3c3c5d60012e5193ad6f250997 is ready. |
|
PR build artifact for 6cede0d456f39e3c3c5d60012e5193ad6f250997 is ready. |
6cede0d to
bf9f2f6
Compare
cipolleschi
left a comment
There was a problem hiding this comment.
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 bf9f2f64817c5a4ddcf706a3b4f18c2a785d0e3a is ready. |
|
PR build artifact for bf9f2f64817c5a4ddcf706a3b4f18c2a785d0e3a is ready. |
bf9f2f6 to
eabd58d
Compare
|
PR build artifact for eabd58db6202b9048c6b169cc19dc04b4f2c4b99 is ready. |
|
PR build artifact for eabd58db6202b9048c6b169cc19dc04b4f2c4b99 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 6de5740cee0d3c21e001f84ca15f906eda1efb33 is ready. |
|
PR build artifact for 6de5740cee0d3c21e001f84ca15f906eda1efb33 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 |



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:
