Skip to content

Support rescript.json #6193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions jscomp/bsb/bsb_build_schemas.ml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,15 @@ let warnings = "warnings"
let number = "number"
let error = "error"
let suffix = "suffix"
let gentypeconfig = "gentypeconfig"
let language = "language"
let gentype = "gentypeconfig"
let gentype_language = "language"
let gentype_module = "module"
let gentype_module_resolution = "moduleResolution"
let gentype_export_interfaces = "exportInterfaces"
let gentype_generated_file_extension = "moduleResolution"
let gentype_shims = "shims"
let gentype_debug = "debug"
let path = "path"
let ignored_dirs = "ignored-dirs"

let uncurried = "uncurried"
let uncurried = "uncurried"
11 changes: 5 additions & 6 deletions jscomp/bsb/bsb_build_util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,12 @@ let extract_pinned_dependencies (map : Ext_json_types.t Map_string.t) : Set_stri
| None -> Set_string.empty
| Some (Arr { content }) ->
Set_string.of_list (get_list_string content)
| Some config -> Bsb_exception.config_error config "expect an array of string"
| Some manifest -> Bsb_exception.manifest_error manifest "expect an array of string"

let rec walk_all_deps_aux (visited : string Hash_string.t) (paths : string list)
~(top : top) (dir : string) (queue : _ Queue.t) ~pinned_dependencies =
let bsconfig_json = dir // Literals.bsconfig_json in
match Ext_json_parse.parse_json_from_file bsconfig_json with
| Obj { map; loc } ->
match Bsb_config_parse.parse_json ~per_proj_dir:dir ~warn_legacy_config:false with
| _, _, Obj { map; loc } ->
let cur_package_name =
match Map_string.find_opt map Bsb_build_schemas.name with
| Some (Str { str; loc }) ->
Expand All @@ -169,7 +168,7 @@ let rec walk_all_deps_aux (visited : string Hash_string.t) (paths : string list)
"package name is expected to be %s but got %s" s str);
str
| Some _ | None ->
Bsb_exception.errorf ~loc "package name missing in %s/bsconfig.json"
Bsb_exception.errorf ~loc "package name missing in %s/rescript.json"
dir
in
if Ext_list.mem_string paths cur_package_name then (
Expand Down Expand Up @@ -220,7 +219,7 @@ let rec walk_all_deps_aux (visited : string Hash_string.t) (paths : string list)
| Expect_name _ -> ());
Queue.add { top; proj_dir = dir; is_pinned } queue;
Hash_string.add visited cur_package_name dir
| _ -> ()
| _, _, _ -> ()

let walk_all_deps dir ~pinned_dependencies : package_context Queue.t =
let visited = Hash_string.create 0 in
Expand Down
2 changes: 1 addition & 1 deletion jscomp/bsb/bsb_clean.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let clean_bs_garbage proj_dir =
Bsb_log.warn "@{<warning>Failed@} to clean due to %s" (Printexc.to_string e)

let clean_bs_deps proj_dir =
let _, _, _, pinned_dependencies = Bsb_config_parse.deps_from_bsconfig () in
let _, _, _, pinned_dependencies = Bsb_config_interpret.deps_from_bsconfig () in
let queue = Bsb_build_util.walk_all_deps proj_dir ~pinned_dependencies in
Queue.iter
(fun (pkg_cxt : Bsb_build_util.package_context) ->
Expand Down
Loading