@@ -5180,6 +5180,18 @@ type t = {
5180
5180
mode : mode option;
5181
5181
}
5182
5182
5183
+ let encode_no_nl jsx =
5184
+ (match jsx.version with
5185
+ | None -> ""
5186
+ | Some Jsx_v3 -> "3"
5187
+ | Some Jsx_v4 -> "4")
5188
+ ^ (match jsx.module_ with None -> "" | Some React -> "React")
5189
+ ^
5190
+ match jsx.mode with
5191
+ | None -> ""
5192
+ | Some Classic -> "Classic"
5193
+ | Some Automatic -> "Automatic"
5194
+
5183
5195
let ( .?() ) = Map_string.find_opt
5184
5196
let ( |? ) m (key, cb) = m |> Ext_json.test key cb
5185
5197
@@ -7920,10 +7932,12 @@ module Bsb_package_kind
7920
7932
* along with this program; if not, write to the Free Software
7921
7933
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
7922
7934
7935
+ type dep_payload = { package_specs : Bsb_package_specs.t; jsx : Bsb_jsx.t }
7936
+
7923
7937
type t =
7924
7938
| Toplevel
7925
- | Dependency of Bsb_package_specs.t
7926
- | Pinned_dependency of Bsb_package_specs.t
7939
+ | Dependency of dep_payload
7940
+ | Pinned_dependency of dep_payload
7927
7941
(* This package specs comes from the toplevel to
7928
7942
override the current settings
7929
7943
*)
@@ -7932,9 +7946,15 @@ let encode_no_nl (x : t) =
7932
7946
match x with
7933
7947
| Toplevel -> "0"
7934
7948
| Dependency x ->
7935
- "1" ^ Bsb_package_specs.package_flag_of_package_specs x ~dirname:"."
7949
+ "1"
7950
+ ^ Bsb_package_specs.package_flag_of_package_specs x.package_specs
7951
+ ~dirname:"."
7952
+ ^ Bsb_jsx.encode_no_nl x.jsx
7936
7953
| Pinned_dependency x ->
7937
- "2" ^ Bsb_package_specs.package_flag_of_package_specs x ~dirname:"."
7954
+ "2"
7955
+ ^ Bsb_package_specs.package_flag_of_package_specs x.package_specs
7956
+ ~dirname:"."
7957
+ ^ Bsb_jsx.encode_no_nl x.jsx
7938
7958
7939
7959
end
7940
7960
module Bsc_warnings
@@ -10293,7 +10313,7 @@ module Bsb_config_parse : sig
10293
10313
* along with this program; if not, write to the Free Software
10294
10314
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
10295
10315
10296
- val package_specs_from_bsconfig : unit -> Bsb_package_specs.t * Set_string.t
10316
+ val deps_from_bsconfig : unit -> Bsb_package_specs.t * Bsb_jsx .t * Set_string.t
10297
10317
10298
10318
val interpret_json :
10299
10319
package_kind:Bsb_package_kind.t -> per_proj_dir:string -> Bsb_config_types.t
@@ -10627,26 +10647,30 @@ let interpret_json ~(package_kind : Bsb_package_kind.t) ~(per_proj_dir : string)
10627
10647
package_specs =
10628
10648
(match package_kind with
10629
10649
| Toplevel -> Bsb_package_specs.from_map ~cwd:per_proj_dir map
10630
- | Pinned_dependency x | Dependency x -> x);
10650
+ | Pinned_dependency x | Dependency x -> x.package_specs );
10631
10651
file_groups = groups;
10632
10652
files_to_install = Queue.create ();
10633
10653
built_in_dependency = built_in_package;
10634
10654
generate_merlin =
10635
10655
extract_boolean map Bsb_build_schemas.generate_merlin false;
10636
10656
reason_react_jsx;
10637
- jsx = Bsb_jsx.from_map map;
10657
+ jsx =
10658
+ (match package_kind with
10659
+ | Toplevel -> Bsb_jsx.from_map map
10660
+ | Pinned_dependency x | Dependency x -> x.jsx);
10638
10661
generators = extract_generators map;
10639
10662
cut_generators;
10640
10663
}
10641
10664
| None ->
10642
10665
Bsb_exception.invalid_spec "no sources specified in bsconfig.json")
10643
10666
| _ -> Bsb_exception.invalid_spec "bsconfig.json expect a json object {}"
10644
10667
10645
- let package_specs_from_bsconfig () =
10668
+ let deps_from_bsconfig () =
10646
10669
let json = Ext_json_parse.parse_json_from_file Literals.bsconfig_json in
10647
10670
match json with
10648
10671
| Obj { map } ->
10649
10672
( Bsb_package_specs.from_map ~cwd:Bsb_global_paths.cwd map,
10673
+ Bsb_jsx.from_map map,
10650
10674
extract_pinned_dependencies map )
10651
10675
| _ -> assert false
10652
10676
@@ -10862,9 +10886,7 @@ let clean_bs_garbage proj_dir =
10862
10886
Bsb_log.warn "@{<warning>Failed@} to clean due to %s" (Printexc.to_string e)
10863
10887
10864
10888
let clean_bs_deps proj_dir =
10865
- let _, pinned_dependencies =
10866
- Bsb_config_parse.package_specs_from_bsconfig ()
10867
- in
10889
+ let _, _, pinned_dependencies = Bsb_config_parse.deps_from_bsconfig () in
10868
10890
let queue = Bsb_build_util.walk_all_deps proj_dir ~pinned_dependencies in
10869
10891
Queue.iter
10870
10892
(fun (pkg_cxt : Bsb_build_util.package_context) ->
@@ -15085,20 +15107,20 @@ end = struct
15085
15107
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
15086
15108
15087
15109
let ( // ) = Ext_path.combine
15088
-
15089
15110
let vendor_ninja = Bsb_global_paths.vendor_ninja
15090
15111
15091
15112
let make_world_deps cwd (config : Bsb_config_types.t option)
15092
15113
(ninja_args : string array) =
15093
- let deps , pinned_dependencies =
15114
+ let package_specs, jsx , pinned_dependencies =
15094
15115
match config with
15095
15116
| None ->
15096
15117
(* When this running bsb does not read bsconfig.json,
15097
15118
we will read such json file to know which [package-specs]
15098
15119
it wants
15099
15120
*)
15100
- Bsb_config_parse.package_specs_from_bsconfig ()
15101
- | Some config -> (config.package_specs, config.pinned_dependencies)
15121
+ Bsb_config_parse.deps_from_bsconfig ()
15122
+ | Some config ->
15123
+ (config.package_specs, config.jsx, config.pinned_dependencies)
15102
15124
in
15103
15125
let args =
15104
15126
if Ext_array.is_empty ninja_args then [| vendor_ninja |]
@@ -15130,8 +15152,8 @@ let make_world_deps cwd (config : Bsb_config_types.t option)
15130
15152
let _config : _ option =
15131
15153
Bsb_ninja_regen.regenerate_ninja
15132
15154
~package_kind:
15133
- (if is_pinned then Pinned_dependency deps
15134
- else Dependency deps )
15155
+ (if is_pinned then Pinned_dependency { package_specs; jsx }
15156
+ else Dependency { package_specs; jsx } )
15135
15157
~per_proj_dir:proj_dir ~forced:false
15136
15158
in
15137
15159
let command =
0 commit comments