- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13
add a function to construct a url, and change how to two libs are built #317
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -3,8 +3,7 @@ | |
| (modes melange) | ||
| (public_name server-reason-react.url_js) | ||
| (libraries melange.js) | ||
| (wrapped false) | ||
| (preprocess | ||
| (pps melange.ppx))) | ||
| (pps melange.ppx)) | ||
| (implements url)) | ||
|  | ||
| (copy_files# "../URL.rei") | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We also don't like  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| include URL_impl | ||
|  | ||
| let construct ?protocol ~hostname ?port ?pathname ?search ?hash ?password ?username () = | ||
| let apply_opt f o = match o with None -> Fun.id | Some x -> fun u -> f u x in | ||
| "https://example.com" |> makeExn |> apply_opt setProtocol protocol |> Fun.flip setHostname hostname | ||
| |> apply_opt setPort port |> apply_opt setPathname pathname |> apply_opt setSearch search |> apply_opt setHash hash | ||
| |> apply_opt setPassword password |> apply_opt setUsername username | ||
| 
      Comment on lines
    
      +1
     to 
      +7
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused about the motivation of this feature. Can you explain better in the PR description? | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| (library | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It shouldn't work with melange as it doesn't have the universal structure. Take a look here: https://ml-in-barcelona.github.io/server-reason-react/server-reason-react/how-to-organise-universal-code.html | ||
| (name url) | ||
| (public_name server-reason-react.url) | ||
| (wrapped false) | ||
| (virtual_modules URL_impl)) | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| (library | ||
| (name url_native) | ||
| (public_name server-reason-react.url_native) | ||
| (wrapped false) | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. | ||
| (libraries uri js)) | ||
| (libraries uri js) | ||
| (implements url)) | ||
|  | ||
| (copy_files# "../URL.rei") | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
We cannot remove the wrapped false as it enables the library to function as "universal".
If you don't have it the usage becomes
Url_js.Urlinstead of onlyUrl, which missmatches with the native libraryUrl_native.UrlThere 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.
Its still unwrapped because it implements
urlwhich is a unwrapped library. If you try to add it back you get an error message.