- Notifications
You must be signed in to change notification settings - Fork44
Update new jsx transform apis, bind to Jsx in compiler, for JSX V4.#49
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
src/JsxDOM.res Outdated
| @@ -0,0 +1,2078 @@ | |||
| typeelement=React.element | |||
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.
Is this a verbatim copy of another file in the repo?
That could be a problem when someone wants to edit something.
Better to have only once. And in the copy do a one-linerinclude M instead.
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.
This looks good so far. Let's keep it open until the whole V4 ppx is finalised. |
Side comment: I verified that V4 & Jsx don't break my test project having dependencies of V3 modules. So, I tried to run the battle-test of V10 & V4 & Jsx on my company projects. I encountered some errors before verifying that V4 & classic, V4 & Jsx will not break the backward compatibility. I'll leave the issue in the compiler. |
Can you expand a bit on this? |
mununki commentedJul 1, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I ran V10 & V4 & Jsx on my test project which is a small RescriptReact app. It has dependencies of the RescriptReact module I made with V3 bsconfig. I've tested the scenarios (V3, V4 & classic, V4 & Jsx), and they worked fine. But I ran V10 compiler in V3 mode on large applications(company projects), it throws several errors. I guess it is not related to V4 or Jsx. So I left the issue in the compilerrescript-lang/rescript#5493 Let me know if anything I can help on that. |
mununki commentedJul 2, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I totally agree on the comment from@ryyppyrescript-lang/rescript#5484 (comment) Here is my thought for the future plan. What do you think?
// React.restypeelement=Jsx.element// ReactDOM.res@module("react/jsx-runtime")externaljsxKeyed: (string,JsxDOM.domProps,string)=>Jsx.element="jsx"// Jsx in the compiler Does it make sense to you? |
The breaking change is introduced by merging Side comment: I realized why some of react component binding was not written with |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
yarn.lock Outdated
| @@ -0,0 +1,3501 @@ | |||
| # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | |||
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.
Why this file?
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.
oops, my mistake. I'll drop it.
How does one test this? |
Yes exactly. That is how I develop and test in my local env. |
cristianoc commentedSep 5, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Great! Would you create such a project? |
Sure! I'll work on it. |
Still a bit confusing. |
mununki commentedSep 21, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
At least we don't need to separate the rescript-react version per compiler and jsx version. (Before)
(After)
|
mununki commentedSep 21, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
If the main project is with v4, then dependencies are impossible with v3 by all means. |
mununki commentedSep 21, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
|
Not beautiful, but it's possible to switch to V3 inside a V4 project, and use a V3 dependency. Perhaps the way to go is to cover the functionality in the upgrade docs, then do another round of feedback. |
Not perfect, but the v3 and v4 apps can use the same latest rescript-react with options you've made. I think this backward compatibility of rescript-react would be a benefit for many users. |
Anything to clean up here? |
It's like done now. |
@mattdamon108 any more feedback, anything to change in this PR before merging? |
No, it's done. |
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.
Left a few comments.
I think we should check in generated js files.
It's not 100% zero generated code anymore for technical reasons, so whatever this produces should be checked in. So we see if it's all needed.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@mattdamon108 would you take a look at the checked in |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
This PR introduces the new
Jsxmodule in the compiler. This is an initial proposal stage that has objectives and constraints as below.The newAdded in the compilerWire to JSX PPX V4 and introduce Jsx* modules rescript#5484domPropsandpropstypes which are declared with@optionalattributeThe newAdded in the compilerWire to JSX PPX V4 and introduce Jsx* modules rescript#5484JsxDOMStylemoduleI don't have a clear picture of
Jsxin the future. It could define the primitive types, functions, and modules that are vendors for JSX family, such as React, SolidJs, Remix in future. But I focus to keep the backward compatibility and support for the new jsx mode of React runtime in this stage for now.