make as a flat value such as A$B$make and read it that way from other modules, so nested JSX components work as React Server Components client references.Semantic Diff
1 commit, rendered from its record.
| Range | Commits | Changelog | Areas | JS output changes | Formats | Failed checks |
|---|---|---|---|---|---|---|
5e3cc82b5d6bf894365095963b2901bfaf1ee57b..pr-8904 | 1 | ๐ New feature ๐ฅ Breaking change | lambdacodegenfrontendtypecheckerplaygroundtests | 1 | cmi | 0 |
@res.hoistedFunction, which nested make flat exports replace; other nested functions are no longer exported flat.make as a flat value such as A$B$make and read it that way from other modules, so nested JSX components work as React Server Components client references.5e3cc82b5d6bf894365095963b2901bfaf1ee57b..pr-8904Every make in a nested module of a file's final signature is also exported as A$B$make, and other modules read it through that name. React Server Components only pass a client module's top-level exports to the client, so <Sidebar.Provider /> no longer reads .make from a client reference. Both sides decide from the signature alone, which replaces @res.hoistedFunction and its .cmj table (#8402); see #8901.
// Sidebar.resmodule Provider = { @react.component let make = (~children) => children}// Page.reslet page = <Sidebar.Provider> {React.null} </Sidebar.Provider>
// Page.res.jsJsxRuntime.jsx(Sidebar.Provider.make, {children: null})
// Sidebar.res.jslet Provider$make = Sidebar$Provider;export { Provider, Provider$make }// Page.res.jsJsxRuntime.jsx(Sidebar.Provider$make, {children: null})
Source After from tests/build_tests/react_ppx/src/nested_component_*.res.js in this diff. Before is master's fallback for a nested read without a .cmj hoisting entry.
make as a flat value such as A$B$make and read it that way from other modules, so nested JSX components work as React Server Components client references.@res.hoistedFunction, which nested make flat exports replace; other nested functions are no longer exported flat..resi edit leave consumers stale, as in #8886? The flat export set is a function of the signature, so it changes exactly when the .cmi does, and both build systems already rebuild dependents then. Changing only Sidebar.res behind an unchanged .resi (a module alias, an external, a functor application, include) kept the .cmi byte-identical and every flat export in a scratch build.let A$B$make = make. Only fields without one (a wrapped value such as Some(make), a functor result, an awaited module) fall back to a property read.@res.hoistedFunction.make values gain flat exports and read them from other modules; 26 committed outputs change, all additive apart from the rewritten reads, and 3 go with the removed teststests/build_tests/+ react_ppx/src/nested_component_producer.res+ react_ppx/src/nested_component_consumer.restests/build_tests/+ super_errors/fixtures/flat_make_export_collision.res~ super_errors/fixtures/warning_101_bs_unused_attribute.resโ super_errors/fixtures/hoisted_function_*.restests/tests/src/~ flat_make_export*.res (from hoisted_function_attr*.res)~ import2.res| A | changes/flat-make-exports.feature.md | +1 | โ0 |
| A | changes/remove-hoisted-function.breaking.md | +1 | โ0 |
| M | compiler/core/js_cmj_format.ml | +1 | โ21 |
| M | compiler/core/js_cmj_format.mli | +0 | โ14 |
| M | compiler/core/js_implementation.ml | +4 | โ3 |
| M | compiler/core/lam_compile.ml | +12 | โ18 |
| M | compiler/core/lam_compile_env.ml | +0 | โ5 |
| M | compiler/core/lam_compile_env.mli | +0 | โ3 |
| M | compiler/core/lam_compile_main.ml | +75 | โ109 |
| M | compiler/core/lam_compile_main.mli | +1 | โ1 |
| M | compiler/core/lam_compile_primitive.ml | +8 | โ13 |
| M | compiler/core/lam_stats_export.ml | +3 | โ3 |
| M | compiler/core/lam_stats_export.mli | +0 | โ1 |
| M | compiler/ext/config.ml | +1 | โ1 |
| M | compiler/frontend/bs_builtin_ppx.ml | +0 | โ12 |
| M | compiler/jsoo/jsoo_playground_main.ml | +5 | โ3 |
| M | compiler/ml/lambda.ml | +0 | โ2 |
| M | compiler/ml/lambda.mli | +0 | โ2 |
| M | compiler/ml/translattribute.ml | +0 | โ14 |
| M | compiler/ml/translattribute.mli | +0 | โ2 |
| M | compiler/ml/translcore.ml | +2 | โ32 |
| M | compiler/ml/translcore.mli | +1 | โ5 |
| M | compiler/ml/translmod.ml | +44 | โ43 |
| M | compiler/ml/translmod.mli | +7 | โ5 |
| M | tests/build_tests/react_ppx/src/abstract_component_test.res.js | +6 | โ0 |
| M | tests/build_tests/react_ppx/src/gpr_3987_test.res.js | +9 | โ0 |
| M | tests/build_tests/react_ppx/src/issue_7917_test.res.js | +3 | โ0 |
| A | tests/build_tests/react_ppx/src/nested_component_consumer.res | +8 | โ0 |
| A | tests/build_tests/react_ppx/src/nested_component_consumer.res.js | +28 | โ0 |
| A | tests/build_tests/react_ppx/src/nested_component_producer.res | +44 | โ0 |
| A | tests/build_tests/react_ppx/src/nested_component_producer.res.js | +92 | โ0 |
| A | tests/build_tests/react_ppx/src/nested_component_producer.resi | +32 | โ0 |
| M | tests/build_tests/react_ppx/src/recursive_component_test.res.js | +3 | โ0 |
| M | tests/build_tests/react_ppx/src/recursive_explicit_component_test.res.js | +9 | โ0 |
| A | tests/build_tests/super_errors/expected/flat_make_export_collision.res.expected | +5 | โ0 |
| D | tests/build_tests/super_errors/expected/hoisted_function_export_collision.res.expected | +0 | โ11 |
| D | tests/build_tests/super_errors/expected/hoisted_function_hidden_by_signature.res.expected | +0 | โ11 |
| D | tests/build_tests/super_errors/expected/hoisted_function_invalid_payload.res.expected | +0 | โ11 |
| D | tests/build_tests/super_errors/expected/hoisted_function_not_exportable.res.expected | +0 | โ70 |
| D | tests/build_tests/super_errors/expected/hoisted_function_path_collision.res.expected | +0 | โ11 |
| D | tests/build_tests/super_errors/expected/hoisted_function_unsupported_pattern.res.expected | +0 | โ10 |
| M | tests/build_tests/super_errors/expected/warning_101_bs_unused_attribute.res.expected | +5 | โ20 |
| A | tests/build_tests/super_errors/fixtures/flat_make_export_collision.res | +7 | โ0 |
| D | tests/build_tests/super_errors/fixtures/hoisted_function_export_collision.res | +0 | โ5 |
| D | tests/build_tests/super_errors/fixtures/hoisted_function_hidden_by_signature.res | +0 | โ7 |
| D | tests/build_tests/super_errors/fixtures/hoisted_function_invalid_payload.res | +0 | โ4 |
| D | tests/build_tests/super_errors/fixtures/hoisted_function_not_exportable.res | +0 | โ29 |
| D | tests/build_tests/super_errors/fixtures/hoisted_function_path_collision.res | +0 | โ9 |
| D | tests/build_tests/super_errors/fixtures/hoisted_function_unsupported_pattern.res | +0 | โ4 |
| M | tests/build_tests/super_errors/fixtures/warning_101_bs_unused_attribute.res | +3 | โ5 |
| M | tests/gentype_tests/typescript-react-example/src/Hooks.res.js | +18 | โ0 |
| M | tests/gentype_tests/typescript-react-example/src/InnerModuleSignature.res.js | +3 | โ0 |
| M | tests/gentype_tests/typescript-react-example/src/JSXV4.res.js | +3 | โ0 |
| M | tests/gentype_tests/typescript-react-example/src/References.res.js | +3 | โ0 |
| M | tests/ounit_tests/ounit_compiler_request_tests.ml | +2 | โ3 |
| M | tests/tests/src/Import.mjs | +24 | โ0 |
| M | tests/tests/src/alias_default_value_test.mjs | +24 | โ0 |
| M | tests/tests/src/async_jsx.mjs | +6 | โ0 |
| M | tests/tests/src/exception_alias.mjs | +3 | โ0 |
| R | tests/tests/src/flat_make_export.mjs | +58 | โ62 |
| R | tests/tests/src/flat_make_export.res | +20 | โ25 |
| A | tests/tests/src/flat_make_export_test.mjs | +32 | โ0 |
| A | tests/tests/src/flat_make_export_test.res | +28 | โ0 |
| A | tests/tests/src/flat_make_export_use.mjs | +52 | โ0 |
| A | tests/tests/src/flat_make_export_use.res | +19 | โ0 |
| M | tests/tests/src/gpr_3519_jsx_test.mjs | +3 | โ0 |
| M | tests/tests/src/gpr_5071_test.mjs | +3 | โ0 |
| D | tests/tests/src/hoisted_function_attr_test.mjs | +0 | โ31 |
| D | tests/tests/src/hoisted_function_attr_test.res | +0 | โ38 |
| D | tests/tests/src/hoisted_function_attr_use.mjs | +0 | โ55 |
| D | tests/tests/src/hoisted_function_attr_use.res | +0 | โ20 |
| M | tests/tests/src/import2.mjs | +1 | โ1 |
| M | tests/tests/src/import2.res | +2 | โ4 |
| M | tests/tests/src/jsx_optional_props_test.mjs | +3 | โ0 |
| M | tests/tests/src/jsx_preserve_cases.mjs | +6 | โ0 |
| M | tests/tests/src/jsx_preserve_custom_runtime.mjs | +6 | โ0 |
| M | tests/tests/src/jsx_preserve_test.mjs | +21 | โ0 |
| M | tests/tests/src/jsxv4_newtype.mjs | +12 | โ0 |
| M | tests/tests/src/mario_game.mjs | +9 | โ0 |
| M | tests/tests/src/module_missing_conversion.mjs | +3 | โ0 |
| M | tests/tests/src/recursive_react_component.mjs | +12 | โ0 |
| M | tests/tests/src/test_pervasive.mjs | +3 | โ0 |
| M | tests/tests/src/test_pervasives3.mjs | +3 | โ0 |