Skip to content

Commit 7c7a004

Browse files
authored
Remove obsolete jsx options (#7633)
* Remove obsolete jsx options * CHANGELOG
1 parent abdb393 commit 7c7a004

File tree

12 files changed

+11
-57
lines changed

12 files changed

+11
-57
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
- Remove internal/unused `-bs-v` flag. https://github.com/rescript-lang/rescript/pull/7627
1818
- Remove unused `-bs-D` and `-bs-list-conditionals` flags. https://github.com/rescript-lang/rescript/pull/7631
19+
- Remove obsolete jsx options. https://github.com/rescript-lang/rescript/pull/7633
1920

2021
# 12.0.0-beta.1
2122

analysis/examples/example-project/bsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"number": "-32-26-27-33"
77
},
88
"bs-dependencies": ["reason-react"],
9-
"reason": { "react-jsx": 3 },
109
"namespace": "my-namespace",
1110
"reanalyze": {
1211
"analysis": ["dce", "exception"]

analysis/examples/larger-project/bsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
},
77
"name": "sample-typescript-app",
88
"bsc-flags": ["-bs-super-errors -w a"],
9-
"reason": { "react-jsx": 3 },
109
"bs-dependencies": ["@rescript/react", "@glennsl/bs-json"],
1110
"sources": [
1211
{

compiler/bsb/bsb_build_schemas.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(* Copyright (C) 2017 - Hongbo Zhang, Authors of ReScript
2-
*
2+
*
33
* This program is free software: you can redistribute it and/or modify
44
* it under the terms of the GNU Lesser General Public License as published by
55
* the Free Software Foundation, either version 3 of the License, or
@@ -17,7 +17,7 @@
1717
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1818
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1919
* GNU Lesser General Public License for more details.
20-
*
20+
*
2121
* You should have received a copy of the GNU Lesser General Public License
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
@@ -46,8 +46,6 @@ let type_ = "type"
4646
let export_all = "all"
4747
let export_none = "none"
4848
let external_stdlib = "external-stdlib"
49-
let reason = "reason"
50-
let react_jsx = "react-jsx"
5149
let jsx = "jsx"
5250
let jsx_version = "version"
5351
let jsx_module = "module"

compiler/bsc/rescript_compiler_main.ml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ let[@inline] string_list_add s : Bsc_args.spec = String (String_list_add s)
228228

229229
(* mostly common used to list in the beginning to make search fast
230230
*)
231-
let buckle_script_flags : (string * Bsc_args.spec * string) array =
231+
let command_line_flags : (string * Bsc_args.spec * string) array =
232232
[|
233233
( "-I",
234234
string_list_add Clflags.include_dirs,
@@ -258,8 +258,7 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
258258
"*internal* <module> Opens the module <module> before typing" );
259259
( "-bs-jsx",
260260
string_call (fun i ->
261-
if i <> "3" && i <> "4" then
262-
Bsc_args.bad_arg (" Not supported jsx version : " ^ i);
261+
if i <> "4" then Bsc_args.bad_arg ("Unsupported jsx version: " ^ i);
263262
Js_config.jsx_version :=
264263
Js_config.jsx_version_of_int @@ int_of_string i),
265264
"*internal* Set jsx version" );
@@ -446,7 +445,7 @@ let file_level_flags_handler (e : Parsetree.expression option) =
446445
Location.raise_errorf ~loc:e.pexp_loc "string literal expected"))
447446
in
448447
try
449-
Bsc_args.parse_exn ~start:0 ~argv:args buckle_script_flags
448+
Bsc_args.parse_exn ~start:0 ~argv:args command_line_flags
450449
(fun ~rev_args:_ -> ())
451450
~usage
452451
with _ ->
@@ -460,9 +459,7 @@ let _ : unit =
460459
let flags = "flags" in
461460
Ast_config.add_structure flags file_level_flags_handler;
462461
Ast_config.add_signature flags file_level_flags_handler;
463-
try
464-
Bsc_args.parse_exn ~argv:Sys.argv buckle_script_flags anonymous ~usage
465-
with
462+
try Bsc_args.parse_exn ~argv:Sys.argv command_line_flags anonymous ~usage with
466463
| Bsc_args.Bad msg ->
467464
Format.eprintf "%s@." msg;
468465
exit 2

compiler/syntax/src/jsx_ppx.mli

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
a ReasonReact-specific function call. Aka, this is a macro, using OCaml's ppx
44
facilities; https://whitequark.org/blog/2014/04/16/a-guide-to-extension-
55
points-in-ocaml/
6-
You wouldn't use this file directly; it's used by ReScript's
7-
rescript.json. Specifically, there's a field called `react-jsx` inside the
8-
field `reason`, which enables this ppx through some internal call in bsb
96
*)
107

118
val rewrite_implementation :

docs/docson/build-schema.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@
9191
},
9292
"additionalProperties": false
9393
},
94-
"react-jsx-version": {
95-
"title": "jsx-version",
96-
"type": "number",
97-
"description": "backward compatible mode, true means on with the default to be version 1 (the default value is subject to change)"
98-
},
9994
"ppx-specs": {
10095
"type": "array",
10196
"items": {

rewatch/CompilerConfigurationSpec.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ This document contains a list of all bsconfig parameters with remarks, and wheth
1919
| generators | array of Rule-Generator | | [_] |
2020
| cut-generators | boolean | | [_] |
2121
| jsx | JSX | | [x] |
22-
| uncurried | boolean | | [x] |
23-
| reason | Reason | | [x] |
2422
| gentypeconfig | Gentype | | [_] |
2523
| bsc-flags | array of string | | [x] |
2624
| warnings | Warnings | | [x] |
@@ -144,12 +142,6 @@ enum: "commonjs" | "es6" | "es6-global"
144142

145143
enum: ".js" | ".mjs" | ".cjs" | ".bs.js" | ".bs.mjs" | ".bs.cjs"
146144

147-
### Reason
148-
149-
| Parameter | JSON type | Remark | Implemented? |
150-
| --------- | --------- | ------ | :----------: |
151-
| react-jsx | number | | [x] |
152-
153145
### Target-Item
154146

155147
Not really usable by ReScript, likely to be removed.

rewatch/src/build/packages.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,6 @@ mod test {
983983
bs_dev_dependencies: Some(build_dev_deps),
984984
ppx_flags: None,
985985
bsc_flags: None,
986-
reason: None,
987986
namespace: None,
988987
jsx: None,
989988
gentype_config: None,

rewatch/src/config.rs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,6 @@ pub struct Warnings {
145145
pub error: Option<Error>,
146146
}
147147

148-
#[derive(Deserialize, Debug, Clone, PartialEq, Hash)]
149-
#[serde(untagged)]
150-
pub enum Reason {
151-
Versioned {
152-
#[serde(rename = "react-jsx")]
153-
react_jsx: i32,
154-
},
155-
Unversioned(bool),
156-
}
157-
158148
#[derive(Deserialize, Debug, Clone)]
159149
#[serde(untagged)]
160150
pub enum NamespaceConfig {
@@ -212,7 +202,6 @@ pub struct Config {
212202
pub ppx_flags: Option<Vec<OneOrMore<String>>>,
213203
#[serde(rename = "bsc-flags", alias = "compiler-flags")]
214204
pub bsc_flags: Option<Vec<OneOrMore<String>>>,
215-
pub reason: Option<Reason>,
216205
pub namespace: Option<NamespaceConfig>,
217206
pub jsx: Option<JsxSpecs>,
218207
#[serde(rename = "gentypeconfig")]
@@ -373,22 +362,15 @@ impl Config {
373362
}
374363
}
375364
pub fn get_jsx_args(&self) -> Vec<String> {
376-
match (self.reason.to_owned(), self.jsx.to_owned()) {
377-
(_, Some(jsx)) => match jsx.version {
365+
match self.jsx.to_owned() {
366+
Some(jsx) => match jsx.version {
378367
Some(version) if version == 3 || version == 4 => {
379368
vec!["-bs-jsx".to_string(), version.to_string()]
380369
}
381370
Some(_version) => panic!("Unsupported JSX version"),
382371
None => vec![],
383372
},
384-
(Some(Reason::Versioned { react_jsx }), None) => {
385-
vec!["-bs-jsx".to_string(), format!("{}", react_jsx)]
386-
}
387-
(Some(Reason::Unversioned(true)), None) => {
388-
// If Reason is 'true' - we should default to the latest
389-
vec!["-bs-jsx".to_string()]
390-
}
391-
_ => vec![],
373+
None => vec![],
392374
}
393375
}
394376

0 commit comments

Comments
 (0)