@@ -70,10 +70,10 @@ let extract_package_name_and_namespace (map : json_map) : string * string option
7070 - the running bsb need delete stale build artifacts
7171 (kinda check npm upgrade)
7272
73- Note if the setup is correct:
73+ Note if the setup is correct:
7474 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
7777 compatible runtime version installed, the location of the
7878 compiler is actually not relevant.
7979 We disable the check temporarily
@@ -235,9 +235,13 @@ let extract_js_post_build (map : json_map) cwd : string option =
235235 |> ignore;
236236 ! js_post_build_cmd
237237
238- (* * ATT: make sure such function is re-entrant.
238+ (* * ATT: make sure such function is re-entrant.
239239 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 )
241245 : Bsb_config_types.t =
242246 (* we should not resolve it too early,
243247 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)
253257 1. if [build.ninja] does use [ninja] we need set a variable
254258 2. we need store it so that we can call ninja correctly
255259 *)
256- match
257- Ext_json_parse. parse_json_from_file (per_proj_dir // Literals. bsconfig_json)
260+ match json
258261 with
259262 | Obj { map } -> (
260263 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)
349352 (match package_kind with
350353 | Toplevel -> extract_uncurried map
351354 | Pinned_dependency x | Dependency x -> x.uncurried);
355+ filename;
352356 }
353357 | 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 {}" )
356360
357361let 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,
362367 Bsb_jsx. from_map map,
363368 extract_uncurried map,
364369 Bsb_build_util. extract_pinned_dependencies map )
365- | _ -> assert false
370+ | _ , _ -> assert false
0 commit comments