Skip to content

bsconfig.json -> rescript.json in error messages + comments #7423

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

Merged
merged 1 commit into from
May 5, 2025
Merged
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
2 changes: 1 addition & 1 deletion analysis/reanalyze/src/Paths.ml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module Config = struct
| Some False -> RunConfig.transitive false
| _ -> ()

(* Read the config from rescript.json/bsconfig.json and apply it to runConfig and suppress and unsuppress *)
(* Read the config from rescript.json and apply it to runConfig and suppress and unsuppress *)
let processBsconfig () =
Lazy.force setReScriptProjectRoot;
let rescriptFile = Filename.concat runConfig.projectRoot rescriptJson in
Expand Down
4 changes: 1 addition & 3 deletions analysis/reanalyze/src/Reanalyze.ml
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ let cli () =
"root_path Run all the analyses for all the .cmt files under the root \
path" );
("-ci", Unit (fun () -> Cli.ci := true), "Internal flag for use in CI");
( "-config",
Unit setConfig,
"Read the analysis mode from rescript.json/bsconfig.json" );
("-config", Unit setConfig, "Read the analysis mode from rescript.json");
("-dce", Unit (fun () -> setDCE None), "Eperimental DCE");
("-debug", Unit (fun () -> Cli.debug := true), "Print debug information");
( "-dce-cmt",
Expand Down
2 changes: 1 addition & 1 deletion analysis/src/CompletionDecorators.ml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Example `@raises(Exn)` or `@raises([E1, E2, E3])` for multiple exceptions.

You will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.

Note: The `@react.component` decorator requires the `jsx` config to be set in your `rescript.json`/`bsconfig.json` to enable the required React transformations.
Note: The `@react.component` decorator requires the `jsx` config to be set in your `rescript.json` to enable the required React transformations.

[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-decorator).|};
] );
Expand Down
2 changes: 1 addition & 1 deletion compiler/bsb/bsb_build_util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,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" dir
Bsb_exception.errorf ~loc "package name missing in %s/rescript.json" dir
in
if Ext_list.mem_string paths cur_package_name then (
Bsb_log.error "@{<error>Cyclic dependencies in package stack@}@.";
Expand Down
2 changes: 1 addition & 1 deletion compiler/bsb/bsb_build_util.mli
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ val include_dirs_by : 'a list -> ('a -> string) -> string
val mkp : string -> unit

(* The path of [bsc] and [bsdep] is normalized so that the invokation of [./compiler/bin/bsb.exe]
and [bsb.exe] (combined with a dirty bsconfig.json) will not trigger unnecessary rebuild.
and [bsb.exe] (combined with a dirty rescript.json) will not trigger unnecessary rebuild.

The location of [bsc] and [bsdep] is configured by the combination of [Sys.executable_name]
and [cwd].
Expand Down
6 changes: 3 additions & 3 deletions compiler/bsb/bsb_exception.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ let print (fmt : Format.formatter) (x : error) =
let name = Bsb_pkg_types.to_string name in
if Ext_string.equal name !Bs_version.package_name then
Format.fprintf fmt
"File \"bsconfig.json\", line 1\n\
"File \"rescript.json\", line 1\n\
@{<error>Error:@} package @{<error>%s@} is not found\n\
It's the basic, required package. If you have it installed globally,\n\
Please run `npm link rescript` to make it available"
name
else
Format.fprintf fmt
"File \"bsconfig.json\", line 1\n\
"File \"rescript.json\", line 1\n\
@{<error>Error:@} package @{<error>%s@} not found or built\n\
- Did you install it?"
name
Expand All @@ -68,7 +68,7 @@ let print (fmt : Format.formatter) (x : error) =
https://rescript-lang.org/docs/manual/latest/build-configuration-schema"
pos.pos_fname pos.pos_lnum s
| Invalid_spec s ->
Format.fprintf fmt "@{<error>Error: Invalid bsconfig.json %s@}" s
Format.fprintf fmt "@{<error>Error: Invalid rescript.json: %s@}" s

let conflict_module modname dir1 dir2 =
Error (Conflict_module (modname, dir1, dir2))
Expand Down
4 changes: 2 additions & 2 deletions compiler/bsb/bsb_ninja_rule.mli
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ type builtin = {
(** rules are generally composed of built-in rules and customized rules, there are two design choices:
1. respect custom rules with the same name, then we need adjust our built-in
rules dynamically in case the conflict.
2. respect our built-in rules, then we only need re-load custom rules for each bsconfig.json
2. respect our built-in rules, then we only need re-load custom rules for each rescript.json
*)

type command = string

(* Since now we generate ninja files per bsconfig.json in a single process,
(* Since now we generate ninja files per rescript.json in a single process,
we must make sure it is re-entrant
*)
val make_custom_rules :
Expand Down
4 changes: 0 additions & 4 deletions compiler/bsb/bsb_pkg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ let ( // ) = Filename.concat

type t = Bsb_pkg_types.t

(* TODO: be more restrict
[bsconfig.json] does not always make sense,
when resolving [ppx-flags]
*)
let make_sub_path (x : t) : string =
Literals.node_modules // Bsb_pkg_types.to_string x

Expand Down
4 changes: 2 additions & 2 deletions compiler/bsb/bsb_watcher_gen.mli
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

val generate_sourcedirs_meta : name:string -> Bsb_file_groups.t -> unit
(** This module try to generate some meta data so that
everytime [bsconfig.json] is reload, we can re-read
everytime [rescript.json] is reloaded, we can re-read
such meta data changes in the watcher.

Another way of doing it is processing [bsconfig.json]
Another way of doing it is processing [rescript.json]
directly in [watcher] but that would
mean the duplication of logic in [bsb] and [bsb_watcher]
*)
4 changes: 2 additions & 2 deletions compiler/bsb_exe/rescript_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ let build_subcommand ~start argv argv_len =
( "-regen",
unit_set_spec force_regenerate,
"*internal* \n\
Always regenerate build.ninja no matter bsconfig.json is changed or \
not" );
Always regenerate build.ninja no matter if rescript.json is changed \
or not" );
( "-no-deps",
unit_set_spec no_deps_mode,
"*internal* Needed for watcher to build without dependencies on file \
Expand Down
2 changes: 1 addition & 1 deletion compiler/jsoo/jsoo_playground_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* -----------------------------
* Version History: * v2: Remove refmt support (removes compiler.reason apis)
* v3: Switched to Uncurried mode by default (requires third party packages
to be built with uncurried: true in bsconfig.json). Also added
to be built with uncurried: true in rescript.json). Also added
`config.uncurried` to the BundleConfig.
* v4: Added `config.open_modules` to the BundleConfig to enable implicitly opened
* modules in the playground.
Expand Down
4 changes: 2 additions & 2 deletions compiler/ml/typetexp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,9 @@ let report_error env ppf = function
"@[<v>@{<info>The module or file %a can't be found.@}@,\
@[<v 2>- If it's a third-party dependency:@,\
- Did you add it to the \"bs-dependencies\" or \
\"bs-dev-dependencies\" in bsconfig.json?@]@,\
\"bs-dev-dependencies\" in rescript.json?@]@,\
- Did you include the file's directory to the \"sources\" in \
bsconfig.json?@,"
rescript.json?@,"
Printtyp.longident lid);
super_spellcheck ppf Env.fold_modules env lid |> ignore
| Unbound_constructor lid ->
Expand Down
2 changes: 1 addition & 1 deletion docs/JSXV4.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The V4 representation is part of the spec, so `@react.component` is effectively

## Turn On V4

To build an entire project in V4 mode, including all its dependencies, use the new `"jsx"` configuration in `bsconfig.json` instead of the old `"reason"`:
To build an entire project in V4 mode, including all its dependencies, use the new `"jsx"` configuration in `rescript.json` instead of the old `"reason"`:

```json
"jsx": { "version": 4 }
Expand Down
4 changes: 2 additions & 2 deletions rewatch/tests/snapshots/remove-file.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ ERROR:

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 bsconfig.json?
- Did you include the file's directory to the "sources" in bsconfig.json?
- Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in rescript.json?
- Did you include the file's directory to the "sources" in rescript.json?



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ ERROR:

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 bsconfig.json?
- Did you include the file's directory to the "sources" in bsconfig.json?
- Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in rescript.json?
- Did you include the file's directory to the "sources" in rescript.json?


Hint: Did you mean Other_module2?
Expand Down
4 changes: 2 additions & 2 deletions rewatch/tests/snapshots/rename-file-internal-dep.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ ERROR:

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 bsconfig.json?
- Did you include the file's directory to the "sources" in bsconfig.json?
- Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in rescript.json?
- Did you include the file's directory to the "sources" in rescript.json?



Expand Down
2 changes: 1 addition & 1 deletion runtime/Belt.res
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ If you want to open Belt globally for all files in your project instead, you can
}
```

into your `bsconfig.json`.
into your `rescript.json`.

**Note**: this is the **only** `open` we encourage.

Expand Down
4 changes: 2 additions & 2 deletions tests/analysis_tests/tests/src/expected/Completion.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ Resolved opens 1 Stdlib
"kind": 4,
"tags": [],
"detail": "",
"documentation": {"kind": "markdown", "value": "The `@react.component` decorator is used to annotate functions that are RescriptReact components.\n\nYou will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.\n\nNote: The `@react.component` decorator requires the `jsx` config to be set in your `rescript.json`/`bsconfig.json` to enable the required React transformations.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-decorator)."},
"documentation": {"kind": "markdown", "value": "The `@react.component` decorator is used to annotate functions that are RescriptReact components.\n\nYou will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.\n\nNote: The `@react.component` decorator requires the `jsx` config to be set in your `rescript.json` to enable the required React transformations.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-decorator)."},
"insertTextFormat": 2
}]

Expand All @@ -768,7 +768,7 @@ Resolved opens 1 Stdlib
"kind": 4,
"tags": [],
"detail": "",
"documentation": {"kind": "markdown", "value": "The `@react.component` decorator is used to annotate functions that are RescriptReact components.\n\nYou will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.\n\nNote: The `@react.component` decorator requires the `jsx` config to be set in your `rescript.json`/`bsconfig.json` to enable the required React transformations.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-decorator)."},
"documentation": {"kind": "markdown", "value": "The `@react.component` decorator is used to annotate functions that are RescriptReact components.\n\nYou will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.\n\nNote: The `@react.component` decorator requires the `jsx` config to be set in your `rescript.json` to enable the required React transformations.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-decorator)."},
"insertTextFormat": 2
}]

Expand Down
6 changes: 3 additions & 3 deletions tests/build_tests/case/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const { stderr } = await execBuild();

if (
![
"Error: Invalid bsconfig.json implementation and interface have different path names or different cases src/demo vs src/Demo\n",
"Error: Invalid rescript.json: implementation and interface have different path names or different cases src/demo vs src/Demo\n",
// Windows: path separator
"Error: Invalid bsconfig.json implementation and interface have different path names or different cases src\\demo vs src\\Demo\n",
"Error: Invalid rescript.json: implementation and interface have different path names or different cases src\\demo vs src\\Demo\n",
// Linux: files are parsed in different order
"Error: Invalid bsconfig.json implementation and interface have different path names or different cases src/Demo vs src/demo\n",
"Error: Invalid rescript.json: implementation and interface have different path names or different cases src/Demo vs src/demo\n",
].includes(normalizeNewlines(stderr))
) {
assert.fail(stderr);
Expand Down
6 changes: 3 additions & 3 deletions tests/build_tests/case2/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const { stderr } = await execBuild();

if (
![
"Error: Invalid bsconfig.json implementation and interface have different path names or different cases src/X vs src/x\n",
"Error: Invalid rescript.json: implementation and interface have different path names or different cases src/X vs src/x\n",
// Windows: path separator
"Error: Invalid bsconfig.json implementation and interface have different path names or different cases src\\X vs src\\x\n",
"Error: Invalid rescript.json: implementation and interface have different path names or different cases src\\X vs src\\x\n",
// Linux: files are parsed in different order
"Error: Invalid bsconfig.json implementation and interface have different path names or different cases src/x vs src/X\n",
"Error: Invalid rescript.json: implementation and interface have different path names or different cases src/x vs src/X\n",
].includes(normalizeNewlines(stderr))
) {
assert.fail(stderr);
Expand Down
4 changes: 2 additions & 2 deletions tests/build_tests/super_errors/expected/modules1.res.expected
Original file line number Diff line number Diff line change
Expand Up @@ -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 bsconfig.json?
- Did you include the file's directory to the "sources" in bsconfig.json?
- Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in rescript.json?
- Did you include the file's directory to the "sources" in rescript.json?
2 changes: 1 addition & 1 deletion tests/build_tests/weird_deps/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (out.stdout !== "") {
assert.equal(
normalizeNewlines(out.stderr),
[
'File "bsconfig.json", line 1',
'File "rescript.json", line 1',
"Error: package weird not found or built",
"- Did you install it?",
"",
Expand Down
2 changes: 1 addition & 1 deletion tests/build_tests/weird_devdeps/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (out.stdout !== "") {
assert.equal(
out.stderr,
[
'File "bsconfig.json", line 1',
'File "rescript.json", line 1',
"Error: package weird not found or built",
"- Did you install it?",
"",
Expand Down