From 779a183f4f5ecb232d98f42abae8c9cba3a955ff Mon Sep 17 00:00:00 2001 From: mununki Date: Tue, 9 Jan 2024 01:27:54 +0900 Subject: [PATCH 1/4] JSX automatic mode as default --- docs/JSXV4.md | 4 ++-- jscomp/common/js_config.ml | 2 +- jscomp/others/belt_HashSetInt.resi | 8 ++++---- jscomp/others/belt_HashSetString.resi | 8 ++++---- jscomp/syntax/cli/res_cli.ml | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) 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/others/belt_HashSetInt.resi b/jscomp/others/belt_HashSetInt.resi index 05325e845a..85a7e6e541 100644 --- a/jscomp/others/belt_HashSetInt.resi +++ b/jscomp/others/belt_HashSetInt.resi @@ -23,12 +23,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*** -This module is [`Belt.HashSet`]() specialized with key type to be a primitive type. + This module is [`Belt.HashSet`]() specialized with key type to be a primitive type. -It is more efficient in general, the API is the same with [`Belt.HashSet`]() except its key type is fixed, -and identity is not needed(using the built-in one) + It is more efficient in general, the API is the same with [`Belt.HashSet`]() except its key type is fixed, + and identity is not needed(using the built-in one) -**See** [`Belt.HashSet`]() + **See** [`Belt.HashSet`]() */ type key = int diff --git a/jscomp/others/belt_HashSetString.resi b/jscomp/others/belt_HashSetString.resi index 3c2532f418..bbe2617b3f 100644 --- a/jscomp/others/belt_HashSetString.resi +++ b/jscomp/others/belt_HashSetString.resi @@ -23,12 +23,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*** -This module is [`Belt.HashSet`]() specialized with key type to be a primitive type. + This module is [`Belt.HashSet`]() specialized with key type to be a primitive type. -It is more efficient in general, the API is the same with [`Belt.HashSet`]() except its key type is fixed, -and identity is not needed(using the built-in one) + It is more efficient in general, the API is the same with [`Belt.HashSet`]() except its key type is fixed, + and identity is not needed(using the built-in one) -**See** [`Belt.HashSet`]() + **See** [`Belt.HashSet`]() */ type key = string 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 \ From bbb0429103ed959904a60cf24bab85767c09fca5 Mon Sep 17 00:00:00 2001 From: mununki Date: Tue, 9 Jan 2024 01:30:30 +0900 Subject: [PATCH 2/4] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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 From d32a1292dc42e4513dcea66396aaaa120bc60cdb Mon Sep 17 00:00:00 2001 From: mununki Date: Tue, 9 Jan 2024 02:03:36 +0900 Subject: [PATCH 3/4] fix dead value --- jscomp/gentype/ImportPath.mli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 0feb4e26d5bc70e26b24fc9bc58fb322b93a5edf Mon Sep 17 00:00:00 2001 From: mununki Date: Tue, 9 Jan 2024 10:54:06 +0900 Subject: [PATCH 4/4] revert unnecessary diff --- jscomp/others/belt_HashSetInt.resi | 8 ++++---- jscomp/others/belt_HashSetString.resi | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/jscomp/others/belt_HashSetInt.resi b/jscomp/others/belt_HashSetInt.resi index 85a7e6e541..05325e845a 100644 --- a/jscomp/others/belt_HashSetInt.resi +++ b/jscomp/others/belt_HashSetInt.resi @@ -23,12 +23,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*** - This module is [`Belt.HashSet`]() specialized with key type to be a primitive type. +This module is [`Belt.HashSet`]() specialized with key type to be a primitive type. - It is more efficient in general, the API is the same with [`Belt.HashSet`]() except its key type is fixed, - and identity is not needed(using the built-in one) +It is more efficient in general, the API is the same with [`Belt.HashSet`]() except its key type is fixed, +and identity is not needed(using the built-in one) - **See** [`Belt.HashSet`]() +**See** [`Belt.HashSet`]() */ type key = int diff --git a/jscomp/others/belt_HashSetString.resi b/jscomp/others/belt_HashSetString.resi index bbe2617b3f..3c2532f418 100644 --- a/jscomp/others/belt_HashSetString.resi +++ b/jscomp/others/belt_HashSetString.resi @@ -23,12 +23,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*** - This module is [`Belt.HashSet`]() specialized with key type to be a primitive type. +This module is [`Belt.HashSet`]() specialized with key type to be a primitive type. - It is more efficient in general, the API is the same with [`Belt.HashSet`]() except its key type is fixed, - and identity is not needed(using the built-in one) +It is more efficient in general, the API is the same with [`Belt.HashSet`]() except its key type is fixed, +and identity is not needed(using the built-in one) - **See** [`Belt.HashSet`]() +**See** [`Belt.HashSet`]() */ type key = string