From d0e576f2f275d55c661bcc1f395e6886638dc1da Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Thu, 9 Mar 2023 18:12:18 -0300 Subject: [PATCH 1/2] add error if the lib dir is included in the sources --- CHANGELOG.md | 1 + jscomp/bsb/bsb_parse_sources.ml | 3 +++ lib/4.06.1/rescript.ml | 3 +++ 3 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 348ad613fe..05e4bec835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ #### :bug: Bug Fix - Fix implementation of directives https://github.com/rescript-lang/rescript-compiler/pull/6052 +- Fix issue if the `lib` dir is included in the sources of bsconfig.json # 10.1.3 diff --git a/jscomp/bsb/bsb_parse_sources.ml b/jscomp/bsb/bsb_parse_sources.ml index c10aef4e8f..e9969e957d 100644 --- a/jscomp/bsb/bsb_parse_sources.ml +++ b/jscomp/bsb/bsb_parse_sources.ml @@ -298,6 +298,9 @@ and parsing_single_source ({ package_kind; is_dev; cwd } as cxt) let dir = match map.?(Bsb_build_schemas.dir) with | Some (Str { str }) -> + if str = Literals.library_file then + Bsb_exception.config_error x (Printf.sprintf "dir field should be different from `%s`" Literals.library_file) + else Ext_path.simple_convert_node_path_to_os_path str | Some x -> Bsb_exception.config_error x "dir expected to be a string" diff --git a/lib/4.06.1/rescript.ml b/lib/4.06.1/rescript.ml index 304ee174aa..629e4e6b4f 100644 --- a/lib/4.06.1/rescript.ml +++ b/lib/4.06.1/rescript.ml @@ -10333,6 +10333,9 @@ and parsing_single_source ({ package_kind; is_dev; cwd } as cxt) let dir = match map.?(Bsb_build_schemas.dir) with | Some (Str { str }) -> + if str = Literals.library_file then + Bsb_exception.config_error x (Printf.sprintf "dir field should be different from `%s`" Literals.library_file) + else Ext_path.simple_convert_node_path_to_os_path str | Some x -> Bsb_exception.config_error x "dir expected to be a string" From 1a7f833979f76fcdfe46bdfb81e069a688508453 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Thu, 9 Mar 2023 18:52:17 -0300 Subject: [PATCH 2/2] update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06e3876a94..02fc0fae9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ #### :bug: Bug Fix - Fix implementation of directives https://github.com/rescript-lang/rescript-compiler/pull/6052 -- Fix issue if the `lib` dir is included in the sources of bsconfig.json +- Fix issue if the `lib` dir is included in the sources of bsconfig.json https://github.com/rescript-lang/rescript-compiler/pull/6055 #### :rocket: New Feature - Add support for toplevel `await` https://github.com/rescript-lang/rescript-compiler/pull/6054