Repository navigation
Replace browser_ppx with ppx_platform - #404
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BenchmarksComparison against
Changes within ±5% are likely noise from the CI runner. |
davesnx
marked this pull request as ready for review
October 16, 2026 14:38
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
browser_ppxis replaced by its own package, ppx_platform, and this repo moves to its 0.3.0 syntax.server-reason-react.browser_ppxis removed.Breaking: replace
server-reason-react.browser_ppxwithppx_platformin dunepps. Flags stay the same, for example(pps ppx_platform -js server-reason-react.ppx -melange)for Melange.Breaking: ppx_platform 0.3.0 renames the syntax. The old names give a compile error that names the replacement, for example
[@platform js] was removed in 0.3.0, use [@melange_only].let%browser_only,[%browser_only ...]let%melange_only,[%melange_only ...][@browser_only],[@platform js][@melange_only][@platform native][@native_only]Server/Clientinswitch%platformNative/Melange[@alert "-browser_only"][@alert "-melange_only"]Breaking: effect bodies are no longer wrapped automatically. Effects never run on the server (native
React.useEffect*is a no-op), so this only matters at compile time: an effect body that uses Melange-only modules must be wrapped explicitly,React.useEffect0([%melange_only () => ...]).server-reason-react.ppxdoes not touch effects and does not depend onppx_platform.Breaking:
Runtime.platform(Server | Client) is removed. ppx_platform matches case names, not the scrutinee, and nothing used the type.melange.ppxlets externals through when they carry[@melange_only](was[@platform js]/[@browser_only]), and its error hints use the new names.Generated native code calls
Ppx_platform.fail_melange_only.Runtime.Impossible_in_ssrandRuntime.fail_impossible_action_in_ssrare aliases ofPpx_platform.Melange_onlyandPpx_platform.fail_melange_only, so existingwith Runtime.Impossible_in_ssr _handlers still catch it.Requires
ppx_platform >= 0.3.0from opam-repository. There is nopin-dependsand no ppx_platform pin inmake pin.The
browser_ppxdocs page is removed. The general syntax lives in the ppx_platform README. The parts specific to server-reason-react (dune setup with-melange, theRuntime.Impossible_in_ssralias) are indocumentation/get-started.mld. The guides list inindex.mldkeeps "Exclude client code from the native build", linked to that section.Tests
At 37f7c1f, OCaml 5.4.0, against ppx_platform 0.3.0 installed from opam-repository (not pinned):
dune build,dune build @runtest --force,dune build @fmt: exit 0. The demo and router browser tests ran withnode_modulesfrom an existing checkout.opam lint server-reason-react.opam: passed.git grepforbrowser_only,[@platform js|native],Runtime.Server|Client|platformandServer =>/Client =>finds nothing outsideCHANGES.md.dune describe ppondemo/universal/native/shared/RR.redrops the[@melange_only]item and keeps the[@native_only]one. OnServerActionWithFormData.re,switch%platformkeeps theNativebranch.packages/server-reason-react-ppx/cram/effect.t:server-reason-react.ppxleavesReact.useEffect*calls as written; withppx_platformin the same driver, an explicit[%melange_only ...]effect body becomesPpx_platform.fail_melange_only.packages/server-reason-react-ppx/cram/runtime_alias.t: alet%melange_onlyfunction called on native is caught bywith Runtime.Impossible_in_ssr _. WithRuntimedeclaring its own exception instead of the alias, the test fails (mutation check run at 149abc4).[@@platform js]under(pps ppx_platform)fails with[ppx_platform] [@platform js] was removed in 0.3.0, use [@melange_only].Risk: two-way door for this repo. Reverting restores
browser_ppxand the old names. Downstream projects that already migrated toppx_platform0.3.0 names would need to switch back.