diff --git a/CHANGELOG.md b/CHANGELOG.md index 87f9cfc420..7571de83df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ #### :nail_care: Polish - Format docstrings. https://github.com/rescript-lang/rescript-compiler/pull/6417 +- JSX v4 automatic mode as the default mode https://github.com/rescript-lang/rescript-compiler/pull/6552 # 11.0.0-rc.8 diff --git a/docs/JSXV4.md b/docs/JSXV4.md index f6fcbe7f3f..ce69c4e00c 100644 --- a/docs/JSXV4.md +++ b/docs/JSXV4.md @@ -43,7 +43,7 @@ Another example is a V4 project that also uses `"rescript-react-native", "rescri ### Classic and Automatic Mode -Classic mode is the default and generates calls to `React.createElement` just as with V3. +Classic mode generates calls to `React.createElement` just as with V3. ```json "jsx": { @@ -52,7 +52,7 @@ Classic mode is the default and generates calls to `React.createElement` just as } ``` -Automatic mode is an experimental mode that generate calls to `_jsx` functions (similar to TypeScript's `react-jsx` mode) +Automatic mode is the default and generates calls to `_jsx` functions (similar to TypeScript's `react-jsx` mode) ```json "jsx": { diff --git a/jscomp/common/js_config.ml b/jscomp/common/js_config.ml index 0b479fa4a7..ef3ad90b60 100644 --- a/jscomp/common/js_config.ml +++ b/jscomp/common/js_config.ml @@ -51,7 +51,7 @@ let force_cmi = ref false let force_cmj = ref false let jsx_version = ref None let jsx_module = ref React -let jsx_mode = ref Classic +let jsx_mode = ref Automatic let js_stdout = ref true let all_module_aliases = ref false let no_stdlib = ref false diff --git a/jscomp/gentype/ImportPath.mli b/jscomp/gentype/ImportPath.mli index 5f319d00bc..740e629f9a 100644 --- a/jscomp/gentype/ImportPath.mli +++ b/jscomp/gentype/ImportPath.mli @@ -3,7 +3,7 @@ open GenTypeCommon type t val bsCurryPath : config:Config.t -> t -val chopExtensionSafe : t -> t +val chopExtensionSafe : t -> t [@@live] val dump : t -> string val emit : t -> string val fromModule : dir:string -> importExtension:string -> ModuleName.t -> t diff --git a/jscomp/syntax/cli/res_cli.ml b/jscomp/syntax/cli/res_cli.ml index 224dec9073..bcc4024259 100644 --- a/jscomp/syntax/cli/res_cli.ml +++ b/jscomp/syntax/cli/res_cli.ml @@ -177,7 +177,7 @@ end = struct let interface = ref false let jsxVersion = ref (-1) let jsxModule = ref "react" - let jsxMode = ref "classic" + let jsxMode = ref "automatic" let file = ref "" let typechecker = ref false @@ -215,7 +215,7 @@ end = struct "Specify the jsx module. Default: react" ); ( "-jsx-mode", Arg.String (fun txt -> jsxMode := txt), - "Specify the jsx mode, classic or automatic. Default: classic" ); + "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 \