diff --git a/CHANGELOG.md b/CHANGELOG.md
index e32c672d8a..0e5a1495b4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@
#### :boom: Breaking Change
- Replace ~date with ~day in Date.make\*. https://github.com/rescript-lang/rescript/pull/7324
+- Remove `-bs-jsx-mode`. https://github.com/rescript-lang/rescript/pull/7327
#### :house: Internal
diff --git a/compiler/bsb/bsb_build_schemas.ml b/compiler/bsb/bsb_build_schemas.ml
index 1a9b85be4b..12e16ae65c 100644
--- a/compiler/bsb/bsb_build_schemas.ml
+++ b/compiler/bsb/bsb_build_schemas.ml
@@ -51,7 +51,6 @@ let react_jsx = "react-jsx"
let jsx = "jsx"
let jsx_version = "version"
let jsx_module = "module"
-let jsx_mode = "mode"
let cut_generators = "cut-generators"
let generators = "generators"
let command = "command"
diff --git a/compiler/bsb/bsb_jsx.ml b/compiler/bsb/bsb_jsx.ml
index 4a13f99ca9..84c0da9e6a 100644
--- a/compiler/bsb/bsb_jsx.ml
+++ b/compiler/bsb/bsb_jsx.ml
@@ -1,23 +1,18 @@
type version = Jsx_v4
type module_ = React | Generic of {moduleName: string}
-type mode = Classic | Automatic
type dependencies = string list
-type t = {version: version option; module_: module_ option; mode: mode option}
+type t = {version: version option; module_: module_ option}
let encode_no_nl jsx =
(match jsx.version with
| None -> ""
| Some Jsx_v4 -> "4")
- ^ (match jsx.module_ with
- | None -> ""
- | Some React -> "React"
- | Some (Generic {moduleName}) -> moduleName)
^
- match jsx.mode with
+ match jsx.module_ with
| None -> ""
- | Some Classic -> "Classic"
- | Some Automatic -> "Automatic"
+ | Some React -> "React"
+ | Some (Generic {moduleName}) -> moduleName
let ( .?() ) = Map_string.find_opt
let ( |? ) m (key, cb) = m |> Ext_json.test key cb
@@ -33,7 +28,6 @@ let get_list_string s = get_list_string_acc s []
let from_map map =
let version : version option ref = ref None in
let module_ : module_ option ref = ref None in
- let mode : mode option ref = ref None in
map
|? ( Bsb_build_schemas.jsx,
`Obj
@@ -59,18 +53,5 @@ let from_map map =
Bsb_exception.config_error x
"Unexpected input (jsx module name) for jsx module"
| None -> ()) )
- |? ( Bsb_build_schemas.jsx,
- `Obj
- (fun m ->
- match m.?(Bsb_build_schemas.jsx_mode) with
- | Some (Str {loc; str}) -> (
- match str with
- | "classic" -> mode := Some Classic
- | "automatic" -> mode := Some Automatic
- | _ -> Bsb_exception.errorf ~loc "Unsupported jsx mode %s" str)
- | Some x ->
- Bsb_exception.config_error x
- "Unexpected input (expect classic or automatic) for jsx mode"
- | None -> ()) )
|> ignore;
- {version = !version; module_ = !module_; mode = !mode}
+ {version = !version; module_ = !module_}
diff --git a/compiler/bsb/bsb_ninja_rule.ml b/compiler/bsb/bsb_ninja_rule.ml
index a65b7d9862..2146cb49b5 100644
--- a/compiler/bsb/bsb_ninja_rule.ml
+++ b/compiler/bsb/bsb_ninja_rule.ml
@@ -167,10 +167,6 @@ let make_custom_rules ~(gentype_config : Bsb_config_types.gentype_config)
| Some React -> Ext_buffer.add_string buf " -bs-jsx-module react"
| Some (Generic {moduleName}) ->
Ext_buffer.add_string buf (" -bs-jsx-module " ^ moduleName));
- (match jsx.mode with
- | None -> ()
- | Some Classic -> Ext_buffer.add_string buf " -bs-jsx-mode classic"
- | Some Automatic -> Ext_buffer.add_string buf " -bs-jsx-mode automatic");
Ext_buffer.add_char_string buf ' ' bsc_flags;
Ext_buffer.add_string buf " -absname -bs-ast -o $out $i";
diff --git a/compiler/bsc/rescript_compiler_main.ml b/compiler/bsc/rescript_compiler_main.ml
index 83b08fa796..358ece0799 100644
--- a/compiler/bsc/rescript_compiler_main.ml
+++ b/compiler/bsc/rescript_compiler_main.ml
@@ -254,16 +254,11 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
| _ -> true
in
Js_config.jsx_module := Js_config.jsx_module_of_string i;
- if is_generic then (
- Js_config.jsx_mode := Automatic;
- Js_config.jsx_version := Some Jsx_v4)),
+ if is_generic then Js_config.jsx_version := Some Jsx_v4),
"*internal* Set jsx module" );
( "-bs-jsx-mode",
- string_call (fun i ->
- if i <> "classic" && i <> "automatic" then
- Bsc_args.bad_arg (" Not supported jsx-mode : " ^ i);
- Js_config.jsx_mode := Js_config.jsx_mode_of_string i),
- "*internal* Set jsx mode" );
+ string_call ignore,
+ "*internal* Set jsx mode, this is no longer used and is a no-op." );
( "-bs-package-output",
string_call Js_packages_state.update_npm_package_path,
"*internal* Set npm-output-path: [opt_module]:path, for example: \
diff --git a/compiler/common/js_config.ml b/compiler/common/js_config.ml
index 3801ffa7be..bf062d0f21 100644
--- a/compiler/common/js_config.ml
+++ b/compiler/common/js_config.ml
@@ -26,7 +26,6 @@
type jsx_version = Jsx_v4
type jsx_module = React | Generic of {module_name: string}
-type jsx_mode = Classic | Automatic
let no_version_header = ref false
@@ -51,7 +50,6 @@ let force_cmi = ref false
let force_cmj = ref false
let jsx_version = ref None
let jsx_module = ref React
-let jsx_mode = ref Automatic
let js_stdout = ref true
let all_module_aliases = ref false
let no_stdlib = ref false
@@ -63,10 +61,6 @@ let string_of_jsx_module = function
| React -> "react"
| Generic {module_name} -> module_name
-let string_of_jsx_mode = function
- | Classic -> "classic"
- | Automatic -> "automatic"
-
let jsx_version_of_int = function
| 4 -> Some Jsx_v4
| _ -> None
@@ -75,11 +69,6 @@ let jsx_module_of_string = function
| "react" -> React
| module_name -> Generic {module_name}
-let jsx_mode_of_string = function
- | "classic" -> Classic
- | "automatic" -> Automatic
- | _ -> Classic
-
(* option to config `@rescript/std`*)
let customize_runtime : string option ref = ref None
let as_pp = ref false
diff --git a/compiler/common/js_config.mli b/compiler/common/js_config.mli
index 5f84072609..ec6e1829da 100644
--- a/compiler/common/js_config.mli
+++ b/compiler/common/js_config.mli
@@ -24,7 +24,6 @@
type jsx_version = Jsx_v4
type jsx_module = React | Generic of {module_name: string}
-type jsx_mode = Classic | Automatic
(* val get_packages_info :
unit -> Js_packages_info.t *)
@@ -81,8 +80,6 @@ val jsx_version : jsx_version option ref
val jsx_module : jsx_module ref
-val jsx_mode : jsx_mode ref
-
val js_stdout : bool ref
val all_module_aliases : bool ref
@@ -95,14 +92,10 @@ val int_of_jsx_version : jsx_version -> int
val string_of_jsx_module : jsx_module -> string
-val string_of_jsx_mode : jsx_mode -> string
-
val jsx_version_of_int : int -> jsx_version option
val jsx_module_of_string : string -> jsx_module
-val jsx_mode_of_string : string -> jsx_mode
-
val customize_runtime : string option ref
val as_pp : bool ref
diff --git a/compiler/frontend/ppx_entry.ml b/compiler/frontend/ppx_entry.ml
index 4201e1aa33..e86949064f 100644
--- a/compiler/frontend/ppx_entry.ml
+++ b/compiler/frontend/ppx_entry.ml
@@ -34,8 +34,7 @@ let rewrite_signature (ast : Parsetree.signature) : Parsetree.signature =
let open Js_config in
let jsx_version = int_of_jsx_version jsx_version_ in
let jsx_module = string_of_jsx_module !jsx_module in
- let jsx_mode = string_of_jsx_mode !jsx_mode in
- Jsx_ppx.rewrite_signature ~jsx_version ~jsx_module ~jsx_mode ast
+ Jsx_ppx.rewrite_signature ~jsx_version ~jsx_module ast
in
if !Js_config.no_builtin_ppx then ast
else
@@ -54,8 +53,7 @@ let rewrite_implementation (ast : Parsetree.structure) : Parsetree.structure =
let open Js_config in
let jsx_version = int_of_jsx_version jsx_version_ in
let jsx_module = string_of_jsx_module !jsx_module in
- let jsx_mode = string_of_jsx_mode !jsx_mode in
- Jsx_ppx.rewrite_implementation ~jsx_version ~jsx_module ~jsx_mode ast
+ Jsx_ppx.rewrite_implementation ~jsx_version ~jsx_module ast
in
if !Js_config.no_builtin_ppx then ast
else
diff --git a/compiler/jsoo/jsoo_playground_main.ml b/compiler/jsoo/jsoo_playground_main.ml
index b693672d20..370f8177b3 100644
--- a/compiler/jsoo/jsoo_playground_main.ml
+++ b/compiler/jsoo/jsoo_playground_main.ml
@@ -488,8 +488,6 @@ module Compile = struct
let types_signature = ref [] in
Js_config.jsx_version := Some Js_config.Jsx_v4;
(* default *)
- Js_config.jsx_mode := Js_config.Automatic;
- (* default *)
let ast = impl str in
let ast = Ppx_entry.rewrite_implementation ast in
let typed_tree =
diff --git a/compiler/syntax/cli/res_cli.ml b/compiler/syntax/cli/res_cli.ml
index 1e8554e92b..d045b16753 100644
--- a/compiler/syntax/cli/res_cli.ml
+++ b/compiler/syntax/cli/res_cli.ml
@@ -163,7 +163,6 @@ module ResClflags : sig
val interface : bool ref
val jsx_version : int ref
val jsx_module : string ref
- val jsx_mode : string ref
val typechecker : bool ref
val test_ast_conversion : bool ref
@@ -176,7 +175,6 @@ end = struct
let interface = ref false
let jsx_version = ref (-1)
let jsx_module = ref "react"
- let jsx_mode = ref "automatic"
let file = ref ""
let typechecker = ref false
let test_ast_conversion = ref false
@@ -210,9 +208,6 @@ end = struct
( "-jsx-module",
Arg.String (fun txt -> jsx_module := txt),
"Specify the jsx module. Default: react" );
- ( "-jsx-mode",
- Arg.String (fun txt -> jsx_mode := txt),
- "Specify the jsx mode, classic or automatic. Default: automatic" );
( "-typechecker",
Arg.Unit (fun () -> typechecker := true),
"Parses the ast as it would be passed to the typechecker and not the \
@@ -230,7 +225,7 @@ module CliArgProcessor = struct
[@@unboxed]
let process_file ~is_interface ~width ~recover ~target ~jsx_version
- ~jsx_module ~jsx_mode ~typechecker ~test_ast_conversion filename =
+ ~jsx_module ~typechecker ~test_ast_conversion filename =
let len = String.length filename in
let process_interface =
is_interface
@@ -282,7 +277,7 @@ module CliArgProcessor = struct
Ast_mapper_from0.default_mapper tree0
in
let parsetree =
- Jsx_ppx.rewrite_signature ~jsx_version ~jsx_module ~jsx_mode parsetree
+ Jsx_ppx.rewrite_signature ~jsx_version ~jsx_module parsetree
in
print_engine.print_interface ~width ~filename
~comments:parse_result.comments parsetree
@@ -307,8 +302,7 @@ module CliArgProcessor = struct
Ast_mapper_from0.default_mapper tree0
in
let parsetree =
- Jsx_ppx.rewrite_implementation ~jsx_version ~jsx_module ~jsx_mode
- parsetree
+ Jsx_ppx.rewrite_implementation ~jsx_version ~jsx_module parsetree
in
print_engine.print_implementation ~width ~filename
~comments:parse_result.comments parsetree
@@ -321,7 +315,7 @@ let () =
CliArgProcessor.process_file ~is_interface:!ResClflags.interface
~width:!ResClflags.width ~recover:!ResClflags.recover
~target:!ResClflags.print ~jsx_version:!ResClflags.jsx_version
- ~jsx_module:!ResClflags.jsx_module ~jsx_mode:!ResClflags.jsx_mode
- ~typechecker:!ResClflags.typechecker !ResClflags.file
+ ~jsx_module:!ResClflags.jsx_module ~typechecker:!ResClflags.typechecker
+ !ResClflags.file
~test_ast_conversion:!ResClflags.test_ast_conversion)
[@@raises exit]
diff --git a/compiler/syntax/src/jsx_common.ml b/compiler/syntax/src/jsx_common.ml
index 20f0c61413..6937bd14d0 100644
--- a/compiler/syntax/src/jsx_common.ml
+++ b/compiler/syntax/src/jsx_common.ml
@@ -4,7 +4,6 @@ open Parsetree
type jsx_config = {
mutable version: int;
mutable module_: string;
- mutable mode: string;
mutable nested_modules: string list;
mutable has_component: bool;
}
diff --git a/compiler/syntax/src/jsx_ppx.ml b/compiler/syntax/src/jsx_ppx.ml
index 1416453ce4..8bd2ffd7a0 100644
--- a/compiler/syntax/src/jsx_ppx.ml
+++ b/compiler/syntax/src/jsx_ppx.ml
@@ -58,13 +58,9 @@ let update_config config payload =
| true, _ -> config.Jsx_common.version <- 4
| false, Some i -> config.Jsx_common.version <- i
| _ -> ());
- (match module_raw with
+ match module_raw with
| None -> ()
- | Some s -> config.module_ <- s);
- match (is_generic, get_string ~key:"mode" fields) with
- | true, _ -> config.mode <- "automatic"
- | false, Some s -> config.mode <- s
- | _ -> ()
+ | Some s -> config.module_ <- s
let is_jsx_config_attr ((loc, _) : attribute) = loc.txt = "jsxConfig"
@@ -94,14 +90,12 @@ let get_mapper ~config =
config with
version = config.version;
module_ = config.module_;
- mode = config.mode;
has_component = config.has_component;
}
in
let restore_config old_config =
config.version <- old_config.Jsx_common.version;
config.module_ <- old_config.module_;
- config.mode <- old_config.mode;
config.has_component <- old_config.has_component
in
let signature mapper items =
@@ -141,13 +135,12 @@ let get_mapper ~config =
{default_mapper with expr; module_binding; signature; structure}
-let rewrite_implementation ~jsx_version ~jsx_module ~jsx_mode
- (code : Parsetree.structure) : Parsetree.structure =
+let rewrite_implementation ~jsx_version ~jsx_module (code : Parsetree.structure)
+ : Parsetree.structure =
let config =
{
Jsx_common.version = jsx_version;
module_ = jsx_module;
- mode = jsx_mode;
nested_modules = [];
has_component = false;
}
@@ -155,13 +148,12 @@ let rewrite_implementation ~jsx_version ~jsx_module ~jsx_mode
let mapper = get_mapper ~config in
mapper.structure mapper code
-let rewrite_signature ~jsx_version ~jsx_module ~jsx_mode
- (code : Parsetree.signature) : Parsetree.signature =
+let rewrite_signature ~jsx_version ~jsx_module (code : Parsetree.signature) :
+ Parsetree.signature =
let config =
{
Jsx_common.version = jsx_version;
module_ = jsx_module;
- mode = jsx_mode;
nested_modules = [];
has_component = false;
}
diff --git a/compiler/syntax/src/jsx_ppx.mli b/compiler/syntax/src/jsx_ppx.mli
index 0f7c808c6c..de5bd83f8f 100644
--- a/compiler/syntax/src/jsx_ppx.mli
+++ b/compiler/syntax/src/jsx_ppx.mli
@@ -11,13 +11,11 @@
val rewrite_implementation :
jsx_version:int ->
jsx_module:string ->
- jsx_mode:string ->
Parsetree.structure ->
Parsetree.structure
val rewrite_signature :
jsx_version:int ->
jsx_module:string ->
- jsx_mode:string ->
Parsetree.signature ->
Parsetree.signature
diff --git a/compiler/syntax/src/jsx_v4.ml b/compiler/syntax/src/jsx_v4.ml
index b1eb169b84..a3bb5fda7f 100644
--- a/compiler/syntax/src/jsx_v4.ml
+++ b/compiler/syntax/src/jsx_v4.ml
@@ -90,8 +90,7 @@ let transform_children_if_list ~mapper the_list =
in
transformChildren_ the_list []
-let extract_children ?(remove_last_position_unit = false) ~loc
- props_and_children =
+let extract_children ~loc props_and_children =
let rec allButLast_ lst acc =
match lst with
| [] -> []
@@ -111,10 +110,8 @@ let extract_children ?(remove_last_position_unit = false) ~loc
| [], props ->
(* no children provided? Place a placeholder list *)
( Exp.construct {loc = Location.none; txt = Lident "[]"} None,
- if remove_last_position_unit then all_but_last props else props )
- | [(_, children_expr)], props ->
- ( children_expr,
- if remove_last_position_unit then all_but_last props else props )
+ all_but_last props )
+ | [(_, children_expr)], props -> (children_expr, all_but_last props)
| _ ->
Jsx_common.raise_error ~loc
"JSX: somehow there's more than one `children` label"
@@ -390,8 +387,7 @@ let make_props_record_type_sig ~core_type_of_attr ~external_
let transform_uppercase_call3 ~config module_path mapper jsx_expr_loc
call_expr_loc attrs call_arguments =
let children, args_with_labels =
- extract_children ~remove_last_position_unit:true ~loc:jsx_expr_loc
- call_arguments
+ extract_children ~loc:jsx_expr_loc call_arguments
in
let args_for_make = args_with_labels in
let children_expr = transform_children_if_list_upper ~mapper children in
@@ -407,25 +403,17 @@ let transform_uppercase_call3 ~config module_path mapper jsx_expr_loc
match children_expr with
| Exact children -> [(labelled "children", children, false)]
| ListLiteral {pexp_desc = Pexp_array list} when list = [] -> []
- | ListLiteral expression -> (
+ | ListLiteral expression ->
(* this is a hack to support react components that introspect into their children *)
children_arg := Some expression;
- match config.Jsx_common.mode with
- | "automatic" ->
- [
- ( labelled "children",
- Exp.apply
- (Exp.ident
- {txt = module_access_name config "array"; loc = Location.none})
- [(Nolabel, expression)],
- false );
- ]
- | _ ->
- [
- ( labelled "children",
- Exp.ident {loc = Location.none; txt = Ldot (Lident "React", "null")},
- false );
- ])
+ [
+ ( labelled "children",
+ Exp.apply
+ (Exp.ident
+ {txt = module_access_name config "array"; loc = Location.none})
+ [(Nolabel, expression)],
+ false );
+ ]
in
let is_cap str = String.capitalize_ascii str = str in
@@ -457,198 +445,106 @@ let transform_uppercase_call3 ~config module_path mapper jsx_expr_loc
Exp.ident ~loc:call_expr_loc
{txt = ident ~suffix:"make"; loc = call_expr_loc}
in
- match config.mode with
- (* The new jsx transform *)
- | "automatic" ->
- let jsx_expr, key_and_unit =
- match (!children_arg, key_prop) with
- | None, key :: _ ->
- ( Exp.ident
- {loc = Location.none; txt = module_access_name config "jsxKeyed"},
- [key; (nolabel, unit_expr ~loc:Location.none)] )
- | None, [] ->
- ( Exp.ident {loc = Location.none; txt = module_access_name config "jsx"},
- [] )
- | Some _, key :: _ ->
- ( Exp.ident
- {loc = Location.none; txt = module_access_name config "jsxsKeyed"},
- [key; (nolabel, unit_expr ~loc:Location.none)] )
- | Some _, [] ->
- ( Exp.ident {loc = Location.none; txt = module_access_name config "jsxs"},
- [] )
- in
- Exp.apply ~loc:jsx_expr_loc ~attrs jsx_expr
- ([(nolabel, make_i_d); (nolabel, props)] @ key_and_unit)
- | _ -> (
+
+ let jsx_expr, key_and_unit =
match (!children_arg, key_prop) with
| None, key :: _ ->
- Exp.apply ~loc:jsx_expr_loc ~attrs
- (Exp.ident
- {
- loc = Location.none;
- txt = Ldot (Lident "JsxPPXReactSupport", "createElementWithKey");
- })
- [key; (nolabel, make_i_d); (nolabel, props)]
+ ( Exp.ident
+ {loc = Location.none; txt = module_access_name config "jsxKeyed"},
+ [key; (nolabel, unit_expr ~loc:Location.none)] )
| None, [] ->
- Exp.apply ~loc:jsx_expr_loc ~attrs
- (Exp.ident
- {loc = Location.none; txt = Ldot (Lident "React", "createElement")})
- [(nolabel, make_i_d); (nolabel, props)]
- | Some children, key :: _ ->
- Exp.apply ~loc:jsx_expr_loc ~attrs
- (Exp.ident
- {
- loc = Location.none;
- txt =
- Ldot (Lident "JsxPPXReactSupport", "createElementVariadicWithKey");
- })
- [key; (nolabel, make_i_d); (nolabel, props); (nolabel, children)]
- | Some children, [] ->
- Exp.apply ~loc:jsx_expr_loc ~attrs
- (Exp.ident
- {
- loc = Location.none;
- txt = Ldot (Lident "React", "createElementVariadic");
- })
- [(nolabel, make_i_d); (nolabel, props); (nolabel, children)])
+ ( Exp.ident {loc = Location.none; txt = module_access_name config "jsx"},
+ [] )
+ | Some _, key :: _ ->
+ ( Exp.ident
+ {loc = Location.none; txt = module_access_name config "jsxsKeyed"},
+ [key; (nolabel, unit_expr ~loc:Location.none)] )
+ | Some _, [] ->
+ ( Exp.ident {loc = Location.none; txt = module_access_name config "jsxs"},
+ [] )
+ in
+ Exp.apply ~loc:jsx_expr_loc ~attrs jsx_expr
+ ([(nolabel, make_i_d); (nolabel, props)] @ key_and_unit)
let transform_lowercase_call3 ~config mapper jsx_expr_loc call_expr_loc attrs
call_arguments id =
let component_name_expr = constant_string ~loc:call_expr_loc id in
- match config.Jsx_common.mode with
- (* the new jsx transform *)
- | "automatic" ->
- let element_binding =
- match config.module_ |> String.lowercase_ascii with
- | "react" -> Lident "ReactDOM"
- | _generic -> module_access_name config "Elements"
- in
+ let element_binding =
+ match config.Jsx_common.module_ |> String.lowercase_ascii with
+ | "react" -> Lident "ReactDOM"
+ | _generic -> module_access_name config "Elements"
+ in
- let children, non_children_props =
- extract_children ~remove_last_position_unit:true ~loc:jsx_expr_loc
- call_arguments
- in
- let args_for_make = non_children_props in
- let children_expr = transform_children_if_list_upper ~mapper children in
- let recursively_transformed_args_for_make =
- args_for_make
- |> List.map (fun (label, expression) ->
- (label, mapper.expr mapper expression, false))
- in
- let children_arg = ref None in
- let args =
- recursively_transformed_args_for_make
- @
- match children_expr with
- | Exact children ->
- [
- ( labelled "children",
- Exp.apply
- (Exp.ident
- {
- txt = Ldot (element_binding, "someElement");
- loc = Location.none;
- })
- [(Nolabel, children)],
- true );
- ]
- | ListLiteral {pexp_desc = Pexp_array list} when list = [] -> []
- | ListLiteral expression ->
- (* this is a hack to support react components that introspect into their children *)
- children_arg := Some expression;
- [
- ( labelled "children",
- Exp.apply
- (Exp.ident
- {txt = module_access_name config "array"; loc = Location.none})
- [(Nolabel, expression)],
- false );
- ]
- in
- let is_empty_record {pexp_desc} =
- match pexp_desc with
- | Pexp_record (label_decls, _) when List.length label_decls = 0 -> true
- | _ -> false
- in
- let record = record_from_props ~loc:jsx_expr_loc ~remove_key:true args in
- let props =
- if is_empty_record record then empty_record ~loc:jsx_expr_loc else record
- in
- let key_prop =
- args
- |> List.filter_map (fun (arg_label, e, _opt) ->
- if "key" = get_label arg_label then Some (arg_label, e) else None)
- in
- let jsx_expr, key_and_unit =
- match (!children_arg, key_prop) with
- | None, key :: _ ->
- ( Exp.ident
- {loc = Location.none; txt = Ldot (element_binding, "jsxKeyed")},
- [key; (nolabel, unit_expr ~loc:Location.none)] )
- | None, [] ->
- ( Exp.ident {loc = Location.none; txt = Ldot (element_binding, "jsx")},
- [] )
- | Some _, key :: _ ->
- ( Exp.ident
- {loc = Location.none; txt = Ldot (element_binding, "jsxsKeyed")},
- [key; (nolabel, unit_expr ~loc:Location.none)] )
- | Some _, [] ->
- ( Exp.ident {loc = Location.none; txt = Ldot (element_binding, "jsxs")},
- [] )
- in
- Exp.apply ~loc:jsx_expr_loc ~attrs jsx_expr
- ([(nolabel, component_name_expr); (nolabel, props)] @ key_and_unit)
- | _ ->
- let children, non_children_props =
- extract_children ~loc:jsx_expr_loc call_arguments
- in
- let children_expr = transform_children_if_list ~mapper children in
- let create_element_call =
- match children with
- (* [@JSX] div(~children=[a]), coming from
a
*)
- | {
- pexp_desc =
- ( Pexp_construct ({txt = Lident "::"}, Some {pexp_desc = Pexp_tuple _})
- | Pexp_construct ({txt = Lident "[]"}, None) );
- } ->
- "createDOMElementVariadic"
- (* [@JSX] div(~children= value), coming from ...(value)
*)
- | {pexp_loc} ->
- Jsx_common.raise_error ~loc:pexp_loc
- "A spread as a DOM element's children don't make sense written \
- together. You can simply remove the spread."
- in
- let args =
- match non_children_props with
- | [_justTheUnitArgumentAtEnd] ->
- [
- (* "div" *)
- (nolabel, component_name_expr);
- (* [|moreCreateElementCallsHere|] *)
- (nolabel, children_expr);
- ]
- | non_empty_props ->
- let props_record =
- record_from_props ~loc:Location.none ~remove_key:false
- (non_empty_props |> List.map (fun (l, e) -> (l, e, false)))
- in
- [
- (* "div" *)
- (nolabel, component_name_expr);
- (* ReactDOM.domProps(~className=blabla, ~foo=bar, ()) *)
- (labelled "props", props_record);
- (* [|moreCreateElementCallsHere|] *)
- (nolabel, children_expr);
- ]
- in
- Exp.apply ~loc:jsx_expr_loc ~attrs
- (* ReactDOM.createElement *)
- (Exp.ident
- {
- loc = Location.none;
- txt = Ldot (Lident "ReactDOM", create_element_call);
- })
- args
+ let children, non_children_props =
+ extract_children ~loc:jsx_expr_loc call_arguments
+ in
+ let args_for_make = non_children_props in
+ let children_expr = transform_children_if_list_upper ~mapper children in
+ let recursively_transformed_args_for_make =
+ args_for_make
+ |> List.map (fun (label, expression) ->
+ (label, mapper.expr mapper expression, false))
+ in
+ let children_arg = ref None in
+ let args =
+ recursively_transformed_args_for_make
+ @
+ match children_expr with
+ | Exact children ->
+ [
+ ( labelled "children",
+ Exp.apply
+ (Exp.ident
+ {
+ txt = Ldot (element_binding, "someElement");
+ loc = Location.none;
+ })
+ [(Nolabel, children)],
+ true );
+ ]
+ | ListLiteral {pexp_desc = Pexp_array list} when list = [] -> []
+ | ListLiteral expression ->
+ (* this is a hack to support react components that introspect into their children *)
+ children_arg := Some expression;
+ [
+ ( labelled "children",
+ Exp.apply
+ (Exp.ident
+ {txt = module_access_name config "array"; loc = Location.none})
+ [(Nolabel, expression)],
+ false );
+ ]
+ in
+ let is_empty_record {pexp_desc} =
+ match pexp_desc with
+ | Pexp_record (label_decls, _) when List.length label_decls = 0 -> true
+ | _ -> false
+ in
+ let record = record_from_props ~loc:jsx_expr_loc ~remove_key:true args in
+ let props =
+ if is_empty_record record then empty_record ~loc:jsx_expr_loc else record
+ in
+ let key_prop =
+ args
+ |> List.filter_map (fun (arg_label, e, _opt) ->
+ if "key" = get_label arg_label then Some (arg_label, e) else None)
+ in
+ let jsx_expr, key_and_unit =
+ match (!children_arg, key_prop) with
+ | None, key :: _ ->
+ ( Exp.ident {loc = Location.none; txt = Ldot (element_binding, "jsxKeyed")},
+ [key; (nolabel, unit_expr ~loc:Location.none)] )
+ | None, [] ->
+ (Exp.ident {loc = Location.none; txt = Ldot (element_binding, "jsx")}, [])
+ | Some _, key :: _ ->
+ ( Exp.ident
+ {loc = Location.none; txt = Ldot (element_binding, "jsxsKeyed")},
+ [key; (nolabel, unit_expr ~loc:Location.none)] )
+ | Some _, [] ->
+ (Exp.ident {loc = Location.none; txt = Ldot (element_binding, "jsxs")}, [])
+ in
+ Exp.apply ~loc:jsx_expr_loc ~attrs jsx_expr
+ ([(nolabel, component_name_expr); (nolabel, props)] @ key_and_unit)
let rec recursively_transform_named_args_for_make expr args newtypes core_type =
match expr.pexp_desc with
@@ -1568,11 +1464,7 @@ let expr ~config mapper expression =
| _, non_jsx_attributes ->
let loc = {loc with loc_ghost = true} in
let fragment =
- match config.mode with
- | "automatic" ->
- Exp.ident ~loc {loc; txt = module_access_name config "jsxFragment"}
- | "classic" | _ ->
- Exp.ident ~loc {loc; txt = Ldot (Lident "React", "fragment")}
+ Exp.ident ~loc {loc; txt = module_access_name config "jsxFragment"}
in
let children_expr = transform_children_if_list ~mapper list_items in
let record_of_children children =
@@ -1596,39 +1488,22 @@ let expr ~config mapper expression =
match children with
| [] -> empty_record ~loc:Location.none
| [child] -> record_of_children child
- | _ -> (
- match config.mode with
- | "automatic" -> record_of_children @@ apply_jsx_array children_expr
- | "classic" | _ -> empty_record ~loc:Location.none))
- | _ -> (
- match config.mode with
- | "automatic" -> record_of_children @@ apply_jsx_array children_expr
- | "classic" | _ -> empty_record ~loc:Location.none)
+ | _ -> record_of_children @@ apply_jsx_array children_expr)
+ | _ -> record_of_children @@ apply_jsx_array children_expr
in
let args =
- (nolabel, fragment)
- :: (nolabel, transform_children_to_props children_expr)
- ::
- (match config.mode with
- | "classic" when count_of_children children_expr > 1 ->
- [(nolabel, children_expr)]
- | _ -> [])
+ [
+ (nolabel, fragment);
+ (nolabel, transform_children_to_props children_expr);
+ ]
in
Exp.apply
~loc (* throw away the [@JSX] attribute and keep the others, if any *)
~attrs:non_jsx_attributes
(* ReactDOM.createElement *)
- (match config.mode with
- | "automatic" ->
- if count_of_children children_expr > 1 then
- Exp.ident ~loc {loc; txt = module_access_name config "jsxs"}
- else Exp.ident ~loc {loc; txt = module_access_name config "jsx"}
- | "classic" | _ ->
- if count_of_children children_expr > 1 then
- Exp.ident ~loc
- {loc; txt = Ldot (Lident "React", "createElementVariadic")}
- else
- Exp.ident ~loc {loc; txt = Ldot (Lident "React", "createElement")})
+ (if count_of_children children_expr > 1 then
+ Exp.ident ~loc {loc; txt = module_access_name config "jsxs"}
+ else Exp.ident ~loc {loc; txt = module_access_name config "jsx"})
args)
(* Delegate to the default mapper, a deep identity traversal *)
| e -> default_mapper.expr mapper e
diff --git a/lib/es6/JsxPPXReactSupport.js b/lib/es6/JsxPPXReactSupport.js
deleted file mode 100644
index 0c02a43e4d..0000000000
--- a/lib/es6/JsxPPXReactSupport.js
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-import * as React from "react";
-
-function createElementWithKey(key, component, props) {
- return React.createElement(component, key !== undefined ? Object.assign({
- key: key
- }, props) : props);
-}
-
-function createElementVariadicWithKey(key, component, props, elements) {
- return React.createElement(component, key !== undefined ? Object.assign({
- key: key
- }, props) : props, ...elements);
-}
-
-export {
- createElementWithKey,
- createElementVariadicWithKey,
-}
-/* react Not a pure module */
diff --git a/lib/js/JsxPPXReactSupport.js b/lib/js/JsxPPXReactSupport.js
deleted file mode 100644
index 80d0be56af..0000000000
--- a/lib/js/JsxPPXReactSupport.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-let React = require("react");
-
-function createElementWithKey(key, component, props) {
- return React.createElement(component, key !== undefined ? Object.assign({
- key: key
- }, props) : props);
-}
-
-function createElementVariadicWithKey(key, component, props, elements) {
- return React.createElement(component, key !== undefined ? Object.assign({
- key: key
- }, props) : props, ...elements);
-}
-
-exports.createElementWithKey = createElementWithKey;
-exports.createElementVariadicWithKey = createElementVariadicWithKey;
-/* react Not a pure module */
diff --git a/packages/artifacts.txt b/packages/artifacts.txt
index d98468c585..c1a1c68f7d 100644
--- a/packages/artifacts.txt
+++ b/packages/artifacts.txt
@@ -115,7 +115,6 @@ lib/es6/Jsx.js
lib/es6/JsxDOM.js
lib/es6/JsxDOMStyle.js
lib/es6/JsxEvent.js
-lib/es6/JsxPPXReactSupport.js
lib/es6/Lazy.js
lib/es6/Obj.js
lib/es6/Pervasives.js
@@ -287,7 +286,6 @@ lib/js/Jsx.js
lib/js/JsxDOM.js
lib/js/JsxDOMStyle.js
lib/js/JsxEvent.js
-lib/js/JsxPPXReactSupport.js
lib/js/Lazy.js
lib/js/Obj.js
lib/js/Pervasives.js
@@ -808,10 +806,6 @@ lib/ocaml/JsxEvent.cmi
lib/ocaml/JsxEvent.cmj
lib/ocaml/JsxEvent.cmt
lib/ocaml/JsxEvent.res
-lib/ocaml/JsxPPXReactSupport.cmi
-lib/ocaml/JsxPPXReactSupport.cmj
-lib/ocaml/JsxPPXReactSupport.cmt
-lib/ocaml/JsxPPXReactSupport.res
lib/ocaml/Lazy.cmi
lib/ocaml/Lazy.cmj
lib/ocaml/Lazy.cmt
diff --git a/runtime/JsxPPXReactSupport.res b/runtime/JsxPPXReactSupport.res
deleted file mode 100644
index 824203df57..0000000000
--- a/runtime/JsxPPXReactSupport.res
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 2022- Authors of ReScript
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * In addition to the permissions granted to you by the LGPL, you may combine
- * or link a "work that uses the Library" with a publicly distributed version
- * of this file to produce a combined library or application, then distribute
- * that combined work under the terms of your choosing, with no requirement
- * to comply with the obligations normally placed on you by section 4 of the
- * LGPL version 3 (or the corresponding section of a later version of the LGPL
- * should you choose to use a later version).
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-%%private(
- @val
- external propsWithKey: ({"key": string}, 'props) => 'props = "Object.assign"
-
- @inline
- let addKeyProp = (~key: option=?, p: 'props): 'props =>
- switch key {
- | Some(key) => propsWithKey({"key": key}, p)
- | None => p
- }
-)
-
-@module("react")
-external createElement: (Jsx.component<'props>, 'props) => Jsx.element = "createElement"
-
-@variadic @module("react")
-external createElementVariadic: (Jsx.component<'props>, 'props, array) => Jsx.element =
- "createElement"
-
-let createElementWithKey = (~key=?, component, props) =>
- createElement(component, addKeyProp(~key?, props))
-
-let createElementVariadicWithKey = (~key=?, component, props, elements) =>
- createElementVariadic(component, addKeyProp(~key?, props), elements)
-
-external asyncComponent: promise => Jsx.element = "%identity"
diff --git a/scripts/test_syntax.sh b/scripts/test_syntax.sh
index 78d7c9ae93..d3d735825e 100755
--- a/scripts/test_syntax.sh
+++ b/scripts/test_syntax.sh
@@ -45,13 +45,13 @@ done temp/files.txt
while read file; do
- $DUNE_BIN_DIR/res_parser -test-ast-conversion -jsx-version 4 -jsx-mode "automatic" $file &> $(exp $file) & maybeWait
+ $DUNE_BIN_DIR/res_parser -test-ast-conversion -jsx-version 4 $file &> $(exp $file) & maybeWait
done temp/files.txt
while read file; do
- $DUNE_BIN_DIR/res_parser -jsx-version 4 -jsx-mode "automatic" $file &> $(exp $file) & maybeWait
+ $DUNE_BIN_DIR/res_parser -jsx-version 4 $file &> $(exp $file) & maybeWait
done {
diff --git a/tests/analysis_tests/tests/src/CompletionJsxProps.res b/tests/analysis_tests/tests/src/CompletionJsxProps.res
index 2c618f412b..e9fe8dafe6 100644
--- a/tests/analysis_tests/tests/src/CompletionJsxProps.res
+++ b/tests/analysis_tests/tests/src/CompletionJsxProps.res
@@ -35,7 +35,7 @@ let tsomeVar = #two
// let _ = import(CompletableComponent.make)
diff --git a/tests/analysis_tests/tests/src/typeConstraint.res b/tests/analysis_tests/tests/src/typeConstraint.res
index f40fd322bf..16fa7e2a84 100644
--- a/tests/analysis_tests/tests/src/typeConstraint.res
+++ b/tests/analysis_tests/tests/src/typeConstraint.res
@@ -1,15 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- @react.component
- let make:
- type a. (~a: a, ~b: a, a) => React.element =
- (~a, ~b, _) =>
-}
-
-let v4c =
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4A = {
@react.component
diff --git a/tests/build_tests/jsx_settings_inheritance/node_modules/a/src/A.mjs b/tests/build_tests/jsx_settings_inheritance/node_modules/a/src/A.mjs
index 87355093a9..cdd60ab268 100644
--- a/tests/build_tests/jsx_settings_inheritance/node_modules/a/src/A.mjs
+++ b/tests/build_tests/jsx_settings_inheritance/node_modules/a/src/A.mjs
@@ -1,13 +1,15 @@
// Generated by ReScript, PLEASE EDIT WITH CARE
'use strict';
-let React = require("react");
+let JsxRuntime = require("react/jsx-runtime");
function A(props) {
- return React.createElement("div", undefined, "This is A");
+ return JsxRuntime.jsx("div", {
+ children: "This is A"
+ });
}
let make = A;
exports.make = make;
-/* react Not a pure module */
+/* react/jsx-runtime Not a pure module */
diff --git a/tests/build_tests/super_errors/input.js b/tests/build_tests/super_errors/input.js
index f7375a9933..ffe4642523 100644
--- a/tests/build_tests/super_errors/input.js
+++ b/tests/build_tests/super_errors/input.js
@@ -12,7 +12,7 @@ const fixtures = fs
.filter(fileName => path.extname(fileName) === ".res");
// const runtime = path.join(__dirname, '..', '..', 'runtime')
-const prefix = `${bsc} -w +A -bs-jsx 4 -bs-jsx-mode automatic`;
+const prefix = `${bsc} -w +A -bs-jsx 4`;
const updateTests = process.argv[2] === "update";
diff --git a/tests/syntax_tests/data/ppx/react/aliasProps.res b/tests/syntax_tests/data/ppx/react/aliasProps.res
index 8c183b9415..b09c439f10 100644
--- a/tests/syntax_tests/data/ppx/react/aliasProps.res
+++ b/tests/syntax_tests/data/ppx/react/aliasProps.res
@@ -1,4 +1,4 @@
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module C0 = {
@react.component
diff --git a/tests/syntax_tests/data/ppx/react/expected/aliasProps.res.txt b/tests/syntax_tests/data/ppx/react/expected/aliasProps.res.txt
index 02248a9072..e9d0ab30a8 100644
--- a/tests/syntax_tests/data/ppx/react/expected/aliasProps.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/aliasProps.res.txt
@@ -1,4 +1,4 @@
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module C0 = {
@res.jsxComponentProps
diff --git a/tests/syntax_tests/data/ppx/react/expected/externalWithCustomName.res.txt b/tests/syntax_tests/data/ppx/react/expected/externalWithCustomName.res.txt
index 3eadedfee0..c0ece33e20 100644
--- a/tests/syntax_tests/data/ppx/react/expected/externalWithCustomName.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/externalWithCustomName.res.txt
@@ -1,16 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module Foo = {
- @res.jsxComponentProps @live
- type props<'a, 'b> = {a: 'a, b: 'b}
-
- @module("Foo")
- external component: React.componentLike, React.element> = "component"
-}
-
-let t = React.createElement(Foo.component, {a: 1, b: {"1"}})
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module Foo = {
@res.jsxComponentProps @live
diff --git a/tests/syntax_tests/data/ppx/react/expected/externalWithRef.res.txt b/tests/syntax_tests/data/ppx/react/expected/externalWithRef.res.txt
index 8ae1b0b9d3..cce0f077f0 100644
--- a/tests/syntax_tests/data/ppx/react/expected/externalWithRef.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/externalWithRef.res.txt
@@ -1,29 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- @res.jsxComponentProps @live
- type props<'x, 'ref> = {
- x: 'x,
- ref?: 'ref,
- }
-
- @module("componentForwardRef")
- external make: React.componentLike, React.element> =
- "component"
-}
-
-module type V4CType = {
- @res.jsxComponentProps @live
- type props<'x, 'y> = {
- x: 'x,
- y: 'y,
- }
-
- @module("someModule")
- external make: React.componentLike, React.element> = "component"
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4C = {
@res.jsxComponentProps @live
diff --git a/tests/syntax_tests/data/ppx/react/expected/externalWithTypeVariables.res.txt b/tests/syntax_tests/data/ppx/react/expected/externalWithTypeVariables.res.txt
index be16a6c22d..5d0966916d 100644
--- a/tests/syntax_tests/data/ppx/react/expected/externalWithTypeVariables.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/externalWithTypeVariables.res.txt
@@ -1,17 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- @res.jsxComponentProps @live
- type props<'x, 'children> = {
- x: 'x,
- children: 'children,
- }
-
- @module("c")
- external make: React.componentLike, React.element>, React.element> = "component"
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4C = {
@res.jsxComponentProps @live
diff --git a/tests/syntax_tests/data/ppx/react/expected/fileLevelConfig.res.txt b/tests/syntax_tests/data/ppx/react/expected/fileLevelConfig.res.txt
index a69192fa65..c11e849074 100644
--- a/tests/syntax_tests/data/ppx/react/expected/fileLevelConfig.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/fileLevelConfig.res.txt
@@ -1,20 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- @res.jsxComponentProps
- type props<'msg> = {msg: 'msg}
-
- let make = ({msg, _}: props<_>) => {
- ReactDOM.createDOMElementVariadic("div", [{msg->React.string}])
- }
- let make = {
- let \"FileLevelConfig$V4C" = (props: props<_>) => make(props)
-
- \"FileLevelConfig$V4C"
- }
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4A = {
@res.jsxComponentProps
diff --git a/tests/syntax_tests/data/ppx/react/expected/firstClassModules.res.txt b/tests/syntax_tests/data/ppx/react/expected/firstClassModules.res.txt
deleted file mode 100644
index 934880c83a..0000000000
--- a/tests/syntax_tests/data/ppx/react/expected/firstClassModules.res.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module Select = {
- module type T = {
- type key
- type t
- }
- @res.jsxComponentProps
- type props<'model, 'selected, 'onChange, 'items> = {
- model: 'model,
- selected: 'selected,
- onChange: 'onChange,
- items: 'items,
- }
-
- let make = (
- type a key,
- {model: module(T: T with type t = a and type key = key), selected, onChange, items, _}: props<
- _,
- option,
- option => unit,
- array,
- >,
- ) => {
- let _ = (model, selected, onChange, items)
- ReactDOM.createDOMElementVariadic("div", [])
- }
- let make = {
- let \"FirstClassModules$Select" = (props: props<_>) => make(props)
-
- \"FirstClassModules$Select"
- }
-}
-
-module External = {
- module type T = {
- type key
- type t
- }
- @res.jsxComponentProps @live
- type props<'model, 'selected, 'onChange, 'items> = {
- model: 'model,
- selected: 'selected,
- onChange: 'onChange,
- items: 'items,
- }
-
- @module("c")
- external make: React.componentLike<
- props<
- module(T with type t = 'a and type key = 'key),
- option<'key>,
- option<'key> => unit,
- array<'a>,
- >,
- React.element,
- > = "default"
-}
diff --git a/tests/syntax_tests/data/ppx/react/expected/forwardRef.res.txt b/tests/syntax_tests/data/ppx/react/expected/forwardRef.res.txt
index 84afe72df2..9b8b541317 100644
--- a/tests/syntax_tests/data/ppx/react/expected/forwardRef.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/forwardRef.res.txt
@@ -1,120 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- module FancyInput = {
- @res.jsxComponentProps
- type props<'className, 'children, 'ref> = {
- className?: 'className,
- children: 'children,
- ref?: 'ref,
- }
-
- let make = (
- {?className, children, _}: props<_, _, ReactRef.currentDomRef>,
- ref: Js.Nullable.t,
- ) =>
- ReactDOM.createDOMElementVariadic(
- "div",
- [
- ReactDOM.createDOMElementVariadic(
- "input",
- ~props={
- type_: "text",
- ?className,
- ref: ?{Js.Nullable.toOption(ref)->Belt.Option.map(React.Ref.domRef)},
- },
- [],
- ),
- children,
- ],
- )
- let make = React.forwardRef({
- let \"ForwardRef$V4C$FancyInput" = (props: props<_>, ref) => make(props, ref)
-
- \"ForwardRef$V4C$FancyInput"
- })
- }
- @res.jsxComponentProps
- type props = {}
-
- let make = (_: props) => {
- let input = React.useRef(Js.Nullable.null)
-
- ReactDOM.createDOMElementVariadic(
- "div",
- [
- React.createElement(
- FancyInput.make,
- {ref: input, children: {React.string("Click to focus")}},
- ),
- ],
- )
- }
- let make = {
- let \"ForwardRef$V4C" = props => make(props)
-
- \"ForwardRef$V4C"
- }
-}
-
-module V4CUncurried = {
- module FancyInput = {
- @res.jsxComponentProps
- type props<'className, 'children, 'ref> = {
- className?: 'className,
- children: 'children,
- ref?: 'ref,
- }
-
- let make = (
- {?className, children, _}: props<_, _, ReactRef.currentDomRef>,
- ref: Js.Nullable.t,
- ) =>
- ReactDOM.createDOMElementVariadic(
- "div",
- [
- ReactDOM.createDOMElementVariadic(
- "input",
- ~props={
- type_: "text",
- ?className,
- ref: ?{Js.Nullable.toOption(ref)->Belt.Option.map(React.Ref.domRef)},
- },
- [],
- ),
- children,
- ],
- )
- let make = React.forwardRef({
- let \"ForwardRef$V4CUncurried$FancyInput" = (props: props<_>, ref) => make(props, ref)
-
- \"ForwardRef$V4CUncurried$FancyInput"
- })
- }
- @res.jsxComponentProps
- type props = {}
-
- let make = (_: props) => {
- let input = React.useRef(Js.Nullable.null)
-
- ReactDOM.createDOMElementVariadic(
- "div",
- [
- React.createElement(
- FancyInput.make,
- {ref: input, children: {React.string("Click to focus")}},
- ),
- ],
- )
- }
- let make = {
- let \"ForwardRef$V4CUncurried" = props => make(props)
-
- \"ForwardRef$V4CUncurried"
- }
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4A = {
module FancyInput = {
diff --git a/tests/syntax_tests/data/ppx/react/expected/fragment.res.txt b/tests/syntax_tests/data/ppx/react/expected/fragment.res.txt
index d1e0f1dc67..80c3bb1d86 100644
--- a/tests/syntax_tests/data/ppx/react/expected/fragment.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/fragment.res.txt
@@ -1,40 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-let _ = React.createElement(React.fragment, {})
-let _ = React.createElement(
- React.fragment,
- {children: ReactDOM.createDOMElementVariadic("div", [])},
-)
-let _ = React.createElementVariadic(
- React.fragment,
- {},
- [ReactDOM.createDOMElementVariadic("div", []), ReactDOM.createDOMElementVariadic("div", [])],
-)
-let _ = React.createElement(React.fragment, {children: React.createElement(React.fragment, {})})
-let _ = React.createElement(Z.make, {})
-let _ = React.createElement(Z.make, {children: ReactDOM.createDOMElementVariadic("div", [])})
-let _ = React.createElement(
- Z.make,
- {a: "a", children: ReactDOM.createDOMElementVariadic("div", [])},
-)
-let _ = React.createElementVariadic(
- Z.make,
- {children: React.null},
- [ReactDOM.createDOMElementVariadic("div", []), ReactDOM.createDOMElementVariadic("div", [])],
-)
-let _ = ReactDOM.createDOMElementVariadic("div", [])
-let _ = ReactDOM.createDOMElementVariadic("div", [ReactDOM.createDOMElementVariadic("div", [])])
-let _ = ReactDOM.createDOMElementVariadic(
- "div",
- ~props={id: "id"},
- [ReactDOM.createDOMElementVariadic("div", [])],
-)
-let _ = ReactDOM.createDOMElementVariadic(
- "div",
- [ReactDOM.createDOMElementVariadic("div", []), ReactDOM.createDOMElementVariadic("div", [])],
-)
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
let _ = React.jsx(React.jsxFragment, {})
let _ = React.jsx(React.jsxFragment, {children: ReactDOM.jsx("div", {})})
diff --git a/tests/syntax_tests/data/ppx/react/expected/lowercases.res.txt b/tests/syntax_tests/data/ppx/react/expected/lowercases.res.txt
deleted file mode 100644
index 262c7aac26..0000000000
--- a/tests/syntax_tests/data/ppx/react/expected/lowercases.res.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-let _ = ReactDOM.createDOMElementVariadic("div", [])
-let _ = ReactDOM.createDOMElementVariadic("div", ~props={key: "k"}, [])
-let _ = ReactDOM.createDOMElementVariadic("div", ~props={x: x}, [])
-let _ = ReactDOM.createDOMElementVariadic(
- "div",
- [ReactDOM.createDOMElementVariadic("p", [{React.string(x)}])],
-)
-let _ = ReactDOM.createDOMElementVariadic("div", ~props=str, [])
-let _ = ReactDOM.createDOMElementVariadic("div", ~props={...str, x: "x"}, [])
-
-// syntax error
-// let _ =
-// let _ =
diff --git a/tests/syntax_tests/data/ppx/react/expected/mangleKeyword.res.txt b/tests/syntax_tests/data/ppx/react/expected/mangleKeyword.res.txt
index 9c42648632..1103c8267d 100644
--- a/tests/syntax_tests/data/ppx/react/expected/mangleKeyword.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/mangleKeyword.res.txt
@@ -1,27 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module C4C0 = {
- @res.jsxComponentProps
- type props<'T_open, 'T_type> = {@as("open") _open: 'T_open, @as("type") _type: 'T_type}
-
- let make = ({@as("open") _open, @as("type") _type, _}: props<_, string>) => React.string(_open)
- let make = {
- let \"MangleKeyword$C4C0" = (props: props<_>) => make(props)
-
- \"MangleKeyword$C4C0"
- }
-}
-module C4C1 = {
- @res.jsxComponentProps @live
- type props<'T_open, 'T_type> = {@as("open") _open: 'T_open, @as("type") _type: 'T_type}
-
- external make: @as("open") React.componentLike, React.element> = "default"
-}
-
-let c4c0 = React.createElement(C4C0.make, {_open: "x", _type: "t"})
-let c4c1 = React.createElement(C4C1.make, {_open: "x", _type: "t"})
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module C4A0 = {
@res.jsxComponentProps
diff --git a/tests/syntax_tests/data/ppx/react/expected/newtype.res.txt b/tests/syntax_tests/data/ppx/react/expected/newtype.res.txt
index afc0ad4f8d..fb513bf122 100644
--- a/tests/syntax_tests/data/ppx/react/expected/newtype.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/newtype.res.txt
@@ -1,19 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- @res.jsxComponentProps
- type props<'a, 'b, 'c> = {a: 'a, b: 'b, c: 'c}
-
- let make = (type a, {a, b, c, _}: props>, 'a>) =>
- ReactDOM.createDOMElementVariadic("div", [])
- let make = {
- let \"Newtype$V4C" = (props: props<_>) => make(props)
-
- \"Newtype$V4C"
- }
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4A = {
@res.jsxComponentProps
diff --git a/tests/syntax_tests/data/ppx/react/expected/noPropsWithKey.res.txt b/tests/syntax_tests/data/ppx/react/expected/noPropsWithKey.res.txt
index 4acf55ebdb..21d9d0c417 100644
--- a/tests/syntax_tests/data/ppx/react/expected/noPropsWithKey.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/noPropsWithKey.res.txt
@@ -1,46 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4CA = {
- @res.jsxComponentProps
- type props = {}
-
- let make = (_: props) => ReactDOM.createDOMElementVariadic("div", [])
- let make = {
- let \"NoPropsWithKey$V4CA" = props => make(props)
-
- \"NoPropsWithKey$V4CA"
- }
-}
-
-module V4CB = {
- @res.jsxComponentProps @live
- type props = {}
-
- @module("c")
- external make: React.componentLike = "component"
-}
-
-module V4C = {
- @res.jsxComponentProps
- type props = {}
-
- let make = (_: props) =>
- React.createElementVariadic(
- React.fragment,
- {},
- [
- JsxPPXReactSupport.createElementWithKey(~key="k", V4CA.make, {}),
- JsxPPXReactSupport.createElementWithKey(~key="k", V4CB.make, {}),
- ],
- )
- let make = {
- let \"NoPropsWithKey$V4C" = props => make(props)
-
- \"NoPropsWithKey$V4C"
- }
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4CA = {
@res.jsxComponentProps
diff --git a/tests/syntax_tests/data/ppx/react/expected/optimizeAutomaticMode.res.txt b/tests/syntax_tests/data/ppx/react/expected/optimizeAutomaticMode.res.txt
index 4dbaf2e084..19a34b8d05 100644
--- a/tests/syntax_tests/data/ppx/react/expected/optimizeAutomaticMode.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/optimizeAutomaticMode.res.txt
@@ -1,4 +1,4 @@
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module User = {
type t = {firstName: string, lastName: string}
diff --git a/tests/syntax_tests/data/ppx/react/expected/optionalKeyType.res.txt b/tests/syntax_tests/data/ppx/react/expected/optionalKeyType.res.txt
index dca95b859d..0420bce343 100644
--- a/tests/syntax_tests/data/ppx/react/expected/optionalKeyType.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/optionalKeyType.res.txt
@@ -1,30 +1,6 @@
let key = None
-@@jsxConfig({version: 4, mode: "classic"})
-
-let _ = JsxPPXReactSupport.createElementWithKey(~key="k", C.make, {})
-let _ = JsxPPXReactSupport.createElementWithKey(~key=?Some("k"), C.make, {})
-let _ = JsxPPXReactSupport.createElementWithKey(~key?, C.make, {})
-let _ = ReactDOM.createDOMElementVariadic("div", ~props={key: "k"}, [])
-let _ = ReactDOM.createDOMElementVariadic("div", ~props={key: ?Some("k")}, [])
-let _ = ReactDOM.createDOMElementVariadic("div", ~props={key: ?key}, [])
-let _ = ReactDOM.createDOMElementVariadic(
- "div",
- ~props={key: "k"},
- [ReactDOM.createDOMElementVariadic("br", []), ReactDOM.createDOMElementVariadic("br", [])],
-)
-let _ = ReactDOM.createDOMElementVariadic(
- "div",
- ~props={key: ?Some("k")},
- [ReactDOM.createDOMElementVariadic("br", []), ReactDOM.createDOMElementVariadic("br", [])],
-)
-let _ = ReactDOM.createDOMElementVariadic(
- "div",
- ~props={key: ?key},
- [ReactDOM.createDOMElementVariadic("br", []), ReactDOM.createDOMElementVariadic("br", [])],
-)
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
let _ = React.jsxKeyed(C.make, {}, ~key="k", ())
let _ = React.jsxKeyed(C.make, {}, ~key=?Some("k"), ())
diff --git a/tests/syntax_tests/data/ppx/react/expected/removedKeyProp.res.txt b/tests/syntax_tests/data/ppx/react/expected/removedKeyProp.res.txt
deleted file mode 100644
index b2f3551db3..0000000000
--- a/tests/syntax_tests/data/ppx/react/expected/removedKeyProp.res.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module Foo = {
- @res.jsxComponentProps
- type props<'x, 'y> = {x: 'x, y: 'y}
-
- let make = ({x, y, _}: props<_, _>) => React.string(x ++ y)
- let make = {
- let \"RemovedKeyProp$Foo" = (props: props<_>) => make(props)
-
- \"RemovedKeyProp$Foo"
- }
-}
-
-module HasChildren = {
- @res.jsxComponentProps
- type props<'children> = {children: 'children}
-
- let make = ({children, _}: props<_>) => React.createElement(React.fragment, {children: children})
- let make = {
- let \"RemovedKeyProp$HasChildren" = (props: props<_>) => make(props)
-
- \"RemovedKeyProp$HasChildren"
- }
-}
-@res.jsxComponentProps
-type props = {}
-
-let make = (_: props) =>
- React.createElementVariadic(
- React.fragment,
- {},
- [
- JsxPPXReactSupport.createElementWithKey(~key="k", Foo.make, {x: "x", y: "y"}),
- React.createElement(Foo.make, {x: "x", y: "y"}),
- JsxPPXReactSupport.createElementWithKey(
- ~key="k",
- HasChildren.make,
- {
- children: React.createElement(Foo.make, {x: "x", y: "y"}),
- },
- ),
- React.createElement(
- HasChildren.make,
- {
- children: React.createElement(Foo.make, {x: "x", y: "y"}),
- },
- ),
- ],
- )
-let make = {
- let \"RemovedKeyProp" = props => make(props)
-
- \"RemovedKeyProp"
-}
diff --git a/tests/syntax_tests/data/ppx/react/expected/sharedProps.res.txt b/tests/syntax_tests/data/ppx/react/expected/sharedProps.res.txt
index c200b5ba3a..a878b7e544 100644
--- a/tests/syntax_tests/data/ppx/react/expected/sharedProps.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/sharedProps.res.txt
@@ -1,74 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C1 = {
- type props = sharedProps
-
- let make = ({x, y, _}: props) => React.string(x ++ y)
- let make = {
- let \"SharedProps$V4C1" = props => make(props)
-
- \"SharedProps$V4C1"
- }
-}
-
-module V4C2 = {
- type props<'a> = sharedProps<'a>
-
- let make = ({x, y, _}: props<_>) => React.string(x ++ y)
- let make = {
- let \"SharedProps$V4C2" = (props: props<_>) => make(props)
-
- \"SharedProps$V4C2"
- }
-}
-
-module V4C3 = {
- type props<'a> = sharedProps
-
- let make = ({x, y, _}: props<_>) => React.string(x ++ y)
- let make = {
- let \"SharedProps$V4C3" = (props: props<_>) => make(props)
-
- \"SharedProps$V4C3"
- }
-}
-
-module V4C4 = {
- type props = sharedProps
-
- let make = ({x, y, _}: props) => React.string(x ++ y)
- let make = {
- let \"SharedProps$V4C4" = props => make(props)
-
- \"SharedProps$V4C4"
- }
-}
-
-module V4C5 = {
- type props = sharedProps
-
- external make: React.componentLike = "default"
-}
-
-module V4C6 = {
- type props<'a> = sharedProps<'a>
-
- external make: React.componentLike, React.element> = "default"
-}
-
-module V4C7 = {
- type props<'a> = sharedProps
-
- external make: React.componentLike, React.element> = "default"
-}
-
-module V4C8 = {
- type props = sharedProps
-
- external make: React.componentLike = "default"
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4A1 = {
type props = sharedProps
diff --git a/tests/syntax_tests/data/ppx/react/expected/sharedPropsWithProps.res.txt b/tests/syntax_tests/data/ppx/react/expected/sharedPropsWithProps.res.txt
index f0e4dd013d..b1f4205c36 100644
--- a/tests/syntax_tests/data/ppx/react/expected/sharedPropsWithProps.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/sharedPropsWithProps.res.txt
@@ -1,72 +1,6 @@
let f = a => Js.Promise.resolve(a + a)
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C1 = {
- type props = sharedProps
- let make = props => React.string(props.x ++ props.y)
- let make = {
- let \"SharedPropsWithProps$V4C1" = props => make(props)
- \"SharedPropsWithProps$V4C1"
- }
-}
-
-module V4C2 = {
- type props = sharedProps
- let make = (props: props) => React.string(props.x ++ props.y)
- let make = {
- let \"SharedPropsWithProps$V4C2" = (props: props) => make(props)
- \"SharedPropsWithProps$V4C2"
- }
-}
-
-module V4C3 = {
- type props<'a> = sharedProps<'a>
- let make = ({x, y}: props<_>) => React.string(x ++ y)
- let make = {
- let \"SharedPropsWithProps$V4C3" = (props: props<_>) => make(props)
- \"SharedPropsWithProps$V4C3"
- }
-}
-
-module V4C4 = {
- type props<'a> = sharedProps
- let make = ({x, y}: props<_>) => React.string(x ++ y)
- let make = {
- let \"SharedPropsWithProps$V4C4" = (props: props<_>) => make(props)
- \"SharedPropsWithProps$V4C4"
- }
-}
-
-module V4C5 = {
- type props<'a> = {a: 'a}
- let make = async ({a}: props<_>) => {
- let a = await f(a)
- ReactDOM.createDOMElementVariadic("div", [{React.int(a)}])
- }
- let make = {
- let \"SharedPropsWithProps$V4C5" = (props: props<_>) =>
- JsxPPXReactSupport.asyncComponent(make(props))
- \"SharedPropsWithProps$V4C5"
- }
-}
-
-module V4C6 = {
- type props<'status> = {status: 'status}
- let make = async ({status}: props<_>) => {
- switch status {
- | #on => React.string("on")
- | #off => React.string("off")
- }
- }
- let make = {
- let \"SharedPropsWithProps$V4C6" = (props: props<_>) =>
- JsxPPXReactSupport.asyncComponent(make(props))
- \"SharedPropsWithProps$V4C6"
- }
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4A1 = {
type props = sharedProps
diff --git a/tests/syntax_tests/data/ppx/react/expected/spreadProps.res.txt b/tests/syntax_tests/data/ppx/react/expected/spreadProps.res.txt
index 00fba0199b..db116ee8d8 100644
--- a/tests/syntax_tests/data/ppx/react/expected/spreadProps.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/spreadProps.res.txt
@@ -1,37 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-// Error: spreadProps should be first in order than other props
-// let c0 =
-
-// Error: multiple spreadProps not allowed
-// let c0 =
-
-// only spread props
-let c1 = React.createElement(A.make, p)
-
-// reversed order
-let c2 = React.createElement(A.make, {...p, x: "x"})
-
-let c3 = ReactDOM.createDOMElementVariadic("div", ~props=p, [])
-
-let c4 = ReactDOM.createDOMElementVariadic("div", ~props={...p, x: "x", key: "k"}, [])
-
-let c4 = ReactDOM.createDOMElementVariadic(
- "div",
- ~props={...p, key: "k"},
- [ReactDOM.createDOMElementVariadic("br", []), ReactDOM.createDOMElementVariadic("br", [])],
-)
-
-let c5 = ReactDOM.createDOMElementVariadic(
- "div",
- ~props={...p, key: "k"},
- [ReactDOM.createDOMElementVariadic("br", []), ReactDOM.createDOMElementVariadic("br", [])],
-)
-
-// both need to be parsed
-let c6 = React.createElement(A.make, params->Obj.magic)
-let c7 = React.createElement(A.make, params->Obj.magic)
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
// Error: spreadProps should be first in order than other props
// let c0 =
diff --git a/tests/syntax_tests/data/ppx/react/expected/topLevel.res.txt b/tests/syntax_tests/data/ppx/react/expected/topLevel.res.txt
index 8e50d91632..cbb6a01b6b 100644
--- a/tests/syntax_tests/data/ppx/react/expected/topLevel.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/topLevel.res.txt
@@ -1,21 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- @res.jsxComponentProps
- type props<'a, 'b> = {a: 'a, b: 'b}
-
- let make = ({a, b, _}: props<_, _>) => {
- Js.log("This function should be named 'TopLevel.react'")
- ReactDOM.createDOMElementVariadic("div", [])
- }
- let make = {
- let \"TopLevel$V4C" = (props: props<_>) => make(props)
-
- \"TopLevel$V4C"
- }
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4A = {
@res.jsxComponentProps
diff --git a/tests/syntax_tests/data/ppx/react/expected/typeConstraint.res.txt b/tests/syntax_tests/data/ppx/react/expected/typeConstraint.res.txt
index 75e141a375..c612921f06 100644
--- a/tests/syntax_tests/data/ppx/react/expected/typeConstraint.res.txt
+++ b/tests/syntax_tests/data/ppx/react/expected/typeConstraint.res.txt
@@ -1,18 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- @res.jsxComponentProps
- type props<'a, 'b> = {a: 'a, b: 'b}
-
- let make = (type a, {a, b, _}: props<_, _>) => ReactDOM.createDOMElementVariadic("div", [])
- let make = {
- let \"TypeConstraint$V4C" = (props: props<_>) => make(props)
-
- \"TypeConstraint$V4C"
- }
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4A = {
@res.jsxComponentProps
diff --git a/tests/syntax_tests/data/ppx/react/externalWithCustomName.res b/tests/syntax_tests/data/ppx/react/externalWithCustomName.res
index adcbe8f70d..add0e70701 100644
--- a/tests/syntax_tests/data/ppx/react/externalWithCustomName.res
+++ b/tests/syntax_tests/data/ppx/react/externalWithCustomName.res
@@ -1,13 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module Foo = {
- @react.component @module("Foo")
- external component: (~a: int, ~b: string, _) => React.element = "component"
-}
-
-let t =
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module Foo = {
@react.component @module("Foo")
diff --git a/tests/syntax_tests/data/ppx/react/externalWithRef.res b/tests/syntax_tests/data/ppx/react/externalWithRef.res
index 258f7f8043..339a9ad829 100644
--- a/tests/syntax_tests/data/ppx/react/externalWithRef.res
+++ b/tests/syntax_tests/data/ppx/react/externalWithRef.res
@@ -1,22 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- @module("componentForwardRef") @react.component
- external make: (
- ~x: string,
- ~ref: ReactDOM.Ref.currentDomRef=?,
- ) => React.element = "component"
-}
-
-module type V4CType = {
- @module("someModule") @react.component
- external make: (
- ~x: string,
- ~y: string,
- ) => React.element = "component"
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4C = {
@module("componentForwardRef") @react.component
diff --git a/tests/syntax_tests/data/ppx/react/externalWithTypeVariables.res b/tests/syntax_tests/data/ppx/react/externalWithTypeVariables.res
index 402590cf59..d0683f694b 100644
--- a/tests/syntax_tests/data/ppx/react/externalWithTypeVariables.res
+++ b/tests/syntax_tests/data/ppx/react/externalWithTypeVariables.res
@@ -1,14 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- @module("c") @react.component
- external make: (
- ~x: t<'a>,
- ~children: React.element,
- ) => React.element = "component"
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4C = {
@module("c") @react.component
diff --git a/tests/syntax_tests/data/ppx/react/fileLevelConfig.res b/tests/syntax_tests/data/ppx/react/fileLevelConfig.res
index b629e50e2c..0496083c1d 100644
--- a/tests/syntax_tests/data/ppx/react/fileLevelConfig.res
+++ b/tests/syntax_tests/data/ppx/react/fileLevelConfig.res
@@ -1,13 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- @react.component
- let make = (~msg) => {
- {msg->React.string}
- }
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4A = {
@react.component
diff --git a/tests/syntax_tests/data/ppx/react/firstClassModules.res b/tests/syntax_tests/data/ppx/react/firstClassModules.res
deleted file mode 100644
index e1c98d8ca1..0000000000
--- a/tests/syntax_tests/data/ppx/react/firstClassModules.res
+++ /dev/null
@@ -1,35 +0,0 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module Select = {
- module type T = {
- type key
- type t
- }
-
- @react.component
- let make = (
- type a key,
- ~model as module(T: T with type t = a and type key = key),
- ~selected: option,
- ~onChange: option => unit,
- ~items: array,
- ) => {
- let _ = (model, selected, onChange, items)
-
- }
-}
-
-module External = {
- module type T = {
- type key
- type t
- }
-
- @react.component @module("c")
- external make: (
- ~model: module(T with type t = 'a and type key = 'key),
- ~selected: option<'key>,
- ~onChange: option<'key> => unit,
- ~items: array<'a>,
- ) => React.element = "default"
-}
diff --git a/tests/syntax_tests/data/ppx/react/forwardRef.res b/tests/syntax_tests/data/ppx/react/forwardRef.res
index 12abf4e537..9a0756bc92 100644
--- a/tests/syntax_tests/data/ppx/react/forwardRef.res
+++ b/tests/syntax_tests/data/ppx/react/forwardRef.res
@@ -1,56 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- module FancyInput = {
- @react.component
- let make = React.forwardRef((~className=?, ~children, ref: Js.Nullable.t) =>
-
- Belt.Option.map(React.Ref.domRef)}
- />
- children
-
- )
- }
-
- @react.component
- let make = () => {
- let input = React.useRef(Js.Nullable.null)
-
-
- {React.string("Click to focus")}
-
- }
-}
-
-module V4CUncurried = {
- module FancyInput = {
- @react.component
- let make = React.forwardRef((. ~className=?, ~children, ref: Js.Nullable.t) =>
-
- Belt.Option.map(React.Ref.domRef)}
- />
- children
-
- )
- }
-
- @react.component
- let make = () => {
- let input = React.useRef(Js.Nullable.null)
-
-
- {React.string("Click to focus")}
-
- }
-}
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module V4A = {
module FancyInput = {
diff --git a/tests/syntax_tests/data/ppx/react/fragment.res b/tests/syntax_tests/data/ppx/react/fragment.res
index 741e169949..68b4bad484 100644
--- a/tests/syntax_tests/data/ppx/react/fragment.res
+++ b/tests/syntax_tests/data/ppx/react/fragment.res
@@ -1,19 +1,4 @@
-@@jsxConfig({version:4, mode: "classic"})
-
-let _ = <>>
-let _ = <>>
-let _ = <>>
-let _ = <><>>>
-let _ =
-let _ =
-let _ =
-let _ =
-let _ =
-let _ =
-let _ =
-let _ =
-
-@@jsxConfig({version:4, mode: "automatic"})
+@@jsxConfig({version:4})
let _ = <>>
let _ = <>>
diff --git a/tests/syntax_tests/data/ppx/react/lowercases.res b/tests/syntax_tests/data/ppx/react/lowercases.res
deleted file mode 100644
index 1dba63d96a..0000000000
--- a/tests/syntax_tests/data/ppx/react/lowercases.res
+++ /dev/null
@@ -1,12 +0,0 @@
-@@jsxConfig({version:4, mode:"classic"})
-
-let _ =
-let _ =
-let _ =
-let _ =
-let _ =
-let _ =
-
-// syntax error
-// let _ =
-// let _ =
\ No newline at end of file
diff --git a/tests/syntax_tests/data/ppx/react/mangleKeyword.res b/tests/syntax_tests/data/ppx/react/mangleKeyword.res
index f1a5304cc9..ce1d8feb28 100644
--- a/tests/syntax_tests/data/ppx/react/mangleKeyword.res
+++ b/tests/syntax_tests/data/ppx/react/mangleKeyword.res
@@ -1,20 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module C4C0 = {
- @react.component
- let make =
- (@as("open") ~_open, @as("type") ~_type: string) => React.string(_open)
-}
-module C4C1 = {
- @react.component
- external make: (@as("open") ~_open: string, @as("type") ~_type: string) => React.element =
- "default"
-}
-
-let c4c0 =
-let c4c1 =
-
-@@jsxConfig({version: 4, mode: "automatic"})
+@@jsxConfig({version: 4})
module C4A0 = {
@react.component
diff --git a/tests/syntax_tests/data/ppx/react/newtype.res b/tests/syntax_tests/data/ppx/react/newtype.res
index 688341e9d5..01dadffe53 100644
--- a/tests/syntax_tests/data/ppx/react/newtype.res
+++ b/tests/syntax_tests/data/ppx/react/newtype.res
@@ -1,11 +1,4 @@
-@@jsxConfig({version: 4, mode: "classic"})
-
-module V4C = {
- @react.component
- let make = (type a, ~a: a, ~b: array