@@ -70,10 +70,10 @@ let extract_package_name_and_namespace (map : json_map) : string * string option
70
70
- the running bsb need delete stale build artifacts
71
71
(kinda check npm upgrade)
72
72
73
- Note if the setup is correct:
73
+ Note if the setup is correct:
74
74
the running compiler and node_modules/rescript
75
- should be the same version,
76
- The exact check is that the running compiler should have a
75
+ should be the same version,
76
+ The exact check is that the running compiler should have a
77
77
compatible runtime version installed, the location of the
78
78
compiler is actually not relevant.
79
79
We disable the check temporarily
@@ -235,9 +235,13 @@ let extract_js_post_build (map : json_map) cwd : string option =
235
235
|> ignore;
236
236
! js_post_build_cmd
237
237
238
- (* * ATT: make sure such function is re-entrant.
238
+ (* * ATT: make sure such function is re-entrant.
239
239
With a given [cwd] it works anywhere*)
240
- let interpret_json ~(package_kind : Bsb_package_kind.t ) ~(per_proj_dir : string )
240
+ let interpret_json
241
+ ~(filename : string )
242
+ ~(json : Ext_json_types.t )
243
+ ~(package_kind : Bsb_package_kind.t )
244
+ ~(per_proj_dir : string )
241
245
: Bsb_config_types.t =
242
246
(* we should not resolve it too early,
243
247
since it is external configuration, no {!Bsb_build_util.convert_and_resolve_path}
@@ -253,8 +257,7 @@ let interpret_json ~(package_kind : Bsb_package_kind.t) ~(per_proj_dir : string)
253
257
1. if [build.ninja] does use [ninja] we need set a variable
254
258
2. we need store it so that we can call ninja correctly
255
259
*)
256
- match
257
- Ext_json_parse. parse_json_from_file (per_proj_dir // Literals. bsconfig_json)
260
+ match json
258
261
with
259
262
| Obj { map } -> (
260
263
let package_name, namespace = extract_package_name_and_namespace map in
@@ -349,17 +352,19 @@ let interpret_json ~(package_kind : Bsb_package_kind.t) ~(per_proj_dir : string)
349
352
(match package_kind with
350
353
| Toplevel -> extract_uncurried map
351
354
| Pinned_dependency x | Dependency x -> x.uncurried);
355
+ filename;
352
356
}
353
357
| None ->
354
- Bsb_exception. invalid_spec " no sources specified in bsconfig.json " )
355
- | _ -> Bsb_exception. invalid_spec " bsconfig.json expect a json object {}"
358
+ Bsb_exception. invalid_spec ( " no sources specified in " ^ filename) )
359
+ | _ -> Bsb_exception. invalid_spec (filename ^ " expect a json object {}" )
356
360
357
361
let deps_from_bsconfig () =
358
- let json = Ext_json_parse. parse_json_from_file Literals. bsconfig_json in
359
- match json with
360
- | Obj { map } ->
361
- ( Bsb_package_specs. from_map ~cwd: Bsb_global_paths. cwd map,
362
+ let cwd = Bsb_global_paths. cwd in
363
+ match Bsb_config_load. load_json ~per_proj_dir: cwd ~warn_legacy_config: false
364
+ with
365
+ | _ , Obj { map } ->
366
+ ( Bsb_package_specs. from_map ~cwd map,
362
367
Bsb_jsx. from_map map,
363
368
extract_uncurried map,
364
369
Bsb_build_util. extract_pinned_dependencies map )
365
- | _ -> assert false
370
+ | _ , _ -> assert false
0 commit comments