diff --git a/analysis/src/FindFiles.ml b/analysis/src/FindFiles.ml index fc3556e0a0..2a764460e2 100644 --- a/analysis/src/FindFiles.ml +++ b/analysis/src/FindFiles.ml @@ -213,16 +213,21 @@ let findProjectFiles ~public ~namespace ~path ~sourceDirectories ~libBs = let findDependencyFiles base config = let deps = - config |> Json.get "bs-dependencies" |> bind Json.array - |> Option.value ~default:[] - |> List.filter_map Json.string + match + ( config |> Json.get "dependencies" |> bind Json.array, + config |> Json.get "bs-dependencies" |> bind Json.array ) + with + | None, None -> [] + | Some deps, None | _, Some deps -> deps |> List.filter_map Json.string in let devDeps = - config - |> Json.get "bs-dev-dependencies" - |> bind Json.array - |> Option.map (List.filter_map Json.string) - |> Option.value ~default:[] + match + ( config |> Json.get "dev-dependencies" |> bind Json.array, + config |> Json.get "bs-dev-dependencies" |> bind Json.array ) + with + | None, None -> [] + | Some devDeps, None | _, Some devDeps -> + devDeps |> List.filter_map Json.string in let deps = deps @ devDeps in Log.log ("Dependencies: " ^ String.concat " " deps); diff --git a/analysis/src/Packages.ml b/analysis/src/Packages.ml index 34b9945a7b..bb455d925d 100644 --- a/analysis/src/Packages.ml +++ b/analysis/src/Packages.ml @@ -138,15 +138,20 @@ let newBsPackage ~rootPath = [path] in let bind f x = Option.bind x f in - let bsc_flags = - Json.get "bsc-flags" config - |> bind Json.array |> Option.value ~default:[] + let compiler_flags = + match + ( Json.get "compiler-flags" config |> bind Json.array, + Json.get "bsc-flags" config |> bind Json.array ) + with + | Some compiler_flags, None | _, Some compiler_flags -> + compiler_flags + | None, None -> [] in let no_pervasives = - bsc_flags + compiler_flags |> List.exists (fun s -> Json.string s = Some "-nopervasives") in - let opens_from_bsc_flags = + let opens_from_compiler_flags = List.fold_left (fun opens item -> match item |> Json.string with @@ -158,7 +163,7 @@ let newBsPackage ~rootPath = let path = name |> String.split_on_char '.' in path :: opens | _ -> opens)) - [] bsc_flags + [] compiler_flags in let opens_from_pervasives = if no_pervasives then [] @@ -166,7 +171,7 @@ let newBsPackage ~rootPath = in let opens = opens_from_pervasives @ opens_from_namespace - |> List.rev_append opens_from_bsc_flags + |> List.rev_append opens_from_compiler_flags |> List.map (fun path -> path @ ["place holder"]) in { diff --git a/compiler/gentype/GenTypeConfig.ml b/compiler/gentype/GenTypeConfig.ml index c74706f03e..73925cc1d5 100644 --- a/compiler/gentype/GenTypeConfig.ml +++ b/compiler/gentype/GenTypeConfig.ml @@ -203,8 +203,10 @@ let read_config ~get_config_file ~namespace = | _ -> default.suffix in let bs_dependencies = - match bsconf |> get_opt "bs-dependencies" with - | Some (Arr {content}) -> + match + (bsconf |> get_opt "dependencies", bsconf |> get_opt "bs-dependencies") + with + | Some (Arr {content}), None | None, Some (Arr {content}) -> let strings = ref [] in content |> Array.iter (fun x -> diff --git a/compiler/ml/typetexp.ml b/compiler/ml/typetexp.ml index 16308442dc..942d81d663 100644 --- a/compiler/ml/typetexp.ml +++ b/compiler/ml/typetexp.ml @@ -888,8 +888,8 @@ let report_error env ppf = function Format.fprintf ppf "@[@{The module or file %a can't be found.@}@,\ @[- If it's a third-party dependency:@,\ - - Did you add it to the \"bs-dependencies\" or \ - \"bs-dev-dependencies\" in rescript.json?@]@,\ + - Did you add it to the \"dependencies\" or \"dev-dependencies\" in \ + rescript.json?@]@,\ - Did you include the file's directory to the \"sources\" in \ rescript.json?@," Printtyp.longident lid); diff --git a/rewatch/tests/snapshots/bs-dev-dependency-used-by-non-dev-source.txt b/rewatch/tests/snapshots/bs-dev-dependency-used-by-non-dev-source.txt index 886b5e09a4..34ddd13310 100644 --- a/rewatch/tests/snapshots/bs-dev-dependency-used-by-non-dev-source.txt +++ b/rewatch/tests/snapshots/bs-dev-dependency-used-by-non-dev-source.txt @@ -20,7 +20,7 @@ Use 'compiler-flags' instead. The module or file WebAPI can't be found. - If it's a third-party dependency: - - Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in rescript.json? + - Did you add it to the "dependencies" or "dev-dependencies" in rescript.json? - Did you include the file's directory to the "sources" in rescript.json? diff --git a/rewatch/tests/snapshots/remove-file.txt b/rewatch/tests/snapshots/remove-file.txt index 58ef8ea12b..a1e2468b7f 100644 --- a/rewatch/tests/snapshots/remove-file.txt +++ b/rewatch/tests/snapshots/remove-file.txt @@ -22,7 +22,7 @@ Use 'compiler-flags' instead. The module or file Dep02 can't be found. - If it's a third-party dependency: - - Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in rescript.json? + - Did you add it to the "dependencies" or "dev-dependencies" in rescript.json? - Did you include the file's directory to the "sources" in rescript.json? diff --git a/rewatch/tests/snapshots/rename-file-internal-dep-namespace.txt b/rewatch/tests/snapshots/rename-file-internal-dep-namespace.txt index ff4835befa..55eb9df4b5 100644 --- a/rewatch/tests/snapshots/rename-file-internal-dep-namespace.txt +++ b/rewatch/tests/snapshots/rename-file-internal-dep-namespace.txt @@ -20,7 +20,7 @@ Use 'compiler-flags' instead. The module or file Other_module can't be found. - If it's a third-party dependency: - - Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in rescript.json? + - Did you add it to the "dependencies" or "dev-dependencies" in rescript.json? - Did you include the file's directory to the "sources" in rescript.json? diff --git a/rewatch/tests/snapshots/rename-file-internal-dep.txt b/rewatch/tests/snapshots/rename-file-internal-dep.txt index 5c76412440..6596297776 100644 --- a/rewatch/tests/snapshots/rename-file-internal-dep.txt +++ b/rewatch/tests/snapshots/rename-file-internal-dep.txt @@ -22,7 +22,7 @@ Use 'compiler-flags' instead. The module or file InternalDep can't be found. - If it's a third-party dependency: - - Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in rescript.json? + - Did you add it to the "dependencies" or "dev-dependencies" in rescript.json? - Did you include the file's directory to the "sources" in rescript.json? diff --git a/tests/build_tests/super_errors/expected/modules1.res.expected b/tests/build_tests/super_errors/expected/modules1.res.expected index da7b974176..d96f7c32d1 100644 --- a/tests/build_tests/super_errors/expected/modules1.res.expected +++ b/tests/build_tests/super_errors/expected/modules1.res.expected @@ -7,5 +7,5 @@ The module or file Foo can't be found. - If it's a third-party dependency: - - Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in rescript.json? + - Did you add it to the "dependencies" or "dev-dependencies" in rescript.json? - Did you include the file's directory to the "sources" in rescript.json? \ No newline at end of file